utimes(S-osr5)
utimes --
set file times
Syntax
cc . . . -lc
#include <sys/time.h>
int utimes(const char *file, struct timeval *tvp);
Description
The utimes function sets the access and modification times
of the file named by file.
If tvp is NULL, the access and modification
times are set to the current time. A process must be the owner of
the file or have write permission for the file to use
utimes in this manner.
If tvp is not NULL, it is assumed to point to an
array of two timeval structures. The access time is set to
the value of the first member, and the modification time is set to
the value of the second member. Only the owner of the file or the
privileged user may use utimes in this manner.
In either case, the ``inode-changed'' time of the file is set to the
current time.
Return values
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 will fail if one or more of the following are true:
[ENOTDIR]-
A component of the path prefix of file is not a directory.
[ENAMETOOLONG]-
The length of a component of file exceeds 255 characters,
or the length of file exceeds 1023 characters.
[ENOENT]-
The file referred to by file does not exist.
[EACCES]-
Search permission is denied for a component of the path prefix of
file.
[ELOOP]-
Too many symbolic links were encountered in translating
file.
[EPERM]-
The effective user ID of the process is not that of a
privileged user and not the owner of the file, and tvp is
not NULL.
[EACCES]-
The effective user ID of the process is not that of a
privileged user and not the owner of the file: write permission is
denied for the file, and tvp is NULL.
[EIO]-
An I/O error occurred while reading from or writing to the
filesystem.
[EROFS]-
The filesystem containing the file is mounted read-only.
[EFAULT]-
file or tvp points outside the process's
allocated address space.
Notes
utimes is a library routine that calls the utime
system call.
Files
/lib/libc.a-
linking library
See also
stat(S-osr5),
utime(S-osr5)
Standards conformance
utimes is conformant with:
X/Open Portability Guide Issue 4, Version 2 (Spec-1170).
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005