source: trunk/minix/lib/posix/priority.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 764 bytes
Line 
1/*
2priority.c
3*/
4
5#include <errno.h>
6#include <sys/types.h>
7#include <sys/resource.h>
8#include <lib.h>
9#include <unistd.h>
10#include <string.h>
11#include <stddef.h>
12
13
14int getpriority(int which, int who)
15{
16 int v;
17 message m;
18
19 m.m1_i1 = which;
20 m.m1_i2 = who;
21
22 /* GETPRIORITY returns negative for error.
23 * Otherwise, it returns the priority plus the minimum
24 * priority, to distiginuish from error. We have to
25 * correct for this. (The user program has to check errno
26 * to see if something really went wrong.)
27 */
28
29 if((v = _syscall(MM, GETPRIORITY, &m)) < 0) {
30 return v;
31 }
32
33 return v + PRIO_MIN;
34}
35
36int setpriority(int which, int who, int prio)
37{
38 message m;
39
40 m.m1_i1 = which;
41 m.m1_i2 = who;
42 m.m1_i3 = prio;
43
44 return _syscall(MM, SETPRIORITY, &m);
45}
46
Note: See TracBrowser for help on using the repository browser.