OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / utime.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
4 .\"
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.
8 .\"
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.
13 .\"
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
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
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>
30 .\"
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
40 .\"
41 .TH UTIME 2 2008-08-06 "Linux" "Linux Programmer's Manual"
42 .\"O .SH NAME
43 .SH Ì¾Á°
44 .\"O utime, utimes \- change file last access and modification times
45 utime, utimes \- ¥Õ¥¡¥¤¥ë¤ÎºÇ½ª¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤òÊѹ¹¤¹¤ë
46 .\"O .SH SYNOPSIS
47 .SH ½ñ¼°
48 .nf
49 .B #include <sys/types.h>
50 .br
51 .B #include <utime.h>
52 .sp
53 .BI "int utime(const char *" filename ", const struct utimbuf *" times );
54 .sp
55 .B #include <sys/time.h>
56 .sp
57 .BI "int utimes(const char *" filename ", const struct timeval " times [2]);
58 .fi
59 .\"O .SH DESCRIPTION
60 .SH ÀâÌÀ
61 .\"O The
62 .\"O .BR utime ()
63 .\"O system call
64 .\"O changes the access and modification times of the inode specified by
65 .\"O .I filename
66 .\"O to the
67 .\"O .IR actime " and " modtime
68 .\"O fields of
69 .\"O .I times
70 .\"O respectively.
71 .BR utime ()
72 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
73 .I filename
74 ¤Ç¼¨¤µ¤ì¤ë inode ¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤ò
75 .I times
76 Ãæ¤Î
77 .IR actime " ¤È " modtime
78 ¤Ë¤½¤ì¤¾¤ìÊѹ¹¤¹¤ë¡£
79
80 .\"O If
81 .\"O .I times
82 .\"O is NULL, then the access and modification times of the file are set
83 .\"O to the current time.
84 .I times
85 ¤¬
86 .B NULL
87 ¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤Ï¸½ºß¤Î»þ¹ï¤ËÀßÄꤵ¤ì¤ë¡£
88
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
92 .\"O of the file, or
93 .\"O .I times
94 .\"O is NULL and the process has write permission for the file.
95 ¥¿¥¤¥à¥¹¥¿¥ó¥×¤ÎÊѹ¹¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Î¾ì¹ç¤Ëµö²Ä¤µ¤ì¤ë¡£
96 ¥×¥í¥»¥¹¤ËŬÀÚ¤ÊÆø¢¤¬¤¢¤ë¾ì¹ç¡¢
97 ¼Â¸ú (effective) ¥æ¡¼¥¶ ID ¤¬¥Õ¥¡¥¤¥ë¤Î¥æ¡¼¥¶ ID ¤ÈÅù¤·¤¤¾ì¹ç¡¢
98 .I times
99 ¤¬ NULL ¤«¤Ä¡¢¥×¥í¥»¥¹¤¬¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤­¹þ¤ßµö²Ä¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¡£
100
101 .\"O The
102 .\"O .I utimbuf
103 .\"O structure is:
104 ¹½Â¤ÂÎ
105 .I utimbuf
106 ¤Ï°Ê²¼¤Ë¼¨¤¹¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
107
108 .in +4n
109 .nf
110 struct utimbuf {
111 .\"O     time_t actime;       /* access time */
112 .\"O     time_t modtime;      /* modification time */
113     time_t actime;       /* ¥¢¥¯¥»¥¹»þ¹ï */
114     time_t modtime;      /* ½¤Àµ»þ¹ï */
115 };
116 .fi
117 .in
118
119 .\"O The
120 .\"O .BR utime ()
121 .\"O system call
122 .\"O allows specification of timestamps with a resolution of 1 second.
123 .BR utime ()
124 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï 1 ÉäÎʬ²òǽ¤Ç¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
125
126 .\"O The
127 .\"O .BR utimes ()
128 .\"O system call
129 .\"O is similar, but the
130 .\"O .I times
131 .\"O argument refers to an array rather than a structure.
132 .\"O The elements of this array are
133 .\"O .I timeval
134 .\"O structures, which allow a precision of 1 microsecond for specifying timestamps.
135 .BR utimes ()
136 ¤Ï
137 .BR utime ()
138 ¤ÈƱÍͤǤ¢¤ë¤¬¡¢
139 .I times
140 °ú¤­¿ô¤¬¹½Â¤ÂΤǤϤʤ¯ÇÛÎó¤ò»²¾È¤¹¤ë¡£
141 ¤³¤ÎÇÛÎó¤ÎÍ×ÁǤÏ
142 .I timeval
143 ¹½Â¤ÂΤǡ¢¥¿¥¤¥à¥¹¥¿¥ó¥×¤Î»ØÄê¤ò 1 ¥Þ¥¤¥¯¥íÉäÎʬ²òǽ¤Ç¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
144 .\"O The
145 .\"O .I timeval
146 .\"O structure is:
147 ¹½Â¤ÂÎ
148 .I timeval
149 ¤Ï°Ê²¼¤Ë¼¨¤¹Ä̤ê¤Ç¤¢¤ë¡£
150
151 .in +4n
152 .nf
153 struct timeval {
154 .\"O     long tv_sec;        /* seconds */
155     long tv_sec;        /* Éà*/
156 .\"O     long tv_usec;       /* microseconds */
157     long tv_usec;       /* ¥Þ¥¤¥¯¥íÉà*/
158 };
159 .fi
160 .in
161 .PP
162 .\"O .IR times [0]
163 .\"O specifies the new access time, and
164 .\"O .IR times [1]
165 .\"O specifies the new modification time.
166 .IR times [0]
167 ¤Ï¿·¤·¤¤¥¢¥¯¥»¥¹»þ¹ï¤ò¡¢
168 .IR times [1]
169 ¤Ï¿·¤·¤¤½¤Àµ»þ¹ï¤òµ¬Äꤹ¤ë¡£
170 .\"O If
171 .\"O .I times
172 .\"O is NULL, then analogously to
173 .\"O .BR utime (),
174 .\"O the access and modification times of the file are
175 .\"O set to the current time.
176 .I times
177 ¤¬ NULL ¤Î¾ì¹ç¡¢
178 .BR utime ()
179 ƱÍÍ¡¢¥Õ¥¡¥¤¥ë¤Î¥¢¥¯¥»¥¹»þ¹ï¤È½¤Àµ»þ¹ï¤Ï¸½ºß¤Î»þ¹ï¤ËÀßÄꤵ¤ì¤ë¡£
180 .\"O .SH "RETURN VALUE"
181 .SH ÊÖ¤êÃÍ
182 .\"O On success, zero is returned.
183 .\"O On error, \-1 is returned, and
184 .\"O .I errno
185 .\"O is set appropriately.
186 À®¸ù¤·¤¿¾ì¹ç 0 ¤¬Ê֤롣¼ºÇÔ¤·¤¿¾ì¹ç \-1 ¤¬Ê֤ꡢ
187 .I errno
188 ¤¬¥¨¥é¡¼¤ÎÆâÍƤ˽¾¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£
189 .\"O .SH ERRORS
190 .SH ¥¨¥é¡¼
191 .TP
192 .B EACCES
193 .\"O Search permission is denied for one of the directories in
194 .\"O the path prefix of
195 .\"O .I path
196 .\"O (see also
197 .\"O .BR path_resolution (7)).
198 .I path
199 ¤ò¹½À®¤¹¤ë²¿¤ì¤«¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¸¡º÷µö²Ä¤¬¤Ê¤¤
200 .RB ( path_resolution (7)
201 ¤â»²¾È¤¹¤ë¤³¤È)¡£
202 .TP
203 .B EACCES
204 .\"O .I times
205 .\"O is NULL,
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
211 .\"O or the
212 .\"O .B CAP_FOWNER
213 .\"O capability).
214 .I times
215 ¤¬ NULL ¤Ç¤¢¤ë¡£
216 ¤Þ¤¿¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤¬¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤È°ìÃפ·¤Ê¤¤¡£
217 ¤Þ¤¿¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤¬¤½¤Î¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤­¹þ¤ßµö²Ä¤ò»ý¤¿¤º¡¢
218 Æø¢¤â»ý¤Ã¤Æ¤¤¤Ê¤¤ (Linux ¤Î¾ì¹ç¡¢¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
219 .B CAP_DAC_OVERRIDE
220 ¤â
221 .B CAP_FOWNER
222 ¤â»ý¤Ã¤Æ¤¤¤Ê¤¤)¡£¤Þ¤¿¤Ï¡¢
223 .TP
224 .B ENOENT
225 .\"O .I filename
226 .\"O does not exist.
227 .I filename
228 ¤¬Â¸ºß¤·¤Ê¤¤¡£
229 .TP
230 .B EPERM
231 .\"O .I times
232 .\"O is not NULL,
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
236 .\"O .B CAP_FOWNER
237 .\"O capability).
238 .I times
239 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä¸Æ¤Ó½Ð¤·¸µ¤Î¼Â¸ú UID ¤¬¥Õ¥¡¥¤¥ë¤Î½êÍ­¼Ô¤È°ìÃפ»¤º¡¢
240 ¤«¤Ä¸Æ¤Ó½Ð¤·¸µ¤¬Æø¢¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤
241 (Linux ¤Î¾ì¹ç¡¢¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
242 .B CAP_FOWNER
243 ¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤)¡£
244 .TP
245 .B EROFS
246 .\"O .I path
247 .\"O resides on a read-only file system.
248 .I path
249 ¤¬Æɤ߹þ¤ßÀìÍѤΥե¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ë¡£
250 .\"O .SH "CONFORMING TO"
251 .SH ½àµò
252 .BR utime ():
253 SVr4, POSIX.1-2001.
254 .\"O POSIX.1-2008 marks
255 .\"O .BR utime ()
256 .\"O as obsolete.
257 POSIX.1-2008 ¤Ï
258 .BR utime ()
259 ¤òÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
260 .br
261 .BR utimes ():
262 4.3BSD, POSIX.1-2001.
263 .\"O .SH NOTES
264 .SH Ãí°Õ
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 ÀßÄꤷ¤¿¤ê¤¹¤ë¤³¤È¤Ï¡¢µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
271
272 .\"O In libc4 and libc5,
273 .\"O .BR utimes ()
274 .\"O is just a wrapper for
275 .\"O .BR utime ()
276 .\"O and hence does not allow a subsecond resolution.
277 libc4 ¤È libc5 ¤Ç¤Ï¡¢
278 .BR utimes ()
279 ¤Ïñ¤Ë
280 .BR utime ()
281 ¤Î¥é¥Ã¥Ñ¡¼ (wrapper) ¤Ç¤¢¤ë¡£
282 ¤½¤Î¤¿¤áÉðʲ¼¤ò»ØÄꤹ¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
283 .\"O .SH "SEE ALSO"
284 .SH ´ØÏ¢¹àÌÜ
285 .BR chattr (1),
286 .BR futimesat (2),
287 .BR stat (2),
288 .BR utimensat (2),
289 .BR futimes (3),
290 .BR futimens (3)