diff options
author | jasone <jasone@FreeBSD.org> | 2000-05-02 06:51:40 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2000-05-02 06:51:40 +0000 |
commit | 03d029f134f6886d414e869610af3f09054ef37e (patch) | |
tree | d5f8485897f9957f144321659a45c86542f4d63d /lib/libc_r/uthread | |
parent | 548e56c9d24f4f96bf7751d190bf456f023ac145 (diff) | |
download | FreeBSD-src-03d029f134f6886d414e869610af3f09054ef37e.zip FreeBSD-src-03d029f134f6886d414e869610af3f09054ef37e.tar.gz |
Add missing man pages. Fix various compliance bugs, mostly having to do with
error return values. Implement pthread_mutexattr_gettype().
PR: docs/16537, docs/17538
Diffstat (limited to 'lib/libc_r/uthread')
-rw-r--r-- | lib/libc_r/uthread/uthread_attr_setschedparam.c | 6 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_attr_setschedpolicy.c | 7 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_attr_setscope.c | 17 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_mattr_kind_np.c | 15 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_setschedparam.c | 10 |
5 files changed, 34 insertions, 21 deletions
diff --git a/lib/libc_r/uthread/uthread_attr_setschedparam.c b/lib/libc_r/uthread/uthread_attr_setschedparam.c index 5746fe2..6c4166b 100644 --- a/lib/libc_r/uthread/uthread_attr_setschedparam.c +++ b/lib/libc_r/uthread/uthread_attr_setschedparam.c @@ -41,9 +41,11 @@ 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) { + ret = ENOTSUP; + } else (*attr)->prio = param->sched_priority; return(ret); diff --git a/lib/libc_r/uthread/uthread_attr_setschedpolicy.c b/lib/libc_r/uthread/uthread_attr_setschedpolicy.c index 640cb38..2788deb 100644 --- a/lib/libc_r/uthread/uthread_attr_setschedpolicy.c +++ b/lib/libc_r/uthread/uthread_attr_setschedpolicy.c @@ -41,10 +41,11 @@ pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) { int ret = 0; - if ((attr == NULL) || (*attr == NULL) || (policy < SCHED_FIFO) || - (policy > SCHED_RR)) + if ((attr == NULL) || (*attr == NULL)) ret = EINVAL; - else + else if ((policy < SCHED_FIFO) || (policy > SCHED_RR)) { + ret = ENOTSUP; + } else (*attr)->sched_policy = policy; return(ret); diff --git a/lib/libc_r/uthread/uthread_attr_setscope.c b/lib/libc_r/uthread/uthread_attr_setscope.c index 84239d7..de2fe8e 100644 --- a/lib/libc_r/uthread/uthread_attr_setscope.c +++ b/lib/libc_r/uthread/uthread_attr_setscope.c @@ -41,21 +41,14 @@ pthread_attr_setscope(pthread_attr_t *attr, int contentionscope) { int ret = 0; - if ((attr == NULL) || (*attr == NULL) || - (contentionscope != PTHREAD_SCOPE_PROCESS) || - (contentionscope != PTHREAD_SCOPE_SYSTEM)) + if ((attr == NULL) || (*attr == NULL)) { /* Return an invalid argument: */ ret = EINVAL; - - else if (contentionscope == PTHREAD_SCOPE_SYSTEM) - /* We don't support system wide contention: */ -#ifdef NOT_YET + } else if ((contentionscope != PTHREAD_SCOPE_PROCESS) || + (contentionscope != PTHREAD_SCOPE_SYSTEM)) { + /* We don't support PTHREAD_SCOPE_SYSTEM. */ ret = ENOTSUP; -#else - ret = EOPNOTSUPP; -#endif - - else + } else (*attr)->flags |= contentionscope; return(ret); diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c index 8b3b8cb..1a0832f 100644 --- a/lib/libc_r/uthread/uthread_mattr_kind_np.c +++ b/lib/libc_r/uthread/uthread_mattr_kind_np.c @@ -76,4 +76,19 @@ pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) } return(ret); } + +int +pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type) +{ + int ret; + + if (attr == NULL || *attr == NULL || (*attr)->m_type >= + MUTEX_TYPE_MAX) { + ret = EINVAL; + } else { + *type = (*attr)->m_type; + ret = 0; + } + return ret; +} #endif diff --git a/lib/libc_r/uthread/uthread_setschedparam.c b/lib/libc_r/uthread/uthread_setschedparam.c index f080d5d..bce965f 100644 --- a/lib/libc_r/uthread/uthread_setschedparam.c +++ b/lib/libc_r/uthread/uthread_setschedparam.c @@ -43,14 +43,16 @@ pthread_setschedparam(pthread_t pthread, int policy, { 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. */ + ret = ENOTSUP; /* 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: |