Subject: lib/30970: Invalid return values for POSIX RT sched_ functions
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <ianzag@megasignal.com>
List: netbsd-bugs
Date: 08/11/2005 08:25:00
>Number: 30970
>Category: lib
>Synopsis: Invalid return values for POSIX RT sched_ functions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 11 08:25:00 +0000 2005
>Originator: Ian Zagorskih
>Release: NetBSD-current
>Organization:
NGEDC
>Environment:
NetBSD IANZAG 3.99.7 NetBSD 3.99.7 (IANZAG-ACPI) #2: Wed Jul 27 14:03:25 NOVST 2005 ianzag@IANZAG:/home/ianzag/NetBSD/kernel/IANZAG-ACPI i386
>Description:
Accordint to POSIX RT specification, sched_ functions should return -1 and set errno value to ENOSYS when function is not implemented:
http://www.opengroup.org/onlinepubs/009695399/functions/sched_setparam.html
---cut---
RETURN VALUE
If successful, the sched_setparam() function shall return zero.
If the call to sched_setparam() is unsuccessful, the priority shall remain unchanged, and the function shall return a value of -1 and set errno to indicate the error.
---cut---
Same time sched_ functions in NetBSD return ENOSYS instead of -1 and leaves errno value unchanged. This behaviour can confuse applications which explicitely test return values on -1.
>How-To-Repeat:
less /usr/src/lib/libpthread/sched.c
>Fix:
Just return -1 and set errno value to ENOSYS.