00001 /* 00002 priority.c 00003 */ 00004 00005 #include <errno.h> 00006 #include <sys/types.h> 00007 #include <sys/resource.h> 00008 #include <lib.h> 00009 #include <unistd.h> 00010 #include <string.h> 00011 #include <stddef.h> 00012 00013 00014 int getpriority(int which, int who) 00015 { 00016 int v; 00017 message m; 00018 00019 m.m1_i1 = which; 00020 m.m1_i2 = who; 00021 00022 /* GETPRIORITY returns negative for error. 00023 * Otherwise, it returns the priority plus the minimum 00024 * priority, to distiginuish from error. We have to 00025 * correct for this. (The user program has to check errno 00026 * to see if something really went wrong.) 00027 */ 00028 00029 if((v = _syscall(MM, GETPRIORITY, &m)) < 0) { 00030 return v; 00031 } 00032 00033 return v + PRIO_MIN; 00034 } 00035 00036 int setpriority(int which, int who, int prio) 00037 { 00038 message m; 00039 00040 m.m1_i1 = which; 00041 m.m1_i2 = who; 00042 m.m1_i3 = prio; 00043 00044 return _syscall(MM, SETPRIORITY, &m); 00045 } 00046
1.4.6