etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libc / sys / priority.c
blob74c4be52bd6a386beca8c318964787c529a796fa
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, id_t who)
18 int v;
19 message m;
21 memset(&m, 0, sizeof(m));
22 m.m_lc_pm_priority.which = which;
23 m.m_lc_pm_priority.who = who;
25 /* GETPRIORITY returns negative for error.
26 * Otherwise, it returns the priority plus the minimum
27 * priority, to distiginuish from error. We have to
28 * correct for this. (The user program has to check errno
29 * to see if something really went wrong.)
32 if((v = _syscall(PM_PROC_NR, PM_GETPRIORITY, &m)) < 0) {
33 return v;
36 return v + PRIO_MIN;
39 int setpriority(int which, id_t who, int prio)
41 message m;
43 memset(&m, 0, sizeof(m));
44 m.m_lc_pm_priority.which = which;
45 m.m_lc_pm_priority.who = who;
46 m.m_lc_pm_priority.prio = prio;
48 return _syscall(PM_PROC_NR, PM_SETPRIORITY, &m);