/* * The utime() system call is no longer invoked from libc. * The utime() function has been implemented in libc using * a call to utimensat(). The kernel code for utime() * should be expunged as soon as there is no longer a need * to run Solaris 10 and prior versions of libc on the system. */ int utime(char *fname, time_t *tptr) { time_t tv[2]; struct vattr vattr; int flags; if (tptr != NULL) { if (get_udatamodel() == DATAMODEL_NATIVE) { if (copyin(tptr, tv, sizeof (tv))) return (set_errno(EFAULT)); } else { time32_t tv32[2]; if (copyin(tptr, &tv32, sizeof (tv32))) return (set_errno(EFAULT)); tv[0] = (time_t)tv32[0]; tv[1] = (time_t)tv32[1]; } vattr.va_atime.tv_sec = tv[0]; vattr.va_atime.tv_nsec = 0; vattr.va_mtime.tv_sec = tv[1]; vattr.va_mtime.tv_nsec = 0; flags = ATTR_UTIME; } else { gethrestime(&vattr.va_atime); vattr.va_mtime = vattr.va_atime; flags = 0; } vattr.va_mask = AT_ATIME|AT_MTIME; return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); }
int futimens(int fd, timespec_t *tsptr) { struct vattr vattr; int flags; int error; if ((error = get_timespec_vattr(tsptr, &vattr, &flags)) != 0) return (set_errno(error)); return (cfutimesat(fd, NULL, 2, &vattr, flags, FOLLOW)); }
/* * The utimes() system call is no longer invoked from libc. * The utimes() function has been implemented in libc using * a call to utimensat(). The kernel code for utimes() * should be expunged as soon as there is no longer a need * to run Solaris 10 and prior versions of libc on the system. */ int utimes(char *fname, struct timeval *tvptr) { struct vattr vattr; int flags; int error; if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) return (set_errno(error)); return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); }
int utimensat(int fd, char *fname, timespec_t *tsptr, int flag) { struct vattr vattr; int flags; int error; if ((error = get_timespec_vattr(tsptr, &vattr, &flags)) != 0) return (set_errno(error)); return (cfutimesat(fd, fname, 1, &vattr, flags, (flag & AT_SYMLINK_NOFOLLOW)? NO_FOLLOW : FOLLOW)); }