11 /* Implement a very large but not complete subset of the utimensat()
12 * Posix:2008/XOpen-7 function.
13 * Are handled the following cases:
14 * . utimensat(AT_FDCWD, "/some/absolute/path", , )
15 * . utimensat(AT_FDCWD, "some/path", , )
16 * . utimensat(fd, "/some/absolute/path", , ) although fd is useless here
17 * Are not handled the following cases:
18 * . utimensat(fd, "some/path", , ) path to a file relative to some open fd
20 int utimensat(int fd
, const char *name
, const struct timespec tv
[2],
24 static const struct timespec now
[2] = { {0, UTIME_NOW
}, {0, UTIME_NOW
} };
26 if (tv
== NULL
) tv
= now
;
32 if (name
[0] == '\0') { /* POSIX requirement */
36 if (fd
!= AT_FDCWD
&& name
[0] != '/') { /* Not supported */
41 if ((unsigned)flags
> SHRT_MAX
) {
46 memset(&m
, 0, sizeof(m
));
47 m
.m_vfs_utimens
.len
= strlen(name
) + 1;
48 m
.m_vfs_utimens
.name
= __UNCONST(name
);
49 m
.m_vfs_utimens
.atime
= tv
[0].tv_sec
;
50 m
.m_vfs_utimens
.mtime
= tv
[1].tv_sec
;
51 m
.m_vfs_utimens
.ansec
= tv
[0].tv_nsec
;
52 m
.m_vfs_utimens
.mnsec
= tv
[1].tv_nsec
;
53 m
.m_vfs_utimens
.flags
= flags
;
55 return(_syscall(VFS_PROC_NR
, VFS_UTIMENS
, &m
));