diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-15 15:45:48 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-15 15:45:48 +0000 |
commit | 0100ee14a479110fe3e4756063d5ea95b2f7941f (patch) | |
tree | 5160063035063efa7a2c63464400b9c1df6fab65 | |
parent | 44cb10857ad38c6166a47ae3b4e22e368babfd21 (diff) |
For unsupported sched policies, return ENOTSUP, not EINVAL; from FreeBSD.
-rw-r--r-- | lib/libc_r/uthread/uthread_setschedparam.c | 16 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_setschedparam.c | 16 |
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/libc_r/uthread/uthread_setschedparam.c b/lib/libc_r/uthread/uthread_setschedparam.c index 26e1b61d017..18e1efaf7cb 100644 --- a/lib/libc_r/uthread/uthread_setschedparam.c +++ b/lib/libc_r/uthread/uthread_setschedparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_setschedparam.c,v 1.2 1999/11/25 07:01:43 d Exp $ */ +/* $OpenBSD: uthread_setschedparam.c,v 1.3 2001/08/15 15:45:47 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. * All rights reserved. @@ -43,14 +43,20 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p { int old_prio, in_readyq = 0, ret = 0; - if ((param == NULL) || (param->sched_priority < PTHREAD_MIN_PRIORITY) || - (param->sched_priority > PTHREAD_MAX_PRIORITY) || - (policy < SCHED_FIFO) || (policy > SCHED_RR)) + if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR)) { /* Return an invalid argument error: */ ret = EINVAL; + } 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 /* Find the thread in the list of active threads: */ - else if ((ret = _find_thread(pthread)) == 0) { + } else if ((ret = _find_thread(pthread)) == 0) { /* * Defer signals to protect the scheduling queues from * access by the signal handler: diff --git a/lib/libpthread/uthread/uthread_setschedparam.c b/lib/libpthread/uthread/uthread_setschedparam.c index 26e1b61d017..18e1efaf7cb 100644 --- a/lib/libpthread/uthread/uthread_setschedparam.c +++ b/lib/libpthread/uthread/uthread_setschedparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_setschedparam.c,v 1.2 1999/11/25 07:01:43 d Exp $ */ +/* $OpenBSD: uthread_setschedparam.c,v 1.3 2001/08/15 15:45:47 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. * All rights reserved. @@ -43,14 +43,20 @@ pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *p { int old_prio, in_readyq = 0, ret = 0; - if ((param == NULL) || (param->sched_priority < PTHREAD_MIN_PRIORITY) || - (param->sched_priority > PTHREAD_MAX_PRIORITY) || - (policy < SCHED_FIFO) || (policy > SCHED_RR)) + if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR)) { /* Return an invalid argument error: */ ret = EINVAL; + } 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 /* Find the thread in the list of active threads: */ - else if ((ret = _find_thread(pthread)) == 0) { + } else if ((ret = _find_thread(pthread)) == 0) { /* * Defer signals to protect the scheduling queues from * access by the signal handler: |