diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-09 12:01:00 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-09 12:01:00 +0000 |
commit | a61b5e0da10bb912f371044395af945a62c3d5ed (patch) | |
tree | e6e8b2b8e683f861dd118f9d778b3c3775b6b3ff /lib | |
parent | ddc270b036c72080888be3a12fe81aa9e1d963b0 (diff) |
Do not return EINVAL if param is NULL or the desired scheduling policy
is unsupported but EOPNOTSUPP; from FreeBSD.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc_r/uthread/uthread_attr_setschedparam.c | 20 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_attr_setschedparam.c | 20 |
2 files changed, 34 insertions, 6 deletions
diff --git a/lib/libc_r/uthread/uthread_attr_setschedparam.c b/lib/libc_r/uthread/uthread_attr_setschedparam.c index 216e1992c8b..eb7bda9f92f 100644 --- a/lib/libc_r/uthread/uthread_attr_setschedparam.c +++ b/lib/libc_r/uthread/uthread_attr_setschedparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_attr_setschedparam.c,v 1.2 1999/11/25 07:01:32 d Exp $ */ +/* $OpenBSD: uthread_attr_setschedparam.c,v 1.3 2001/08/09 12:00:59 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. * All rights reserved. @@ -42,9 +42,23 @@ pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param { int ret = 0; - if ((attr == NULL) || (*attr == NULL) || (param == NULL)) + if ((attr == NULL) || (*attr == NULL)) ret = EINVAL; - else + else if (param == NULL) { +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else if ((param->sched_priority < PTHREAD_MIN_PRIORITY) || + (param->sched_priority > PTHREAD_MAX_PRIORITY)) { + /* Return an unsupported value error. */ +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else (*attr)->prio = param->sched_priority; return(ret); diff --git a/lib/libpthread/uthread/uthread_attr_setschedparam.c b/lib/libpthread/uthread/uthread_attr_setschedparam.c index 216e1992c8b..eb7bda9f92f 100644 --- a/lib/libpthread/uthread/uthread_attr_setschedparam.c +++ b/lib/libpthread/uthread/uthread_attr_setschedparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_attr_setschedparam.c,v 1.2 1999/11/25 07:01:32 d Exp $ */ +/* $OpenBSD: uthread_attr_setschedparam.c,v 1.3 2001/08/09 12:00:59 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. * All rights reserved. @@ -42,9 +42,23 @@ pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param { int ret = 0; - if ((attr == NULL) || (*attr == NULL) || (param == NULL)) + if ((attr == NULL) || (*attr == NULL)) ret = EINVAL; - else + else if (param == NULL) { +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else if ((param->sched_priority < PTHREAD_MIN_PRIORITY) || + (param->sched_priority > PTHREAD_MAX_PRIORITY)) { + /* Return an unsupported value error. */ +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else (*attr)->prio = param->sched_priority; return(ret); |