2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
5 .\" Parts Copyright (c) 1995 Nicolai Langfeldt (janl@ifi.uio.no), 1/1/95
6 .\" and Copyright (c) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
8 .\" Permission is granted to make and distribute verbatim copies of this
9 .\" manual provided the copyright notice and this permission notice are
10 .\" preserved on all copies.
12 .\" Permission is granted to copy and distribute modified versions of this
13 .\" manual under the conditions for verbatim copying, provided that the
14 .\" entire resulting derived work is distributed under the terms of a
15 .\" permission notice identical to this one.
17 .\" Since the Linux kernel and libraries are constantly changing, this
18 .\" manual page may be incorrect or out-of-date. The author(s) assume no
19 .\" responsibility for errors or omissions, or for damages resulting from
20 .\" the use of the information contained herein. The author(s) may not
21 .\" have taken the same level of care in the production of this manual,
22 .\" which is licensed free of charge, as they might when working
25 .\" Formatted or processed versions of this manual, if unaccompanied by
26 .\" the source, must acknowledge the copyright and authors of this work.
28 .\" Modified by Michael Haardt <michael@moria.de>
29 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
30 .\" Modified 1995-05-18 by Todd Larason <jtl@molehill.org>
31 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
32 .\" Modified 1995-01-09 by Richard Kettlewell <richard@greenend.org.uk>
33 .\" Modified 1998-05-13 by Michael Haardt <michael@cantor.informatik.rwth-aachen.de>
34 .\" Modified 1999-07-06 by aeb & Albert Cahalan
35 .\" Modified 2000-01-07 by aeb
36 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" 2007-06-08 mtk: Added example program
38 .\" 2007-07-05 mtk: Added details on underlying system call interfaces
40 .\" Japanese Version Copyright (c) 1998-1999 HANATAKA Shinya
41 .\" and Copyright (c) 2005-2008 Akihiro MOTOKI
43 .\" Translated 1998-06-21, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
44 .\" Modified 1999-04-16, HANATAKA Shinya
45 .\" Updated 2000-01-03, Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2000-10-06, Kentaro Shirakata
47 .\" Updated 2001-04-09, Kentaro Shirakata
48 .\" Updated 2001-06-25, Kentaro Shirakata
49 .\" Updated 2005-02-28, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
50 .\" Updated 2005-09-06, Akihiro MOTOKI
51 .\" Updated 2005-11-19, Akihiro MOTOKI, catch up to LDP v2.14
52 .\" Updated 2006-07-21, Akihiro MOTOKI, LDP v2.36
53 .\" Updated 2007-06-13, Akihiro MOTOKI, LDP v2.55
54 .\" Updated 2008-09-19, Akihiro MOTOKI, LDP v3.08
57 .\"WORD: directory ¥Ç¥£¥ì¥¯¥È¥ê
58 .\"WORD: open ¥ª¡¼¥×¥ó
59 .\"WORD: implement ¼ÂÁõ
61 .\"WORD: group ¥°¥ë¡¼¥×
62 .\"WORD: user ¥æ¡¼¥¶¡¼
64 .\"WORD: hard link count ¥Ï¡¼¥É¡¦¥ê¥ó¥¯¿ô
65 .\"WORD: symbolic link ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯
66 .\"WORD: socket ¥½¥±¥Ã¥È
67 .\"WORD: device ¥Ç¥Ð¥¤¥¹
68 .\"WORD: sticky bit ¥¹¥Æ¥£¥Ã¥¡¼¡¦¥Ó¥Ã¥È
69 .\"WORD: mandatory locking ¶¯À©¥í¥Ã¥¯
71 .TH STAT 2 2010-12-03 "Linux" "Linux Programmer's Manual"
73 stat, fstat, lstat \- ¥Õ¥¡¥¤¥ë¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ë
75 .B #include <sys/types.h>
77 .B #include <sys/stat.h>
79 .B #include <unistd.h>
81 .BI "int stat(const char *" path ", struct stat *" buf );
83 .BI "int fstat(int " fd ", struct stat *" buf );
85 .BI "int lstat(const char *" path ", struct stat *" buf );
88 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
89 .RB ( feature_test_macros (7)
94 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
97 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤òÊÖ¤¹¡£
98 ¥Õ¥¡¥¤¥ë¤½¤Î¤â¤Î¤ËÂФ¹¤ë¥¢¥¯¥»¥¹µö²Ä¤ÏɬÍפȤ·¤Ê¤¤¤¬¡¢
107 ¤ò¹½À®¤¹¤ëÁ´¤Æ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ËÂФ¹¤ë¼Â¹Ô (¸¡º÷) µö²Ä¤¬É¬ÍפǤ¢¤ë¡£
112 ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¾õÂÖ¤ò¼èÆÀ¤·¤Æ
121 ¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¡¢¥ê¥ó¥¯¤¬»²¾È¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¯¡¢
122 ¥ê¥ó¥¯¼«¿È¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ëÅÀ¤¬°Û¤Ê¤ë¡£
128 ¾õÂÖ¤ò¼èÆÀ¤¹¤ë¥Õ¥¡¥¤¥ë¤ò¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿
132 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¤¤¤º¤ì¤â¡¢·ë²Ì¤ò
136 ¹½Â¤ÂΤˤϰʲ¼¤Î¥Õ¥£¡¼¥ë¥É¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë:
141 dev_t st_dev; /* ¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¥Ç¥Ð¥¤¥¹¤Î ID */
142 ino_t st_ino; /* inode ÈÖ¹æ */
143 mode_t st_mode; /* ¥¢¥¯¥»¥¹Êݸî */
144 nlink_t st_nlink; /* ¥Ï¡¼¥É¥ê¥ó¥¯¤Î¿ô */
145 uid_t st_uid; /* ½êͼԤΥ桼¥¶ ID */
146 gid_t st_gid; /* ½êͼԤΥ°¥ë¡¼¥× ID */
147 dev_t st_rdev; /* ¥Ç¥Ð¥¤¥¹ ID (Æüì¥Õ¥¡¥¤¥ë¤Î¾ì¹ç) */
148 off_t st_size; /* Á´ÂΤΥµ¥¤¥º (¥Ð¥¤¥Èñ°Ì) */
149 blksize_t st_blksize; /* ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à I/O ¤Ç¤Î
151 blkcnt_t st_blocks; /* ³ä¤êÅö¤Æ¤é¤ì¤¿ 512B ¤Î¥Ö¥í¥Ã¥¯¿ô */
152 time_t st_atime; /* ºÇ½ª¥¢¥¯¥»¥¹»þ¹ï */
153 time_t st_mtime; /* ºÇ½ª½¤Àµ»þ¹ï */
154 time_t st_ctime; /* ºÇ½ª¾õÂÖÊѹ¹»þ¹ï */
160 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¤³¤Î¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¥Ç¥Ð¥¤¥¹¤ò¼¨¤¹
164 ¤Ï¡¢¤³¤Î¥Õ¥£¡¼¥ë¥É¤Î¥Ç¥Ð¥¤¥¹ ID ¤òʬ²ò¤¹¤ë¤Î¤ËÌòΩ¤Ä¤À¤í¤¦)¡£
167 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¤³¤Î¥Õ¥¡¥¤¥ë (inode) ¤¬É½¤¹¥Ç¥Ð¥¤¥¹¤ò¼¨¤¹¡£
170 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢(Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤«¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¤Ë)
171 ¥Õ¥¡¥¤¥ë¤ÎÂ礤µ¤ò¥Ð¥¤¥Èñ°Ì¤Ç¼¨¤¹¡£
172 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ÎÂ礤µ¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë
173 ¥Ñ¥¹Ì¾¤ÎŤµ (ºÇ¸å¤Î NULL ¥Ð¥¤¥È¤Ï´Þ¤Þ¤Ê¤¤) ¤Ç¤¢¤ë¡£
176 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥Õ¥¡¥¤¥ë¤ÎÂ礤µ¤ò 512 ¥Ð¥¤¥È¤Î¥Ö¥í¥Ã¥¯¥µ¥¤¥ºÃ±°Ì¤Ç¼¨¤¹
177 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥Õ¥¡¥¤¥ë¤Ë³ä¤êÅö¤Æ¤µ¤ì¤¿¥Ö¥í¥Ã¥¯¿ô¤ò 512 ¥Ð¥¤¥Èñ°Ì¤Ç¼¨¤¹¡£
178 (¥Õ¥¡¥¤¥ë¤Ë·ê¤¬¤¢¤ë¤è¤¦¤Ê¾ì¹ç¡¢¤³¤ÎÃͤÏ
180 ¤è¤ê¾®¤µ¤¯¤Ê¤ë¤³¤È¤â¤¢¤ë)¡£
183 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¸úΨŪ¤Ë¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à I/O ¤¬¤Ç¤¤ë¡Ö¹¥¤Þ¤·¤¤¡×
184 ¥Ö¥í¥Ã¥¯¥µ¥¤¥º¤ò¼¨¤¹ (¤â¤Ã¤È¾®¤µ¤¤Ã±°Ì¤Ç¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤ß¤ò¹Ô¤¦¤È¡¢
185 Æɤ߽Ф·--½¤Àµ--ºÆ½ñ¤¹þ¤ß¤È¤¤¤Ã¤¿Èó¸úΨ¤ÊÆ°ºî¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¤â¤·¤ì¤Ê¤¤)¡£
187 Á´¤Æ¤Î Linux ¤Î¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬Á´¤Æ¤Î»þ´Ö¥Õ¥£¡¼¥ë¥É¤ò
188 ¼ÂÁõ¤·¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
189 ¥Õ¥¡¥¤¥ë¤ä¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¢¥¯¥»¥¹¤¬
191 ¥Õ¥£¡¼¥ë¥É¤ò¹¹¿·¤·¤Ê¤¤¤è¤¦¤Ê¤«¤¿¤Á¤Ç¥Þ¥¦¥ó¥È¤Ç¤¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤â¤¢¤ë¡£
199 ¤Î´ØÏ¢¤¹¤ë¾ðÊó¤ò»²¾È)¡£
202 ÉÕ¤¤Ç¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï
209 ¥Õ¥£¡¼¥ë¥É¤Ï¥Õ¥¡¥¤¥ë¥¢¥¯¥»¥¹¤¬¤¢¤Ã¤¿¾ì¹ç¤ËÊѹ¹¤µ¤ì¤ë
217 ¤Ç 1 ¥Ð¥¤¥È°Ê¾åÆɤ߹þ¤ó¤À¾ì¹ç¤Ê¤É)¡£
219 ¤Ê¤É¤Î¾¤Î¥ë¡¼¥Á¥ó¤Ç¤Ï¡¢
221 ¤Ï¹¹¿·¤µ¤ì¤ë¤³¤È¤â¤¢¤ì¤Ð¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤â¤¢¤ë¡£
224 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥Õ¥¡¥¤¥ë¤¬½¤Àµ¤µ¤ì¤¿¾ì¹ç¤ËÊѹ¹¤µ¤ì¤ë
231 ¤Ç 1 ¥Ð¥¤¥È°Ê¾å½ñ¤¹þ¤ß¤ò¤·¤¿¾ì¹ç¤Ê¤É)¡£
232 ¤µ¤é¤Ë¡¢¥Ç¥£¥ì¥¯¥È¥ê¤Î
234 ¤Ï¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ç
235 ¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤¿¤êºï½ü¤µ¤ì¤¿¤ê¤¹¤ë¤ÈÊѹ¹¤µ¤ì¤ë¡£
238 ½êͼԤ䥰¥ë¡¼¥×¤ä¥Ï¡¼¥É¡¦¥ê¥ó¥¯¿ô¤ä¥â¡¼¥É¤ÎÊѹ¹¤Ç¤ÏÊѹ¹
242 ¥Õ¥£¡¼¥ë¥É¤Ï½ñ¤¹þ¤ß¤ä inode ¾ðÊó
243 (½êͼԡ¢¥°¥ë¡¼¥×¡¢¥ê¥ó¥¯¿ô¡¢¥â¡¼¥É¤Ê¤É) ¤Î
244 ÀßÄê¤Ë¤è¤Ã¤ÆÊѹ¹¤µ¤ì¤ë¡£
246 °Ê²¼¤Î POSIX ¥Þ¥¯¥í¤Ï¡¢
249 ¤Ç»ÈÍѤµ¤ì¤ë¥Õ¥¡¥¤¥ë¼ïÊ̤ΥÁ¥§¥Ã¥¯¤Î¤¿¤á¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë :
259 ¥¥ã¥é¥¯¥¿¡¼¡¦¥Ç¥Ð¥¤¥¹¤«?
262 ¥Ö¥í¥Ã¥¯¡¦¥Ç¥Ð¥¤¥¹¤«?
265 FIFO (̾Á°ÉÕ¤¥Ñ¥¤¥×) ¤«?
268 ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤«? (POSIX.1-1996 ¤Ë¤Ï¤Ê¤¤)
271 ¥½¥±¥Ã¥È¤«? (POSIX.1-1996 ¤Ë¤Ï¤Ê¤¤)
276 ¥Õ¥£¡¼¥ë¥ÉÍѤËÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
280 S_IFMT 0170000 ¥Õ¥¡¥¤¥ë¼ïÊ̤ò¼¨¤¹¥Ó¥Ã¥ÈÎΰè¤òɽ¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯
281 S_IFSOCK 0140000 ¥½¥±¥Ã¥È
282 S_IFLNK 0120000 ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯
283 S_IFREG 0100000 Ä̾ï¤Î¥Õ¥¡¥¤¥ë
284 S_IFBLK 0060000 ¥Ö¥í¥Ã¥¯¡¦¥Ç¥Ð¥¤¥¹
285 S_IFDIR 0040000 ¥Ç¥£¥ì¥¯¥È¥ê
286 S_IFCHR 0020000 ¥¥ã¥é¥¯¥¿¡¼¡¦¥Ç¥Ð¥¤¥¹
288 S_ISUID 0004000 set-user-ID bit
289 S_ISGID 0002000 set-group-ID bit (²¼µ»²¾È)
290 S_ISVTX 0001000 ¥¹¥Æ¥£¥Ã¥¡¼¡¦¥Ó¥Ã¥È (²¼µ»²¾È)
291 S_IRWXU 00700 ¥Õ¥¡¥¤¥ë½êͼԤΥ¢¥¯¥»¥¹µö²ÄÍѤΥӥåȥޥ¹¥¯
292 S_IRUSR 00400 ½êͼԤÎÆɤ߹þ¤ßµö²Ä
293 S_IWUSR 00200 ½êͼԤνñ¤¹þ¤ßµö²Ä
294 S_IXUSR 00100 ½êͼԤμ¹Եö²Ä
295 S_IRWXG 00070 ¥°¥ë¡¼¥×¤Î¥¢¥¯¥»¥¹µö²ÄÍѤΥӥåȥޥ¹¥¯
296 S_IRGRP 00040 ¥°¥ë¡¼¥×¤ÎÆɤ߹þ¤ßµö²Ä
297 S_IWGRP 00020 ¥°¥ë¡¼¥×¤Î½ñ¤¹þ¤ßµö²Ä
298 S_IXGRP 00010 ¥°¥ë¡¼¥×¤Î¼Â¹Ôµö²Ä
299 S_IRWXO 00007 ¾¿Í (others) ¤Î¥¢¥¯¥»¥¹µö²ÄÍѤΥӥåȥޥ¹¥¯
300 S_IROTH 00004 ¾¿Í¤ÎÆɤ߹þ¤ßµö²Ä
301 S_IWOTH 00002 ¾¿Í¤Î½ñ¤¹þ¤ßµö²Ä
302 S_IXOTH 00001 ¾¿Í¤Î¼Â¹Ôµö²Ä
308 ¤Ë¤Ï¤¤¤¯¤Ä¤«¤ÎÆüì¤Ê»ÈÍÑË¡¤¬¤¢¤ë:
309 ¥Ç¥£¥ì¥¯¥È¥ê¤ËÀßÄꤷ¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤¬ BSD Êý¼°¤Ç»ÈÍѤµ¤ì¤ë
310 ¤³¤È¤ò¼¨¤¹¡£¤Ä¤Þ¤ê¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ËºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×ID ¤Ï
311 ºîÀ®¤·¤¿¥×¥í¥»¥¹¤Î¼Â¸ú (effective) ¥°¥ë¡¼¥×ID ¤Ç¤Ï¤Ê¤¯¡¢¥Ç¥£¥ì¥¯¥È¥ê¤Î
312 ¥°¥ë¡¼¥×ID ¤ò·Ñ¾µ¤¹¤ë¡£¤Þ¤¿¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ËºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤â
314 ¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤ë¡£¥°¥ë¡¼¥×¼Â¹Ô¥Ó¥Ã¥È
316 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥Õ¥¡¥¤¥ë¤ËÀßÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢
317 set-group-ID ¥Ó¥Ã¥È¤Ï¥Õ¥¡¥¤¥ë/¥ì¥³¡¼¥É¤Î
318 ¶¯À©Åª¤Ê (mandatory) ¥í¥Ã¥¯¤òɽ¤¹¡£
320 ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¹¥Æ¥£¥Ã¥¡¼¥Ó¥Ã¥È (S_ISVTX) ¤¬ÀßÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢
321 ¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Õ¥¡¥¤¥ë¤Î̾Á°¤òÊѹ¹¤·¤¿¤ê¡¢ºï½ü¤·¤¿¤ê¤Ç¤¤ë¤Î¤Ï¡¢
322 ¤½¤Î¥Õ¥¡¥¤¥ë¤Î½êͼԤ«¡¢¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î½êͼԤ«¡¢Æø¢¥×¥í¥»¥¹
325 À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
327 ¤ËŬÀÚ¤ÊÃͤ¬ÀßÄꤵ¤ì¤ë¡£
332 ¤¬½ê°¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤È¤½¤Î¾å°Ì¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤¤¤º¤ì¤«¤Ë
333 ÂФ¹¤ë¸¡º÷µö²Ä¤¬¤Ê¤«¤Ã¤¿
334 .RB ( path_resolution (7)
342 ¥¢¥É¥ì¥¹¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¡£
345 ¥Ñ¥¹¤òé¤ëºÝ¤Ë²ò·è¤¹¤Ù¤¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤¬Â¿²á¤®¤¿¡£
353 ¤Î¹½À®Í×ÁǤ¬Â¸ºß¤·¤Ê¤¤¤«¡¢
358 ¥«¡¼¥Í¥ë¤Î¥á¥â¥ê¤¬Â¤ê¤Ê¤¤¡£
362 ¤ÎÁ°È¾Éôʬ (prefix) ¤Î¹½À®Í×ÁǤ¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ï¤Ê¤¤¡£
369 ·¿¤Çɽ¸½¤Ç¤¤Ê¤¤¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
370 ¤³¤Î¥¨¥é¡¼¤¬µ¯¤³¤ë¤Î¤Ï¡¢32 ¥Ó¥Ã¥È¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¾å¤Ç
371 .I -D_FILE_OFFSET_BITS=64
372 ¤ò»ØÄꤻ¤º¤Ë¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¡¢¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬
374 ¥Ó¥Ã¥È¤òĶ¤¨¤ë¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ
376 ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¤Ç¤¢¤ë¡£
378 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï SVr4, 4.3BSD, POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
382 ¥³¡¼¥ë¤Ï SVr4, SVID, POSIX, X/OPEN, 4.3BSD ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
384 ¥³¡¼¥ë¤Ï 4.3BSD ¤È SVr4 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
387 .\" ¤Î¥¨¥é¡¼¤È¤·¤Æ EINTR, ENOLINK, EOVERFLOW ¤¬µºÜ¤µ¤ì¤Æ¤¤¤ë¡£
392 .\" ¤Î¥¨¥é¡¼¤È¤·¤Æ EINTR, EMULTIHOP, ENOLINK, EOVERFLOW ¤¬µºÜ¤µ¤ì¤Æ¤¤¤ë¡£
397 ¥Õ¥£¡¼¥ë¥É¤Î»ÈÍѤϤ¢¤Þ¤ê°Ü¿¢À¤¬¤Ê¤¤¡£
398 (¤³¤ì¤é¤Î¥Õ¥£¡¼¥ë¥É¤Ï BSD ¤Ë¤è¤Ã¤ÆƳÆþ¤µ¤ì¤¿¡£
399 ¥·¥¹¥Æ¥à¤´¤È¤Ë²ò¼á¤¬°Û¤Ê¤Ã¤Æ¤ª¤ê¡¢
400 NFS ¥Þ¥¦¥ó¥È¤Î¾ì¹ç¤Ë¤ÏƱ¤¸¥·¥¹¥Æ¥à¤Ç¤â°Û¤Ê¤ë²ÄǽÀ¤¬¤¢¤ë)
412 ¥Ó¥Ã¥È¤Ë¤Ä¤¤¤Æ¤Îµ½Ò¤Ï¤Ê¤¤¡£¤«¤ï¤ê¤Ë
414 ¤Î¤è¤¦¤Ê¥Þ¥¯¥í¤ò»ÈÍѤ¹¤ë¤è¤¦¤ËÍ׵ᤷ¤Æ¤¤¤ë¡£
419 ¤Ï POSIX.1-1996 ¤Ë¤Ï¤Ê¤¤¤¬¡¢
420 POSIX.1-2001 ¤Ë¤ÏξÊý¤È¤â¸ºß¤¹¤ë¡£
421 Á°¼Ô¤Ï SVID 4 ¤Ë¡¢¸å¼Ô¤Ï SUSv2 ¤ËͳÍ褷¤Æ¤¤¤ë¡£
423 Unix V7 (¤È¤½¤Î¸å¤Î¥·¥¹¥Æ¥à) ¤Ï
428 POSIX ¤Ï¤½¤ÎƱµÁ¸ì¤È¤·¤Æ
434 ³Æ¼ï¥·¥¹¥Æ¥à¤Ç»ÈÍѤµ¤ì¤Æ¤¤¤¿(¤¤¤ë)ÃÍ:
437 16¿Ê ̾Á° ls 8¿Ê¿ô ÀâÌÀ
438 f000 S_IFMT 170000 ¥Õ¥¡¥¤¥ë¼ïÊÌ¥Õ¥£¡¼¥ë¥É¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯
439 0000 000000 SCO ¤Ç¤Ï »ÈÍÑÉÔǽ inode;
440 BSD ¤Ç¤Ï̤ÃΤΥե¡¥¤¥ë¼ïÊÌ;
441 SVID-v2 ¤È XPG2 ¤Ç¤Ï 0 ¤È 0100000 ¤Î
443 1000 S_IFIFO p| 010000 FIFO (̾Á°ÉÕ¤¥Ñ¥¤¥×)
444 2000 S_IFCHR c 020000 ¥¥ã¥é¥¯¥¿Æüì¥Õ¥¡¥¤¥ë (V7)
445 3000 S_IFMPC 030000 ¿½Å²½¤µ¤ì¤¿¥¥ã¥é¥¯¥¿Æüì¥Õ¥¡¥¤¥ë (V7)
446 4000 S_IFDIR d/ 040000 ¥Ç¥£¥ì¥¯¥È¥ê (V7)
447 5000 S_IFNAM 050000 XENIX Æó¤Ä¤ÎÉû·¿¤ò»ý¤Ä̾Á°ÉÕ¤¤Î
449 Éû·¿¤Ï \fIst_rdev\fP ¤ÎÃÍ 1,2 ¤Ç¶èÊ̤µ¤ì¤ë:
450 0001 S_INSEM s 000001 XENIX IFNAM¤Î¥»¥Þ¥Õ¥©¡¼Éû·¿
451 0002 S_INSHD m 000002 XENIX IFNAM¤Î¶¦Í¥Ç¡¼¥¿Éû·¿
452 6000 S_IFBLK b 060000 ¥Ö¥í¥Ã¥¯Æüì¥Õ¥¡¥¤¥ë (V7)
453 7000 S_IFMPB 070000 ¿½Å²½¤µ¤ì¤¿¥Ö¥í¥Ã¥¯Æüì¥Õ¥¡¥¤¥ë (V7)
454 8000 S_IFREG - 100000 Ä̾ï¥Õ¥¡¥¤¥ë (V7)
455 9000 S_IFCMP 110000 VxFS °µ½Ì¥Õ¥¡¥¤¥ë
456 9000 S_IFNWK n 110000 ¥Í¥Ã¥È¥ï¡¼¥¯Æüì¥Õ¥¡¥¤¥ë (HP-UX)
457 a000 S_IFLNK l@ 120000 ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯ (BSD)
458 b000 S_IFSHAD 130000 Solaris ACL ¤Î¤¿¤á¤Î±£¤µ¤ì¤¿ inode
459 (¥æ¡¼¥¶¶õ´Ö¤«¤é¤Ï¸«¤¨¤Ê¤¤)
460 c000 S_IFSOCK s= 140000 ¥½¥±¥Ã¥È (BSD; VxFS ¤Î "S_IFSOC")
461 d000 S_IFDOOR D> 150000 Solaris ¥É¥¢¡¦¥Õ¥¡¥¤¥ë
462 e000 S_IFWHT w% 160000 BSD ¶õÇò¥Õ¥¡¥¤¥ë (inode ¤ò»ÈÍѤ·¤Ê¤¤)
463 0200 S_ISVTX 001000 `¥¹¥Æ¥£¥Ã¥¡¼¡¦¥Ó¥Ã¥È':»ÈÍѸå¤â
466 ¥Ç¥£¥ì¥¯¥È¥ê°Ê³°: ¥Õ¥¡¥¤¥ë¤ò¥¥ã¥Ã¥·¥å
468 ¥Ç¥£¥ì¥¯¥È¥ê: ºï½üÀ©¸Â¥Õ¥é¥° (SVID-v4.2)
469 0400 S_ISGID 002000 ¼Â¹Ô»þ¤Î set-group-ID (V7)
470 ¥Ç¥£¥ì¥¯¥È¥ê¤ËÂФ·¤Æ¤Ï GID ¤ÎÅÁã¤Ë
472 0400 S_ENFMT 002000 System V ¥Õ¥¡¥¤¥ë¡¦¥í¥Ã¥¯¤ò¶¯À©¤¹¤ë
474 0800 S_ISUID 004000 ¼Â¹Ô»þ¤Î set-user-ID (V7)
475 0800 S_CDF 004000 ¥Ç¥£¥ì¥¯¥È¥ê¤¬¾õ¶·°Í¸¥Õ¥¡¥¤¥ë (HP-UX)
478 ¥¹¥Æ¥£¥Ã¥¡¼ ¥³¥Þ¥ó¥É¤Ï Version 32V AT&T UNIX ¤ÇÅо줷¤¿¡£
480 ¥«¡¼¥Í¥ë 2.5.48 °Ê¹ß¤Ç¤Ï¡¢
482 ¹½Â¤ÂÎ¤Ï 3¤Ä¤Î¥Õ¥¡¥¤¥ë¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×´ØÏ¢¤Î¥Õ¥£¡¼¥ë¥É¤Ç
483 ¥Ê¥ÎÉÃñ°Ì¤ÎÀºÅÙ¤ËÂбþ¤·¤Æ¤¤¤ë¡£
484 glibc ¤Ç¤Ï¡¢³Æ¥Õ¥£¡¼¥ë¥É¤Î¥Ê¥ÎÉäξðÊó¤ò
488 ¤È¤¤¤Ã¤¿·Á¤Ç»²¾È¤Ç¤¤ë¡£
493 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï
495 ¤Î·Á¼°¤Ç¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï
498 Éäè¤êºÙ¤«¤¤¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
499 ¤³¤ì¤é¤Î¥Ê¥ÎÉäΥե£¡¼¥ë¥É¤Ï 0 ¤ËÀßÄꤵ¤ì¤ë¡£
500 .\" As at kernel 2.6.25, XFS and JFS support nanosecond timestamps,
501 .\" but ext2, ext3, and Reiserfs do not.
502 .\" FIXME . SUSv4 specifies nanosecond timestamps.
506 ¤Ï°ìÈ̤ˤϼ«Æ°¥Þ¥¦¥ó¥ÈÆ°ºî (automounter action) ¤Î¤¤Ã¤«¤±¤È¤Ê¤é¤Ê¤¤¤¬¡¢
511 ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤Î¤Û¤È¤ó¤É¤Ç¤Ï¡¢
515 ¥Õ¥£¡¼¥ë¥É¤Ë¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬ÊÖ¤µ¤ì¤Ê¤¤¡£
518 ¥Õ¥£¡¼¥ë¥É¤Ë¤Ï 0 ¤¬ÊÖ¤µ¤ì¤ë¡£
519 .SS Çظå¤Î¥«¡¼¥Í¥ë¡¦¥¤¥ó¥¿¥Õ¥§¡¼¥¹
522 ¹½Â¤ÂΤΥµ¥¤¥º¤¬Â礤¯¤Ê¤ê¡¢¤³¤Î±Æ¶Á¤Ç
524 ¤Ë¤Ï 3¤Ä¤Î¥Ð¡¼¥¸¥ç¥ó¤¬Â¸ºß¤¹¤ë:
532 (¥«¡¼¥Í¥ë 2.4 ¤ÇƳÆþ; ¥¹¥í¥Ã¥È¤Ï
536 ¥é¥Ã¥Ñ¡¼´Ø¿ô¤Ï¤³¤ì¤é¤Î¾ÜºÙ¤ò¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é±£Ê䷤Ƥ¯¤ì¤ë¡£
537 ¶ñÂÎŪ¤Ë¤Ï¡¢¥«¡¼¥Í¥ë¤¬Ä󶡤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¤¦¤ÁºÇ¿·¤Î¥Ð¡¼¥¸¥ç¥ó¤ò
538 µ¯Æ°¤·¡¢¸Å¤¤¥Ð¥¤¥Ê¥ê¤Î¾ì¹ç¤Ë¤ÏɬÍפ˱þ¤¸¤ÆÊÖ¤µ¤ì¤¿¾ðÊó¤òºÆ¹½À® (repack) ¤¹¤ë¡£
542 ¤Ë¤Ä¤¤¤Æ¤âƱÍͤǤ¢¤ë¡£
544 .\" A note from Andries Brouwer, July 2007
546 .\" > Is the story not rather more complicated for some calls like
549 .\" Yes and no, mostly no. See /usr/include/sys/stat.h .
551 .\" The idea is here not so much that syscalls change, but that
552 .\" the definitions of struct stat and of the types dev_t and mode_t change.
553 .\" This means that libc (even if it does not call the kernel
554 .\" but only calls some internal function) must know what the
555 .\" format of dev_t or of struct stat is.
556 .\" The communication between the application and libc goes via
557 .\" the include file <sys/stat.h> that defines a _STAT_VER and
558 .\" _MKNOD_VER describing the layout of the data that user space
559 .\" uses. Each (almost each) occurrence of stat() is replaced by
560 .\" an occurrence of xstat() where the first parameter of xstat()
561 .\" is this version number _STAT_VER.
563 .\" Now, also the definitions used by the kernel change.
564 .\" But glibc copes with this in the standard way, and the
565 .\" struct stat as returned by the kernel is repacked into
566 .\" the struct stat as expected by the application.
567 .\" Thus, _STAT_VER and this setup cater for the application-libc
568 .\" interface, rather than the libc-kernel interface.
570 .\" (Note that the details depend on gcc being used as c compiler.)
574 ¤ò¸Æ¤Ó½Ð¤·¡¢Ê֤äƤ¤¿
576 ¹½Â¤ÂΤΥե£¡¼¥ë¥É¤Î¤¤¤¯¤Ä¤«¤òɽ¼¨¤¹¤ë¡£
579 #include <sys/types.h>
580 #include <sys/stat.h>
586 main(int argc, char *argv[])
591 fprintf(stderr, "Usage: %s <pathname>\\n", argv[0]);
595 if (stat(argv[1], &sb) == \-1) {
600 printf("File type: ");
602 switch (sb.st_mode & S_IFMT) {
603 case S_IFBLK: printf("block device\\n"); break;
604 case S_IFCHR: printf("character device\\n"); break;
605 case S_IFDIR: printf("directory\\n"); break;
606 case S_IFIFO: printf("FIFO/pipe\\n"); break;
607 case S_IFLNK: printf("symlink\\n"); break;
608 case S_IFREG: printf("regular file\\n"); break;
609 case S_IFSOCK: printf("socket\\n"); break;
610 default: printf("unknown?\\n"); break;
613 printf("I\-node number: %ld\\n", (long) sb.st_ino);
615 printf("Mode: %lo (octal)\\n",
616 (unsigned long) sb.st_mode);
618 printf("Link count: %ld\\n", (long) sb.st_nlink);
619 printf("Ownership: UID=%ld GID=%ld\\n",
620 (long) sb.st_uid, (long) sb.st_gid);
622 printf("Preferred I/O block size: %ld bytes\\n",
623 (long) sb.st_blksize);
624 printf("File size: %lld bytes\\n",
625 (long long) sb.st_size);
626 printf("Blocks allocated: %lld\\n",
627 (long long) sb.st_blocks);
629 printf("Last status change: %s", ctime(&sb.st_ctime));
630 printf("Last file access: %s", ctime(&sb.st_atime));
631 printf("Last file modification: %s", ctime(&sb.st_mtime));
643 .BR capabilities (7),