utimes(3) (BSD Compatibility Package) utimes(3)
NAME
utimes - set file times
SYNOPSIS
/usr/ucb/cc [flag ...] file ... -lucb
#include <sys/time.h>
int utimes(const char *path, const struct timeval times[2]);
DESCRIPTION
The utimes() function sets the access and modification times of the
file pointed to by the path argument to the value of the times argu-
ment. The utimes() function allows time specifications accurate to the
microsecond.
For utimes(), the times argument is an array of timeval structures.
The first array member represents the date and time of last access,
and the second member represents the date and time of last modifica-
tion. The times in the timeval structure are measured in seconds and
microseconds since the Epoch, although rounding toward the nearest
second may occur.
If the times argument is a null pointer, the access and modification
times of the file are set to the current time. The effective user ID
of the process must be the same as the owner of the file, or must have
write access to the file or appropriate privileges to use this call in
this manner. Upon completion, utimes() will mark the time of the last
file status change, stctime, for update.
In either case, the inode-changed time of the file is set to the
current time.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
DIAGNOSTICS
utimes fails if one or more of the following is true:
EACCES Search permission is denied for a component of the path
prefix of path.
EACCES The effective user ID of the process is not privileged
user and not the owner of the file, write permission is
denied for the file, and times is NULL.
ENOTDIR A component of the path prefix of path is not a direc-
tory.
ENAMETOOLONG The length of the path argument exceeds PATHMAX or the
length of a path component exceeds NAMEMAX.
Page 1 Reliant UNIX 5.44 Printed 11/98
utimes(3) (BSD Compatibility Package) utimes(3)
ENOENT The file referred to by path does not exist.
ELOOP Too many symbolic links were encountered in translating
path.
EPERM The times argument is not a null pointer and the calling
process' effective user ID has write access to the file
but does not match the owner of the file and the calling
process does not have the appropriate privileges.
EIO An I/O error occurred while reading from or writing to
the file system.
EROFS The file system containing the file is mounted read-
only.
EFAULT path or times points outside the process' allocated
address space.
The utimes() function may fail if:
ENAMETOOLONG Pathname resolution of a symbolic link produced an
intermediate result whose length exceeds PATHMAX.
NOTES
utimes is a library routine that calls the utime system call.
SEE ALSO
stat(2), utime(2), systime(5).
Page 2 Reliant UNIX 5.44 Printed 11/98