UTIMES(2) BSD Programmer's Manual UTIMES(2)
utimes - set file access and modification times
utimes(const char *file, const struct timeval *times);
The utimes() function sets the access and modification times of the named
file from the structures in the argument array times.
The first structure is the access time, and the second is the modifica-
If the times are specified (the times argument is non-NULL) the caller
must be the owner of the file or be the super-user.
If the times are not specified (the times argument is NULL) the caller
must be the owner of the file, have permission to write the file, or be
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
Utimes() will fail if:
[EACCES] Search permission is denied for a component of the path
prefix; or the times argument is NULL and the effective us-
er ID of the process does not match the owner of the file,
and is not the super-user, and write access is denied.
[EFAULT] File or times points outside the process's allocated ad-
[EINVAL] The pathname contains a character with the high-order bit
[EIO] An I/O error occurred while reading or writing the affected
[ELOOP] Too many symbolic links were encountered in translating the
A component of a pathname exceeded 255 characters, or an
entire path name exceeded 1023 characters.
[ENOENT] The named file does not exist.
[ENOTDIR] A component of the path prefix is not a directory.
[EPERM] The times argument is not NULL and the calling process's
effective user ID does not match the owner of the file and
is not the super-user.
[EROFS] The file system containing the file is mounted read-only.
The utimes function call appeared in 4.2BSD.
4th Berkeley Distribution June 4, 1993 2