UTIME(3) BSD Programmer's Manual UTIME(3)
NAME
utime - set file times
SYNOPSIS
#include <time.h>
#include <utime.h>
int
utime(const char *file, const struct utimbuf *timep)
DESCRIPTION
The utime() function sets the access and modification times of the named
file from the structure addressed by timep.
If timep is NULL, the file access and modification times are set to the
current time. The calling process's effective user ID must be the super-
user or must match the owner of the file, or the calling process must
have write permission for the file.
If timep is not NULL, the file's access and modification times are set to
the specified values. The calling process's effective user ID must match
the owner of the file or must be the super-user. The utimbuf structure
has the following form:
struct utimbuf {
time_t actime;
time_t modtime;
};
The access time of the file is taken from the actime member and the modi-
fication time is taken from the modtime member.
ERRORS
Utime() will fail if:
[EACCES] Search permission is denied for a component of the path
prefix; or the timep 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 timep points outside the process's allocated ad-
dress space.
[EINVAL] The pathname contains a character with the high-order bit
set.
[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 timep 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.
SEE ALSO
utimes(2), stat(2)
STANDARDS
The utime function conforms to IEEE Std1003.1-1990 (``POSIX'').
BSDI BSD/386 March 26, 1993 2