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