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