This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/10828] New: New check added in pthread_attr_setschedparam() causes hard-to-explain behavior


(This problem was found by analyzing a failure of LSB distribution compliance
test, lsb-runtime, v. 4.0.2.)

A relatively new change in $GITROOT/glibc/nptl/pthread_attr_setschedparam.c
(2009-04-23 according to git) adds a check to pthread_attr_setschedparam() call
whether the priority being set is compatible with the scheduling policy already
set in the structure; if the priority is not in the prescribed range, it fails,
generating the EINVAL error.

This check, although well intended, has a side effect that can break existing
code (at least the LSB tests): it makes the process of initializing a
pthread_attr structure order-dependent on Linux.

As Linux does not use the numeric priority for SCHED_OTHER, which is the
default, and sched_get_priority_min() and sched_priority_max() return 0. Therefore:

If a programmer calls pthread_attr_init(), then pthread_attr_setschedpolicy() to
set SCHED_RR or SCHED_FIFO, and then pthread_attr_setschedparam(), it works. But
if the other way around (priority first, then scheduling policy), it fails for
"no apparent reason".

-- 
           Summary: New check added in pthread_attr_setschedparam() causes
                    hard-to-explain behavior
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: jdluhos at suse dot cz
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10828

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]