Bug 15088 - glibc wrongly defines _POSIX_PRIORITY_SCHEDULING
Summary: glibc wrongly defines _POSIX_PRIORITY_SCHEDULING
Status: RESOLVED DUPLICATE of bug 14829
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-31 07:11 UTC by Rich Felker
Modified: 2018-12-07 12:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Felker 2013-01-31 07:11:07 UTC
The _POSIX_PRIORITY_SCHEDULING macro is specified by POSIX to indicate that the implementation supports the Process Scheduling [PS] option group, documented here:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_04

On Linux, glibc defines _POSIX_PRIORITY_SCHEDULING, but does not implement the Process Scheduling functionality of POSIX; Linux does not even support the required functionality.

What's worse, glibc DOES provide functions with the same names as the functions in the Process Scheduling group (sched_*), but the glibc semantics for these functions are radically different from those specified in Process Scheduling. In particular, the glibc functions do not take a process id as their argument; they take a kernelspace tid, which is not even available to applications because glibc does not provide gettid(). Even if passed the pid (which is also the tid of the main thread), these functions only change the scheduling properties for a single thread, not for the process. Linux does not even support process-level scheduling options, only thread-level ones.

Since it doesn't seem realistic to remove the erroneous functionality the sched_* functions are providing now, I think a reasonable solution would be to redefine _POSIX_PRIORITY_SCHEDULING to -1 or 0 and have sysconf return -1 for it. If glibc does not advertise support the the Process Scheduling option, then it's under no obligation to provide the standard sched_* functions, nor to avoid providing conflicting functions with the same names.
Comment 1 Florian Weimer 2018-12-07 12:33:07 UTC
.

*** This bug has been marked as a duplicate of bug 14829 ***