Description of problem: The man page for nice(2) states: ERRORS EPERM The calling process attempted to increase its priority by sup- plying a negative inc but has insufficient privileges. Under Linux the CAP_SYS_NICE capability is required. (But see the discussion of the RLIMIT_NICE resource limit in setrlimit(2).) However, glibc() converts a call to nice(2) into a call to setpriority(2) which WILL return with errno set to EACCES. An strace of the program: #include <errno.h> main() { if (nice(-19) < 0) printf("%d\n", errno); } shows it in reality calls: setpriority(PRIO_PROCESS, 0, 4294967277) = -1 EACCES (Permission denied) Version-Release number of selected component (if applicable): glibc-2.4.8 How reproducible: Run the test program above. Steps to Reproduce: 1. Compile the code snippet above 2. Run 3. See incorrect errno set Actual results: failure with errno set to EACCES Expected results: failure with errno set to EPERM Additional info: This isn't just a man page error, as if the legacy nice syscall is invoked, it reacts as documented. For example, this program: #include <sys/types.h> #include <sys/syscall.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <errno.h> main() { if (nice(-19) < 0) printf("%d\n", errno); if (syscall(__NR_nice, -19) < 0) printf("%d\n", errno); } will return: $ ./a.out 13 1
Fixed in upstream CVS and glibc-2.4.90-20 in rawhide.