1 .\" $NetBSD: utimes.2,v 1.40 2013/10/05 21:24:36 ast Exp $
3 .\" Copyright (c) 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
32 .Dd September 14, 2013
43 .Nd set file access and modification times
49 .Fn utimes "const char *path" "const struct timeval times[2]"
51 .Fn lutimes "const char *path" "const struct timeval times[2]"
53 .Fn futimes "int fd" "const struct timeval times[2]"
56 .Fn utimens "const char *path" "const struct timespec times[2]"
58 .Fn lutimens "const char *path" "const struct timespec times[2]"
60 .Fn futimens "int fd" "const struct timespec times[2]"
64 .Fn utimensat "int fd" "const char *path" "const struct timespec times[2]" \
67 The access and modification times of the file named by
71 are changed as specified by the argument
78 the access and modification times are set to the current time.
79 The caller must be the owner of the file, have permission to
80 write the file, or be the super-user.
86 it is assumed to point to an array of two timeval structures.
87 The access time is set to the value of the first element, and the
88 modification time is set to the value of the second element.
89 For file systems that support file birth (creation) times (such as
90 UFS2), the birth time will be set to the value of the second element
91 if the second element is older than the currently set birth time.
92 To set both a birth time and a modification time, two calls are
93 required; the first to set the birth time and the second to set
94 the (presumably newer) modification time.
95 Ideally a new system call will be added that allows the setting of
96 all three times at once.
97 The caller must be the owner of the file or be the super-user.
99 In either case, the inode-change-time of the file is set to the current
105 except in the case where the named file is a symbolic link,
108 changes the access and modification times of the link,
111 changes the times of the file the link references.
122 respectively except that time is specified with nanosecond instead of
123 microsecond precision.
126 works the same way as
131 In that case, it is looked up from a directory whose file
132 descriptor was passed as
134 Search permission is required on this directory.
135 .\" (These alternatives await a decision about the semantics of O_SEARCH)
136 .\" Search permission is required on this directory
139 .\" was opened with the
143 .\" This file descriptor must have been opened with the
149 in order to specify the current directory.
151 When it operates on a symbolic link,
153 will change the target's time unless
154 .Dv AT_SYMLINK_NOFOLLOW
157 In that later case, the symbolic link's dates are changed.
159 The nanosecond fields for
165 can be set to the special value
167 to set the current time, or to
169 to let the time unchanged (this allows changing access time but not
170 modification time, and vice-versa).
172 .Rv -std utimes lutimes futimes utimens lutimens futimens utimensat
183 Search permission is denied for a component of the path prefix;
188 and the effective user ID of the process does not
189 match the owner of the file, and is not the super-user, and write
195 points outside the process's allocated address space.
197 An I/O error occurred while reading or writing the affected inode.
199 Too many symbolic links were encountered in translating the pathname.
200 .It Bq Er ENAMETOOLONG
201 A component of a pathname exceeded
203 characters, or an entire path name exceeded
207 The named file does not exist.
209 A component of the path prefix is not a directory.
215 and the calling process's effective user ID
216 does not match the owner of the file and is not the super-user.
218 The file system containing the file is mounted read-only.
227 does not specify an absolute path and
231 nor a valid file descriptor open for reading or searching.
234 is not an absolute path and
236 is a file descriptor associated with a non-directory file.
249 and the effective user ID of the process does not
250 match the owner of the file, and is not the super-user, and write
254 does not refer to a valid descriptor.
257 points outside the process's allocated address space.
259 An I/O error occurred while reading or writing the affected inode.
265 and the calling process's effective user ID
266 does not match the owner of the file and is not the super-user.
268 The file system containing the file is mounted read-only.
279 It was however marked as legacy in the
290 function call appeared in
294 function call appeared in
298 function call appeared in
300 Birthtime setting support was added in
305 functions calls appeared in