etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libc / sys / setitimer.c
blob3157793f77e7e2a6e8e06bd81761b03b31a97a0e
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
5 #include <string.h>
6 #include <sys/time.h>
8 /*
9 * This is the implementation of the function to
10 * invoke the interval timer setting system call.
12 int setitimer(int which, const struct itimerval *__restrict value,
13 struct itimerval *__restrict ovalue)
15 message m;
17 /* A null pointer for 'value' would make setitimer behave like getitimer,
18 * which is not according to the specification, so disallow null pointers.
20 if (value == NULL) {
21 errno = EINVAL;
22 return -1;
25 memset(&m, 0, sizeof(m));
26 m.m_lc_pm_itimer.which = which;
27 m.m_lc_pm_itimer.value = (vir_bytes)value;
28 m.m_lc_pm_itimer.ovalue = (vir_bytes)ovalue;
30 return _syscall(PM_PROC_NR, PM_ITIMER, &m);
33 #if defined(__minix) && defined(__weak_alias)
34 __weak_alias(setitimer, __setitimer50)
35 #endif