projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68a95e6
)
Be nice()
author
Steven Barth
<steven@midlink.org>
Tue, 10 Mar 2009 20:59:56 +0000
(20:59 +0000)
committer
Steven Barth
<steven@midlink.org>
Tue, 10 Mar 2009 20:59:56 +0000
(20:59 +0000)
libs/nixio/src/process.c
patch
|
blob
|
history
diff --git
a/libs/nixio/src/process.c
b/libs/nixio/src/process.c
index
af44484
..
0d60ed1
100644
(file)
--- a/
libs/nixio/src/process.c
+++ b/
libs/nixio/src/process.c
@@
-149,12
+149,27
@@
static int nixio_setuid(lua_State *L) {
return nixio__pstatus(L, !setuid(uid));
}
return nixio__pstatus(L, !setuid(uid));
}
+static int nixio_nice(lua_State *L) {
+ int nval = luaL_checkint(L, 1);
+
+ errno = 0;
+ nval = nice(nval);
+
+ if (nval == -1 && errno) {
+ return nixio__perror(L);
+ } else {
+ lua_pushinteger(L, nval);
+ return 1;
+ }
+}
+
/* module table */
static const luaL_reg R[] = {
{"fork", nixio_fork},
{"wait", nixio_wait},
{"kill", nixio_kill},
/* module table */
static const luaL_reg R[] = {
{"fork", nixio_fork},
{"wait", nixio_wait},
{"kill", nixio_kill},
+ {"nice", nixio_nice},
{"getpid", nixio_getpid},
{"getppid", nixio_getppid},
{"getuid", nixio_getuid},
{"getpid", nixio_getpid},
{"getppid", nixio_getppid},
{"getuid", nixio_getuid},