1 .\" $NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
3 .\" Copyright (c) 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
5 .\" Copyright (c) 2012, Jilles Tjoelker
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
34 .Dd September 23, 2020
40 .Nd set file access and modification times
46 .Fn futimens "int fd" "const struct timespec times[2]"
50 .Fa "const char *path"
51 .Fa "const struct timespec times[2]"
55 The access and modification times of the file named by
59 are changed as specified by the argument
61 The inode-change-time of the file is set to the current time.
65 specifies a relative path,
66 it is relative to the current working directory if
70 and otherwise relative to the directory associated with the file descriptor
78 can be set to the special value
80 to set the current time, or to
82 to leave the time unchanged.
91 it is assumed to point to an array of two timespec structures.
92 The access time is set to the value of the first element, and the
93 modification time is set to the value of the second element.
94 For file systems that support file birth (creation) times (such as
96 the birth time will be set to the value of the second element
97 if the second element is older than the currently set birth time.
98 To set both a birth time and a modification time,
99 two calls are required; the first to set the birth time
100 and the second to set the (presumably newer) modification time.
101 Ideally a new system call will be added that allows the setting
102 of all three times at once.
107 this is equivalent to passing
108 a pointer to an array of two timespec structures
118 the timestamps remain unchanged and
119 no permissions are needed for the file itself,
120 although search permissions may be required for the path prefix.
121 The call may or may not succeed if the named file does not exist.
127 the caller must be the owner of the file, have permission to
128 write the file, or be the super-user.
130 For all other values of the timestamps,
131 the caller must be the owner of the file or be the super-user.
138 are constructed by a bitwise-inclusive OR of flags from the following list,
141 .Bl -tag -width indent
142 .It Dv AT_SYMLINK_NOFOLLOW
145 names a symbolic link, the symbolic link's times are changed.
148 changes the times of the file referenced by the symbolic link.
150 Only allow to change the times of a file which is beneath of
151 the topping directory.
152 See the description of the
157 .It Dv AT_RESOLVE_BENEATH
158 Only walks paths below the topping directory.
159 See the description of the
160 .Dv O_RESOLVE_BENEATH
168 If the running kernel does not support this system call,
169 a wrapper emulates it using
174 As a result, timestamps will be rounded down to the nearest microsecond,
177 .Dv AT_SYMLINK_NOFOLLOW
178 is not available with a path relative to a file descriptor.
180 These system calls will fail if:
191 and the effective user ID of the process does not
192 match the owner of the file, and is not the super-user, and write
198 points outside the process's allocated address space.
202 component of at least one of the values specified by the
204 argument has a value less than 0 or greater than 999999999 and is not equal to
209 An I/O error occurred while reading or writing the affected inode.
211 Corrupted data was detected while reading from the file system.
225 and the calling process's effective user ID
226 does not match the owner of the file and is not the super-user.
228 The named file has its immutable or append-only flag set, see the
230 manual page for more information.
232 The file system containing the file is mounted read-only.
244 does not refer to a valid descriptor.
253 Search permission is denied for a component of the path prefix.
257 argument does not specify an absolute path and the
261 nor a valid file descriptor.
266 points outside the process's allocated address space.
268 Too many symbolic links were encountered in translating the pathname.
269 .It Bq Er ENAMETOOLONG
270 A component of a pathname exceeded
272 characters, or an entire path name exceeded
276 The named file does not exist.
278 A component of the path prefix is not a directory.
282 argument is not an absolute path and
286 nor a file descriptor associated with a directory.
287 .It Bq Er ENOTCAPABLE
290 or contained a ".." component leading to a
291 directory outside of the directory hierarchy specified by
293 and the process is in capability mode.
294 .It Bq Er ENOTCAPABLE
301 does not have its tail fully contained under the topping directory,
318 system calls are expected to conform to
325 system calls appeared in