NAME | SYNOPSIS | FEATURES | DESCRIPTION | PARAMETERS | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO
#include <sys/time.h>int utimes(const char *file, const struct timeval *times);
MSDOSFS, NFS_CLIENT, UFS
utimes() 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. The second is the modification time.
If the times are specified, that is, if the times parameter is not NULL, then the caller must be either the owner of the file or the superuser.
If the times are not specified, that is, if the times parameter is NULL, then the caller must either be the owner of the file, have permission to write to the file or be the superuser.
utimes() supports the following parameters:
Name of the file for which to set access and modification times.
Array of structures containing the access and modification times to set.
utimes() returns 0 on successful completion. Otherwise, utimes() returns -1 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 parameter is NULL and the effective user ID of the process does not match the owner of the file, and is not the superuser, and write access is denied.
EFAULT
file or times points outside the address space allocated to the process.
EIO
An I/O error occurred while reading or writing the affected inode.
ELOOP
Too many symbolic links were encountered in translating the pathname.
ENAMETOOLONG
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 parameter is not NULL and the effective user ID does not match the owner of the file and is not the superuser.
EROFS
The file system containing the file is mounted read-only.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | PARAMETERS | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO