feat(systime): gettimeofday/itimer/utimes
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "../internal/syscall.h"
|
||||
|
||||
#if VLIBC_LEVEL_GE(2)
|
||||
|
||||
/*
|
||||
* settimeofday: set the kernel clock, via SYS_settimeofday.
|
||||
*
|
||||
* Requires privilege (the unprivileged caller gets EPERM from the kernel).
|
||||
* The tz argument is honored only alongside tv; passing a timezone record
|
||||
* while tv is NULL would ask the kernel to update its timezone state alone,
|
||||
* a legacy use no caller needs, so it is refused up front with ENOTSUP (the
|
||||
* Linux spelling of the value musl reports here; <errno.h> carries it as
|
||||
* EOPNOTSUPP).
|
||||
*/
|
||||
int
|
||||
settimeofday(const struct timeval *tv, const struct timezone *tz)
|
||||
{
|
||||
if (tz != NULL && tv == NULL)
|
||||
{
|
||||
errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
}
|
||||
return syscall_ret(__syscall2(SYS_settimeofday, (long)tv, (long)tz));
|
||||
}
|
||||
|
||||
#endif /* VLIBC_LEVEL_GE(2) */
|
||||
Reference in New Issue
Block a user