bugThe GNU Hurd - Bugs: bug #18883, nice/getpriority/setpriority...


bug #18883: nice/getpriority/setpriority enforces even nice values

Submitted by:  Samuel Thibault <sthibaul>
Submitted on:  Thu 25 Jan 2007 11:22:19 PM UTC  
Category: glibcSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Standard Compliance
Status: NonePrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: OpenReproducibility: Every Time
Size (loc): NonePlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 28 Apr 2014 04:55:48 PM UTC, comment #2:

Well, yes, I eventually commited the change to gnumach, and the
corresponding glibc change is in topgit's t/nice branch :)

Samuel Thibault <sthibaul>
Project Member
Mon 28 Apr 2014 04:48:43 PM UTC, comment #1:

Contrary to its documentation, my gnumach has actually 50 priorities:

#define NRQS 50 /* 50 run queues per cpu */
#define invalid_pri(pri) (((pri) < 0) || ((pri) >= NRQS))

So we can actually have a bijective mapping from Mach priorities to posix nice values.

Justus Winter <teythoon>
Project Member
Thu 25 Jan 2007 11:22:19 PM UTC, original submission:

Because of limitation of the Mach kernel, nice values are divided by two for getting a Mach priority (MACH_PRIORITY_TO_NICE), and mach priority is multiplied by two for getting a nice value (NICE_TO_MACH_PRIORITY).

That makes setpriority/getpriority/nice behave strangely: they enforce an even nice value, which makes the corutils package's testsuite fail.

The POSIX standard says ``The nice() function shall add the value of incr to the nice value of the calling process.'' and ``Upon successful completion, nice() shall return the new nice value - {NZERO}.''

Does glibc need corrected or the testsuite fixed to accept such a behavior? I'd say glibc should be corrected, keeping the nice value in a global variable.

Samuel Thibault <sthibaul>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by teythoon (Posted a comment)
  • -unavailable- added by sthibaul (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1