summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-05-02 06:51:40 +0000
committerjasone <jasone@FreeBSD.org>2000-05-02 06:51:40 +0000
commit03d029f134f6886d414e869610af3f09054ef37e (patch)
treed5f8485897f9957f144321659a45c86542f4d63d /lib/libkse
parent548e56c9d24f4f96bf7751d190bf456f023ac145 (diff)
downloadFreeBSD-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/libkse')
-rw-r--r--lib/libkse/thread/thr_attr_setschedparam.c6
-rw-r--r--lib/libkse/thread/thr_attr_setschedpolicy.c7
-rw-r--r--lib/libkse/thread/thr_attr_setscope.c17
-rw-r--r--lib/libkse/thread/thr_mattr_kind_np.c15
-rw-r--r--lib/libkse/thread/thr_setschedparam.c10
5 files changed, 34 insertions, 21 deletions
diff --git a/lib/libkse/thread/thr_attr_setschedparam.c b/lib/libkse/thread/thr_attr_setschedparam.c
index 5746fe2..6c4166b 100644
--- a/lib/libkse/thread/thr_attr_setschedparam.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_attr_setschedpolicy.c b/lib/libkse/thread/thr_attr_setschedpolicy.c
index 640cb38..2788deb 100644
--- a/lib/libkse/thread/thr_attr_setschedpolicy.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_attr_setscope.c b/lib/libkse/thread/thr_attr_setscope.c
index 84239d7..de2fe8e 100644
--- a/lib/libkse/thread/thr_attr_setscope.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_mattr_kind_np.c b/lib/libkse/thread/thr_mattr_kind_np.c
index 8b3b8cb..1a0832f 100644
--- a/lib/libkse/thread/thr_mattr_kind_np.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_setschedparam.c b/lib/libkse/thread/thr_setschedparam.c
index f080d5d..bce965f 100644
--- a/lib/libkse/thread/thr_setschedparam.c
+++ b/lib/libkse/thread/thr_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:
OpenPOWER on IntegriCloud