Nice(3) implementation

This commit is contained in:
Philip Homburg
2006-10-20 14:10:53 +00:00
parent 0b2c167c48
commit be928f01a5
3 changed files with 21 additions and 0 deletions

View File

@@ -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
View 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);
}