From 9dbad4f5539700e08d0bab4a256c1c9014e73148 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Thu, 9 Aug 2001 12:04:15 +0000 Subject: Only return EINVAL if attr is invalid. If policy is invalid return EOPNOTSUPP; from FreeBSD. --- lib/libc_r/uthread/uthread_attr_setschedpolicy.c | 15 ++++++++++----- lib/libpthread/uthread/uthread_attr_setschedpolicy.c | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/libc_r/uthread/uthread_attr_setschedpolicy.c b/lib/libc_r/uthread/uthread_attr_setschedpolicy.c index f5090d987a9..8f641181906 100644 --- a/lib/libc_r/uthread/uthread_attr_setschedpolicy.c +++ b/lib/libc_r/uthread/uthread_attr_setschedpolicy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_attr_setschedpolicy.c,v 1.2 1999/11/25 07:01:32 d Exp $ */ +/* $OpenBSD: uthread_attr_setschedpolicy.c,v 1.3 2001/08/09 12:04:14 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen . * All rights reserved. @@ -42,12 +42,17 @@ 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)) { +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else (*attr)->sched_policy = policy; - return(ret); + return (ret); } #endif diff --git a/lib/libpthread/uthread/uthread_attr_setschedpolicy.c b/lib/libpthread/uthread/uthread_attr_setschedpolicy.c index f5090d987a9..8f641181906 100644 --- a/lib/libpthread/uthread/uthread_attr_setschedpolicy.c +++ b/lib/libpthread/uthread/uthread_attr_setschedpolicy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_attr_setschedpolicy.c,v 1.2 1999/11/25 07:01:32 d Exp $ */ +/* $OpenBSD: uthread_attr_setschedpolicy.c,v 1.3 2001/08/09 12:04:14 fgsch Exp $ */ /* * Copyright (c) 1998 Daniel Eischen . * All rights reserved. @@ -42,12 +42,17 @@ 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)) { +#ifdef NOT_YET + ret = ENOTSUP; +#else + ret = EOPNOTSUPP; +#endif + } else (*attr)->sched_policy = policy; - return(ret); + return (ret); } #endif -- cgit v1.2.3