xref: /minix/minix/lib/libsys/sys_vtimer.c (revision 7f5f010b)
1 #include "syslib.h"
2 
3 int sys_vtimer(proc, which, newval, oldval)
4 endpoint_t proc;		/* proc to retrieve/set the timer for */
5 int which;			/* timer to retrieve/set */
6 clock_t *newval;		/* if non-NULL, set to this new value */
7 clock_t *oldval;		/* if non-NULL, old value is stored here */
8 {
9   message m;
10   int r;
11 
12   m.VT_ENDPT = proc;
13   m.VT_WHICH = which;
14   if (newval != NULL) {
15       m.VT_SET = 1;
16       m.VT_VALUE = *newval;
17   } else {
18       m.VT_SET = 0;
19   }
20 
21   r = _kernel_call(SYS_VTIMER, &m);
22 
23   if (oldval != NULL) {
24       *oldval = m.VT_VALUE;
25   }
26 
27   return(r);
28 }
29