xref: /original-bsd/lib/libc/sys/utimes.2 (revision 30ae0772)
Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

@(#)utimes.2 6.2 (Berkeley) 05/22/85

UTIMES 2 ""
C 4
NAME
utimes - set file times
SYNOPSIS
#include <sys/time.h>

utimes(file, tvp) char *file; struct timeval tvp[2];

DESCRIPTION
The utimes call uses the \*(lqaccessed\*(rq and \*(lqupdated\*(rq times in that order from the tvp vector to set the corresponding recorded times for file.

The caller must be the owner of the file or the super-user. The \*(lqinode-changed\*(rq 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.
"ERRORS
Utime will fail if one or more of the following are true:

15 [ENOTDIR] A component of the path prefix is not a directory.

15 [EINVAL] The pathname contains a character with the high-order bit set.

15 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.

15 [ENOENT] The named file does not exist.

15 [ELOOP] Too many symbolic links were encountered in translating the pathname.

15 [EPERM] The process is not super-user and not the owner of the file.

15 [EACCES] Search permission is denied for a component of the path prefix.

15 [EACCES] The effective user ID is not super-user and not the owner of the file and times is NULL and write access is denied.

15 [EROFS] The file system containing the file is mounted read-only.

15 [EFAULT] Tvp points outside the process's allocated address space.

SEE ALSO
stat(2)