27 lines
868 B
C
27 lines
868 B
C
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include "../internal/syscall.h"
|
|
|
|
#if VLIBC_LEVEL_GE(2)
|
|
|
|
/*
|
|
* setitimer: arm (or disarm) interval timer which (ITIMER_REAL,
|
|
* ITIMER_VIRTUAL or ITIMER_PROF), via SYS_setitimer. struct itimerval is
|
|
* layout-identical to the kernel's two-timeval structure on x86_64, so both
|
|
* pointers pass straight through: value NULL leaves the timer unchanged,
|
|
* it_value zero disarms it, and the previous setting is stored through
|
|
* ovalue when it is not NULL. An unknown which or an invalid pointer is
|
|
* rejected by the kernel (EINVAL / EFAULT), reported as -1 with errno set.
|
|
*/
|
|
int
|
|
setitimer(int which, const struct itimerval *restrict value, struct itimerval *restrict ovalue)
|
|
{
|
|
return syscall_ret(__syscall3(SYS_setitimer, which, (long)value, (long)ovalue));
|
|
}
|
|
|
|
#endif /* VLIBC_LEVEL_GE(2) */
|