1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1995-06-10 by Andries Brouwer <aeb@cwi.nl>
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Modified 2004-10-10 by Andries Brouwer <aeb@cwi.nl>
31 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
32 .\" all rights reserved.
33 .\" Translated Thu Jun 26 21:28:00 JST 1997
34 .\" by SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
35 .\" Updated & Modified Tue Feb 15 03:21:17 JST 2005
36 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
37 .\" Updated 2006-07-21, Akihiro MOTOKI, LDP v2.36
38 .\" Updated 2007-10-13, Akihiro MOTOKI, LDP v2.65
39 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
41 .TH UTIME 2 2008-08-06 "Linux" "Linux Programmer's Manual"
44 .\"O utime, utimes \- change file last access and modification times
45 utime, utimes \- ¥Õ¥¡¥¤¥ë¤ÎºÇ½ª¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤òÊѹ¹¤¹¤ë
49 .B #include <sys/types.h>
53 .BI "int utime(const char *" filename ", const struct utimbuf *" times );
55 .B #include <sys/time.h>
57 .BI "int utimes(const char *" filename ", const struct timeval " times [2]);
64 .\"O changes the access and modification times of the inode specified by
67 .\"O .IR actime " and " modtime
74 ¤Ç¼¨¤µ¤ì¤ë inode ¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤ò
77 .IR actime " ¤È " modtime
82 .\"O is NULL, then the access and modification times of the file are set
83 .\"O to the current time.
87 ¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤Ï¸½ºß¤Î»þ¹ï¤ËÀßÄꤵ¤ì¤ë¡£
89 .\"O Changing timestamps is permitted when: either
90 .\"O the process has appropriate privileges,
91 .\"O or the effective user ID equals the user ID
94 .\"O is NULL and the process has write permission for the file.
95 ¥¿¥¤¥à¥¹¥¿¥ó¥×¤ÎÊѹ¹¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Î¾ì¹ç¤Ëµö²Ä¤µ¤ì¤ë¡£
96 ¥×¥í¥»¥¹¤ËŬÀÚ¤ÊÆø¢¤¬¤¢¤ë¾ì¹ç¡¢
97 ¼Â¸ú (effective) ¥æ¡¼¥¶ ID ¤¬¥Õ¥¡¥¤¥ë¤Î¥æ¡¼¥¶ ID ¤ÈÅù¤·¤¤¾ì¹ç¡¢
99 ¤¬ NULL ¤«¤Ä¡¢¥×¥í¥»¥¹¤¬¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤¹þ¤ßµö²Ä¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¡£
106 ¤Ï°Ê²¼¤Ë¼¨¤¹¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
111 .\"O time_t actime; /* access time */
112 .\"O time_t modtime; /* modification time */
113 time_t actime; /* ¥¢¥¯¥»¥¹»þ¹ï */
114 time_t modtime; /* ½¤Àµ»þ¹ï */
122 .\"O allows specification of timestamps with a resolution of 1 second.
124 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï 1 ÉäÎʬ²òǽ¤Ç¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
129 .\"O is similar, but the
131 .\"O argument refers to an array rather than a structure.
132 .\"O The elements of this array are
134 .\"O structures, which allow a precision of 1 microsecond for specifying timestamps.
140 °ú¤¿ô¤¬¹½Â¤ÂΤǤϤʤ¯ÇÛÎó¤ò»²¾È¤¹¤ë¡£
143 ¹½Â¤ÂΤǡ¢¥¿¥¤¥à¥¹¥¿¥ó¥×¤Î»ØÄê¤ò 1 ¥Þ¥¤¥¯¥íÉäÎʬ²òǽ¤Ç¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£
149 ¤Ï°Ê²¼¤Ë¼¨¤¹Ä̤ê¤Ç¤¢¤ë¡£
154 .\"O long tv_sec; /* seconds */
155 long tv_sec; /* ÉÃ */
156 .\"O long tv_usec; /* microseconds */
157 long tv_usec; /* ¥Þ¥¤¥¯¥íÉà */
163 .\"O specifies the new access time, and
165 .\"O specifies the new modification time.
167 ¤Ï¿·¤·¤¤¥¢¥¯¥»¥¹»þ¹ï¤ò¡¢
169 ¤Ï¿·¤·¤¤½¤Àµ»þ¹ï¤òµ¬Äꤹ¤ë¡£
172 .\"O is NULL, then analogously to
174 .\"O the access and modification times of the file are
175 .\"O set to the current time.
179 ƱÍÍ¡¢¥Õ¥¡¥¤¥ë¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤Ï¸½ºß¤Î»þ¹ï¤ËÀßÄꤵ¤ì¤ë¡£
180 .\"O .SH "RETURN VALUE"
182 .\"O On success, zero is returned.
183 .\"O On error, \-1 is returned, and
185 .\"O is set appropriately.
186 À®¸ù¤·¤¿¾ì¹ç 0 ¤¬Ê֤롣¼ºÇÔ¤·¤¿¾ì¹ç \-1 ¤¬Ê֤ꡢ
188 ¤¬¥¨¥é¡¼¤ÎÆâÍƤ˽¾¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£
193 .\"O Search permission is denied for one of the directories in
194 .\"O the path prefix of
197 .\"O .BR path_resolution (7)).
199 ¤ò¹½À®¤¹¤ë²¿¤ì¤«¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¸¡º÷µö²Ä¤¬¤Ê¤¤
200 .RB ( path_resolution (7)
206 .\"O the caller's effective user ID does not match the owner of the file,
207 .\"O the caller does not have write access to the file,
208 .\"O and the caller is not privileged
209 .\"O (Linux: does not have either the
210 .\"O .B CAP_DAC_OVERRIDE
216 ¤Þ¤¿¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥Õ¥¡¥¤¥ë¤Î½êͼԤȰìÃפ·¤Ê¤¤¡£
217 ¤Þ¤¿¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤¬¤½¤Î¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤¹þ¤ßµö²Ä¤ò»ý¤¿¤º¡¢
218 Æø¢¤â»ý¤Ã¤Æ¤¤¤Ê¤¤ (Linux ¤Î¾ì¹ç¡¢¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
222 ¤â»ý¤Ã¤Æ¤¤¤Ê¤¤)¡£¤Þ¤¿¤Ï¡¢
233 .\"O the caller's effective UID does not match the owner of the file,
234 .\"O and the caller is not privileged
235 .\"O (Linux: does not have the
239 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä¸Æ¤Ó½Ð¤·¸µ¤Î¼Â¸ú UID ¤¬¥Õ¥¡¥¤¥ë¤Î½êͼԤȰìÃפ»¤º¡¢
240 ¤«¤Ä¸Æ¤Ó½Ð¤·¸µ¤¬Æø¢¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤
241 (Linux ¤Î¾ì¹ç¡¢¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
247 .\"O resides on a read-only file system.
249 ¤¬Æɤ߹þ¤ßÀìÍѤΥե¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ë¡£
250 .\"O .SH "CONFORMING TO"
254 .\"O POSIX.1-2008 marks
259 ¤òÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
262 4.3BSD, POSIX.1-2001.
265 .\"O Linux does not allow changing the timestamps on an immutable file,
266 .\"O or setting the timestamps to something other than the current time
267 .\"O on an append-only file.
268 Linux ¤Ç¤Ï¡¢ÉÔÊÑ (immutable) ¥Õ¥¡¥¤¥ë¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤òÊѹ¹¤·¤¿¤ê¡¢
269 ÄɲÃÀìÍÑ (append-only) ¤Î¥Õ¥¡¥¤¥ë¤Ë¸½ºß»þ¹ï°Ê³°¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò
270 ÀßÄꤷ¤¿¤ê¤¹¤ë¤³¤È¤Ï¡¢µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
272 .\"O In libc4 and libc5,
274 .\"O is just a wrapper for
276 .\"O and hence does not allow a subsecond resolution.
277 libc4 ¤È libc5 ¤Ç¤Ï¡¢
281 ¤Î¥é¥Ã¥Ñ¡¼ (wrapper) ¤Ç¤¢¤ë¡£
282 ¤½¤Î¤¿¤áÉðʲ¼¤ò»ØÄꤹ¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£