mailing list of musl libc
 help / color / mirror / code / Atom feed
* nice standards complaince issue
@ 2013-04-13 22:23 Justin Cormack
  2013-04-15  1:45 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Justin Cormack @ 2013-04-13 22:23 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

According to the man page, Musl nice is not compliant, it is defined to
return 0 if successful

int nice(int inc)
{
#ifdef SYS_nice
        return syscall(SYS_nice, inc);
#else
        return setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS,
0)+inc);
#endif
}

However the manpage says it is required to return the new value:

SUSv2 and POSIX.1-2001 specify that nice() should return the new nice
value.  However, the Linux  syscall  and  the  nice() library  function
provided in older versions of (g)libc (earlier than glibc 2.2.4) return 0
on success.  The new nice value can be found using getpriority(2).

Since glibc 2.2.4, nice() is implemented as a library function that calls
getpriority(2) to obtain the new nice value to be returned  to  the
 caller.   With this implementation, a successful call can legitimately
return -1.  To reliably detect an error, set errno to 0 before the call,
and check its value when nice() returns -1.

[-- Attachment #2: Type: text/html, Size: 1212 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-15  7:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-13 22:23 nice standards complaince issue Justin Cormack
2013-04-15  1:45 ` Rich Felker
2013-04-15  7:31   ` Justin Cormack

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).