libc, libutil: remove compat hacks
[minix.git] / lib / libc / sys-minix / priority.c
blob451d4497a4170a9f00c58aea908f2079d9a33f20
1 /*
2 priority.c
3 */
5 #include <sys/cdefs.h>
6 #include "namespace.h"
7 #include <errno.h>
8 #include <sys/types.h>
9 #include <sys/resource.h>
10 #include <lib.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <stddef.h>
16 int getpriority(int which, int who)
18 int v;
19 message m;
21 m.m1_i1 = which;
22 m.m1_i2 = who;
24 /* GETPRIORITY returns negative for error.
25 * Otherwise, it returns the priority plus the minimum
26 * priority, to distiginuish from error. We have to
27 * correct for this. (The user program has to check errno
28 * to see if something really went wrong.)
31 if((v = _syscall(PM_PROC_NR, GETPRIORITY, &m)) < 0) {
32 return v;
35 return v + PRIO_MIN;
38 int setpriority(int which, int who, int prio)
40 message m;
42 m.m1_i1 = which;
43 m.m1_i2 = who;
44 m.m1_i3 = prio;
46 return _syscall(PM_PROC_NR, SETPRIORITY, &m);