Nice(3) implementation
This commit is contained in:
@@ -102,6 +102,7 @@ libc_FILES=" \
|
||||
getloadavg.c \
|
||||
getopt.c \
|
||||
gettimeofday.c \
|
||||
nice.c \
|
||||
priority.c \
|
||||
usleep.c"
|
||||
|
||||
|
||||
19
lib/posix/nice.c
Normal file
19
lib/posix/nice.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
nice.c
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
int nice(incr)
|
||||
int incr;
|
||||
{
|
||||
int r;
|
||||
|
||||
errno= 0;
|
||||
r= getpriority(PRIO_PROCESS, 0);
|
||||
if (r == -1 && errno != 0)
|
||||
return r;
|
||||
return setpriority(PRIO_PROCESS, 0, r+incr);
|
||||
}
|
||||
Reference in New Issue
Block a user