Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 13 Apr 2013 23:23:08 +0100
From: Justin Cormack <justin@...cialbusservice.com>
To: musl@...ts.openwall.com
Subject: nice standards complaince issue

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.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.