Research V4 development
[unix-history] / man / man2 / stat.2
CommitLineData
88d0a458
KT
1.th STAT II 8/5/73
2.sh NAME
3stat \*- get file status
4.sh SYNOPSIS
5(stat = 18.)
6.br
7.ft B
8sys stat; name; buf
9.s3
10stat(name, buf)
11.br
12char *name;
13.br
14struct inode *buf;
15.ft R
16.sh DESCRIPTION
17.it Name
18points to a null-terminated string naming
19a file;
20.it buf
21is the address of a 36(10) byte buffer
22into which information is placed concerning the file.
23It is unnecessary to have any
24permissions at all with respect to the file, but all directories
25leading to the file must be readable.
26After
27.it stat,
28.it buf
29has the following structure (starting offset given in bytes):
30.s3
31.if t .ta .5 1i 2.5i
32.if n .ta 3 9 24
33.nf
34struct {
35 char minor; /* +0: minor device of i-node */
36 char major; /* +1: major device */
37 int inumber /* +2 */
38 int flags; /* +4: see below */
39 char nlinks; /* +6: number of links to file */
40 char uid; /* +7: user ID of owner */
41 char gid; /* +8: group ID of owner */
42 char size0; /* +9: high byte of 24-bit size */
43 int size1; /* +10: low word of 24-bit size */
44 int addr[8]; /* +12: block numbers or device number */
45 int actime[2]; /* +28: time of last access */
46 int modtime[2]; /* +32: time of last modification */
47};
48.fi
49.s3
50The flags are as follows:
51.s3
52.lp +10 9
53100000 i-node is allocated
54.lp +10 9
55060000 2-bit file type:
56.lp +15 9
57000000 plain file
58.lp +15 9
59040000 directory
60.lp +15 9
61020000 character-type special file
62.lp +15 9
63060000 block-type special file.
64.lp +10 9
65010000 large file
66.lp +10 9
67004000 set user-ID on execution
68.lp +10 9
69002000 set group-ID on execution
70.lp +10 9
71000400 read (owner)
72.lp +10 9
73000200 write (owner)
74.lp +10 9
75000100 execute (owner)
76.lp +10 9
77000070 read, write, execute (group)
78.lp +10 9
79000007 read, write, execute (others)
80.i0
81.sh "SEE ALSO"
82stat(I), fstat(II), fs(V)
83.sh DIAGNOSTICS
84Error bit (c-bit)
85is set if the file cannot be found.
86From C, a \*-1 return indicates an error.