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


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

Submitter:  Samuel Thibault <sthibaul>
Submitted:  Thu 25 Jan 2007 11:22:19 PM UTC
Category:  glibc Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Standard Compliance
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Reproducibility:  Every Time
Size (loc):  None Planned Release:  None
Effort:  0.00
Wiki-like text discussion box: 

* Mandatory Fields

Add a New Comment Rich Markup

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>
Group administrator
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>
Group 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>
Group administrator


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code