minix/lib/libc/sys-minix/futimes.c
Antoine Leca 9131e98a7d utimens(2) system call
Variant of utime(2) with struct timespec (with ns precision)
instead of time_t values; also allows for tv_nsec members
the values UTIME_NOW (force update to current time) or
UTIME_OMIT (allow to set either atim or mtim independently.)

Provides a superset of utimes(2), futimes(2), lutimes(2),
and futimens(2).
Provides the same subset of utimensat(2) as does NetBSD 6.
Also import utimens() and lutimeNS() from NetBSD-current.
2013-04-12 18:55:39 +00:00

31 lines
543 B
C

#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <sys/stat.h>
#include <sys/time.h>
#ifdef __weak_alias
__weak_alias(futimes, __futimes50)
#endif
int futimes(int fd, const struct timeval tv[2])
{
message m;
m.m2_i1 = fd;
if (tv == NULL) {
m.m2_l1 = m.m2_l2 = 0;
m.m2_i2 = m.m2_i3 = UTIME_NOW;
}
else {
m.m2_l1 = tv[0].tv_sec;
m.m2_l2 = tv[1].tv_sec;
m.m2_i2 = tv[0].tv_usec * 1000;
m.m2_i3 = tv[1].tv_usec * 1000;
}
m.m2_p1 = NULL;
m.m2_s1 = 0;
return(_syscall(VFS_PROC_NR, UTIMENS, &m));
}