make it possible to compile new versions of db that load against
[unix-history] / usr / src / lib / libc / sys / utimes.2
CommitLineData
15715acc
KB
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
14d9e8bc 3.\"
931b8415 4.\" %sccs.include.redist.man%
14d9e8bc 5.\"
15715acc 6.\" @(#)utimes.2 8.1 (Berkeley) %G%
931b8415
CL
7.\"
8.Dd
9.Dt UTIMES 2
10.Os BSD 4
11.Sh NAME
12.Nm utimes
13.Nd set file access and modification times
14.Sh SYNOPSIS
15.Fd #include <sys/time.h>
16.Ft int
17.Fn utimes "const char *file" "const struct timeval *times"
18.Sh DESCRIPTION
14d9e8bc 19The
931b8415
CL
20.Fn utimes
21function sets the access and modification times of the named file from
22the structures in the argument array
23.Fa times .
24.Pp
25The first structure is the access time, and the second is the modification
26time.
27.Pp
28If the times are specified (the
29.Fa times
30argument is
9ba080b9
CL
31.Pf non- Dv NULL )
32the caller must be the owner of the file or be the super-user.
931b8415
CL
33.Pp
34If the times are not specified (the
35.Fa times
36argument is
37.Dv NULL )
38the caller must be the owner of the file, have permission to
39write the file, or be the super-user.
40.Sh RETURN VALUES
481ecf6a 41Upon successful completion, a value of 0 is returned.
931b8415
CL
42Otherwise, a value of -1 is returned and
43.Va errno
481ecf6a 44is set to indicate the error.
931b8415
CL
45.Sh ERRORS
46.Fn Utimes
47will fail if:
48.Bl -tag -width Er
49.It Bq Er EACCES
50Search permission is denied for a component of the path prefix;
51or the
52.Fa times
53argument is
54.Dv NULL
55and the effective user ID of the process does not
56match the owner of the file, and is not the super-user, and write
57access is denied.
58.It Bq Er EFAULT
59.Xr File
60or
61.Fa times
62points outside the process's allocated address space.
63.It Bq Er EINVAL
b5984ffe 64The pathname contains a character with the high-order bit set.
931b8415
CL
65.It Bq Er EIO
66An I/O error occurred while reading or writing the affected inode.
67.It Bq Er ELOOP
68Too many symbolic links were encountered in translating the pathname.
69.It Bq Er ENAMETOOLONG
b5984ffe
KM
70A component of a pathname exceeded 255 characters,
71or an entire path name exceeded 1023 characters.
931b8415 72.It Bq Er ENOENT
481ecf6a 73The named file does not exist.
931b8415
CL
74.It Bq Er ENOTDIR
75A component of the path prefix is not a directory.
76.It Bq Er EPERM
77The
78.Fa times
79argument is not
80.Dv NULL
81and the calling process's effective user ID
82does not match the owner of the file and is not the super-user.
83.It Bq Er EROFS
481ecf6a 84The file system containing the file is mounted read-only.
931b8415
CL
85.El
86.Sh SEE ALSO
87.Xr stat 2
88.Sh HISTORY
89The
eb5956c3 90.Nm utimes
931b8415
CL
91function call appeared in
92.Bx 4.2 .