public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/10828] New: New check added in pthread_attr_setschedparam() causes hard-to-explain behavior
@ 2009-10-22 13:41 jdluhos at suse dot cz
  2009-10-22 13:52 ` [Bug nptl/10828] " drepper at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: jdluhos at suse dot cz @ 2009-10-22 13:41 UTC (permalink / raw)
  To: glibc-bugs

(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.


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-10828-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-07-01  5:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22 13:41 [Bug nptl/10828] New: New check added in pthread_attr_setschedparam() causes hard-to-explain behavior jdluhos at suse dot cz
2009-10-22 13:52 ` [Bug nptl/10828] " drepper at redhat dot com
2009-10-22 14:17 ` jdluhos at suse dot cz
2009-10-26 11:43 ` jdluhos at suse dot cz
2010-06-01  3:09 ` pasky at suse dot cz
     [not found] <bug-10828-131@http.sourceware.org/bugzilla/>
2014-07-01  5:35 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).