1 #include <sys/cdefs.h> 2 #include "namespace.h" 3 #include <lib.h> 4 5 #include <sys/stat.h> 6 #include <sys/time.h> 7 #include <fcntl.h> 8 #include <string.h> 9 #include <errno.h> 10 11 #ifdef __weak_alias __weak_alias(lutimes,__lutimes50)12__weak_alias(lutimes, __lutimes50) 13 #endif 14 15 int lutimes(const char *name, const struct timeval tv[2]) 16 { 17 message m; 18 19 if (name == NULL) { 20 errno = EINVAL; 21 return -1; 22 } 23 if (name[0] == '\0') { /* X/Open requirement */ 24 errno = ENOENT; 25 return -1; 26 } 27 memset(&m, 0, sizeof(m)); 28 m.m_vfs_utimens.len = strlen(name) + 1; 29 m.m_vfs_utimens.name = (char *) __UNCONST(name); 30 if (tv == NULL) { 31 m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0; 32 m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW; 33 } 34 else { 35 m.m_vfs_utimens.atime = tv[0].tv_sec; 36 m.m_vfs_utimens.mtime = tv[1].tv_sec; 37 m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000; 38 m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000; 39 } 40 m.m_vfs_utimens.flags = AT_SYMLINK_NOFOLLOW; 41 42 return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); 43 } 44