mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-22 00:38:06 +08:00
Cygwin: nice: align return value and errno with POSIX and Linux
Return new nice value instead of 0 on success. Set errno to EPERM instead of EACCES on failure. Signed-off-by: Christian Franke <christian.franke@t-online.de>
This commit is contained in:
parent
9ae51bcc51
commit
6adfb1fc28
@ -48,3 +48,7 @@ What changed:
|
||||
or EPERM if Windows would silently set a lower priority
|
||||
(HIGH_PRIORITY_CLASS instead of REALTIME_PRIORITY_CLASS) due to
|
||||
missing administrator privileges.
|
||||
|
||||
- nice(2) now returns the new nice value instead of 0 on success
|
||||
and sets errno to EPERM instead of EACCES on failure. This confirms
|
||||
to POSIX and Linux (glibc >= 2.2.4) behavior.
|
||||
|
@ -3959,7 +3959,16 @@ out:
|
||||
extern "C" int
|
||||
nice (int incr)
|
||||
{
|
||||
return setpriority (PRIO_PROCESS, myself->pid, myself->nice + incr);
|
||||
if (setpriority (PRIO_PROCESS, myself->pid, myself->nice + incr))
|
||||
{
|
||||
/* POSIX: EPERM instead of EACCES. */
|
||||
set_errno (EPERM);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* POSIX: return the new nice value. Linux glibc >= 2.2.4 provides
|
||||
conformance with POSIX (FreeBSD returns 0). */
|
||||
return myself->nice;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user