33 lines
880 B
Diff
33 lines
880 B
Diff
From fdd7de4dbb4b214b45e1b53100110af4e4895458 Mon Sep 17 00:00:00 2001
|
|
From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
|
Date: Sat, 19 Apr 2008 17:49:05 +0200
|
|
Subject: [PATCH 01/18] Return new nice value for nice(2)
|
|
|
|
Changed nice(2) to return the new nice value instead of 0/-1.
|
|
---
|
|
lib/__nice.c | 8 ++++++--
|
|
1 files changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lib/__nice.c b/lib/__nice.c
|
|
index d751104..8e205c0 100644
|
|
--- a/lib/__nice.c
|
|
+++ b/lib/__nice.c
|
|
@@ -1,9 +1,13 @@
|
|
#include "syscalls.h"
|
|
-#include <sys/time.h>
|
|
+#include <errno.h>
|
|
#include <sys/resource.h>
|
|
|
|
#ifndef __NR_nice
|
|
int nice(int i) {
|
|
- return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i);
|
|
+ if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) {
|
|
+ errno=EPERM;
|
|
+ return -1;
|
|
+ }
|
|
+ return getpriority(PRIO_PROCESS,0);
|
|
}
|
|
#endif
|
|
--
|
|
1.6.2.5
|
|
|