xref: /minix3/minix/lib/libc/sys/futimens.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include <sys/cdefs.h>
2*433d6423SLionel Sambuc #include "namespace.h"
3*433d6423SLionel Sambuc #include <lib.h>
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #include <string.h>
6*433d6423SLionel Sambuc #include <sys/stat.h>
7*433d6423SLionel Sambuc 
futimens(int fd,const struct timespec tv[2])8*433d6423SLionel Sambuc int futimens(int fd, const struct timespec tv[2])
9*433d6423SLionel Sambuc {
10*433d6423SLionel Sambuc   message m;
11*433d6423SLionel Sambuc   static const struct timespec now[2] = { {0, UTIME_NOW}, {0, UTIME_NOW} };
12*433d6423SLionel Sambuc 
13*433d6423SLionel Sambuc   if (tv == NULL) tv = now;
14*433d6423SLionel Sambuc 
15*433d6423SLionel Sambuc   memset(&m, 0, sizeof(m));
16*433d6423SLionel Sambuc   m.m_vfs_utimens.fd = fd;
17*433d6423SLionel Sambuc   m.m_vfs_utimens.atime = tv[0].tv_sec;
18*433d6423SLionel Sambuc   m.m_vfs_utimens.mtime = tv[1].tv_sec;
19*433d6423SLionel Sambuc   m.m_vfs_utimens.ansec = tv[0].tv_nsec;
20*433d6423SLionel Sambuc   m.m_vfs_utimens.mnsec = tv[1].tv_nsec;
21*433d6423SLionel Sambuc   m.m_vfs_utimens.name = NULL;
22*433d6423SLionel Sambuc   m.m_vfs_utimens.flags = 0;
23*433d6423SLionel Sambuc 
24*433d6423SLionel Sambuc   return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
25*433d6423SLionel Sambuc }
26