xref: /csrg-svn/lib/libc/sys/utimes.2 (revision 47208)
1*47208Scael.\" Copyright (c) 1990 The Regents of the University of California.
2*47208Scael.\" All rights reserved.
320147Smckusick.\"
4*47208Scael.\" %sccs.include.redist.man%
520147Smckusick.\"
6*47208Scael.\"     @(#)utimes.2	6.6 (Berkeley) 03/10/91
7*47208Scael.\"
8*47208Scael.Dd
9*47208Scael.Dt UTIMES 2
10*47208Scael.Os BSD 4
11*47208Scael.Sh NAME
12*47208Scael.Nm utimes
13*47208Scael.Nd set file access and modification times
14*47208Scael.Sh SYNOPSIS
15*47208Scael.Fd #include <sys/time.h>
16*47208Scael.Ft int
17*47208Scael.Fn utimes "const char *file" "const struct timeval *times"
18*47208Scael.Sh DESCRIPTION
1920147SmckusickThe
20*47208Scael.Fn utimes
21*47208Scaelfunction sets the access and modification times of the named file from
22*47208Scaelthe structures in the argument array
23*47208Scael.Fa times .
24*47208Scael.Pp
25*47208ScaelThe first structure is the access time, and the second is the modification
26*47208Scaeltime.
27*47208Scael.Pp
28*47208ScaelIf the times are specified (the
29*47208Scael.Fa times
30*47208Scaelargument is
31*47208Scael.No non- Ns Dv NULL )
32*47208Scaelthe caller must be the owner of the file or be the superuser.
33*47208Scael.Pp
34*47208ScaelIf the times are not specified (the
35*47208Scael.Fa times
36*47208Scaelargument is
37*47208Scael.Dv NULL )
38*47208Scaelthe caller must be the owner of the file, have permission to
39*47208Scaelwrite the file, or be the super-user.
40*47208Scael.Sh RETURN VALUES
4120148SmckusickUpon successful completion, a value of 0 is returned.
42*47208ScaelOtherwise, a value of -1 is returned and
43*47208Scael.Va errno
4420148Smckusickis set to indicate the error.
45*47208Scael.Sh ERRORS
46*47208Scael.Fn Utimes
47*47208Scaelwill fail if:
48*47208Scael.Bl -tag -width Er
49*47208Scael.It Bq Er EACCES
50*47208ScaelSearch permission is denied for a component of the path prefix;
51*47208Scaelor the
52*47208Scael.Fa times
53*47208Scaelargument is
54*47208Scael.Dv NULL
55*47208Scaeland the effective user ID of the process does not
56*47208Scaelmatch the owner of the file, and is not the super-user, and write
57*47208Scaelaccess is denied.
58*47208Scael.It Bq Er EFAULT
59*47208Scael.Xr File
60*47208Scaelor
61*47208Scael.Fa times
62*47208Scaelpoints outside the process's allocated address space.
63*47208Scael.It Bq Er EINVAL
6421004SmckusickThe pathname contains a character with the high-order bit set.
65*47208Scael.It Bq Er EIO
66*47208ScaelAn I/O error occurred while reading or writing the affected inode.
67*47208Scael.It Bq Er ELOOP
68*47208ScaelToo many symbolic links were encountered in translating the pathname.
69*47208Scael.It Bq Er ENAMETOOLONG
7021004SmckusickA component of a pathname exceeded 255 characters,
7121004Smckusickor an entire path name exceeded 1023 characters.
72*47208Scael.It Bq Er ENOENT
7320148SmckusickThe named file does not exist.
74*47208Scael.It Bq Er ENOTDIR
75*47208ScaelA component of the path prefix is not a directory.
76*47208Scael.It Bq Er EPERM
77*47208ScaelThe
78*47208Scael.Fa times
79*47208Scaelargument is not
80*47208Scael.Dv NULL
81*47208Scaeland the calling process's effective user ID
82*47208Scaeldoes not match the owner of the file and is not the super-user.
83*47208Scael.It Bq Er EROFS
8420148SmckusickThe file system containing the file is mounted read-only.
85*47208Scael.El
86*47208Scael.Sh SEE ALSO
87*47208Scael.Xr stat 2
88*47208Scael.Sh HISTORY
89*47208ScaelThe
90*47208Scael.Nm
91*47208Scaelfunction call appeared in
92*47208Scael.Bx 4.2 .
93