aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce.freebsd@certner.fr>2023-11-24 21:21:16 +0000
committerOlivier Certner <olce@FreeBSD.org>2024-01-04 10:42:08 +0000
commit0eccb45979a8ee3129e11b638ebc4cfa00942b80 (patch)
tree767c073bc259d3715143870ae0aba313715a4c6c
parentbd61c1e89dc4a40ba696de1785d423978e1c2147 (diff)
downloadsrc-0eccb45979a8ee3129e11b638ebc4cfa00942b80.tar.gz
src-0eccb45979a8ee3129e11b638ebc4cfa00942b80.zip
-rw-r--r--lib/libthr/thread/thr_attr.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
index decbcb949167..0ccc31b22c13 100644
--- a/lib/libthr/thread/thr_attr.c
+++ b/lib/libthr/thread/thr_attr.c
@@ -380,13 +380,11 @@ int
_thr_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
{
- if (attr == NULL || *attr == NULL)
+ if (attr == NULL || *attr == NULL ||
+ (sched_inherit != PTHREAD_INHERIT_SCHED &&
+ sched_inherit != PTHREAD_EXPLICIT_SCHED))
return (EINVAL);
- if (sched_inherit != PTHREAD_INHERIT_SCHED &&
- sched_inherit != PTHREAD_EXPLICIT_SCHED)
- return (ENOTSUP);
-
(*attr)->sched_inherit = sched_inherit;
return (0);
}
@@ -400,18 +398,15 @@ _thr_attr_setschedparam(pthread_attr_t * __restrict attr,
{
int policy;
- if (attr == NULL || *attr == NULL)
+ if (attr == NULL || *attr == NULL || param == NULL)
return (EINVAL);
- if (param == NULL)
- return (ENOTSUP);
-
policy = (*attr)->sched_policy;
if (policy == SCHED_FIFO || policy == SCHED_RR) {
if (param->sched_priority < _thr_priorities[policy-1].pri_min ||
param->sched_priority > _thr_priorities[policy-1].pri_max)
- return (ENOTSUP);
+ return (EINVAL);
} else {
/*
* Ignore it for SCHED_OTHER now, patches for glib ports
@@ -432,10 +427,9 @@ int
_thr_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
- if (attr == NULL || *attr == NULL)
+ if (attr == NULL || *attr == NULL ||
+ policy < SCHED_FIFO || policy > SCHED_RR)
return (EINVAL);
- if (policy < SCHED_FIFO || policy > SCHED_RR)
- return (ENOTSUP);
(*attr)->sched_policy = policy;
(*attr)->prio = _thr_priorities[policy-1].pri_default;