Commit | Line | Data |
---|---|---|
88d0a458 KT |
1 | .th STAT II 8/5/73 |
2 | .sh NAME | |
3 | stat \*- get file status | |
4 | .sh SYNOPSIS | |
5 | (stat = 18.) | |
6 | .br | |
7 | .ft B | |
8 | sys stat; name; buf | |
9 | .s3 | |
10 | stat(name, buf) | |
11 | .br | |
12 | char *name; | |
13 | .br | |
14 | struct inode *buf; | |
15 | .ft R | |
16 | .sh DESCRIPTION | |
17 | .it Name | |
18 | points to a null-terminated string naming | |
19 | a file; | |
20 | .it buf | |
21 | is the address of a 36(10) byte buffer | |
22 | into which information is placed concerning the file. | |
23 | It is unnecessary to have any | |
24 | permissions at all with respect to the file, but all directories | |
25 | leading to the file must be readable. | |
26 | After | |
27 | .it stat, | |
28 | .it buf | |
29 | has 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 | |
34 | struct { | |
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 | |
50 | The flags are as follows: | |
51 | .s3 | |
52 | .lp +10 9 | |
53 | 100000 i-node is allocated | |
54 | .lp +10 9 | |
55 | 060000 2-bit file type: | |
56 | .lp +15 9 | |
57 | 000000 plain file | |
58 | .lp +15 9 | |
59 | 040000 directory | |
60 | .lp +15 9 | |
61 | 020000 character-type special file | |
62 | .lp +15 9 | |
63 | 060000 block-type special file. | |
64 | .lp +10 9 | |
65 | 010000 large file | |
66 | .lp +10 9 | |
67 | 004000 set user-ID on execution | |
68 | .lp +10 9 | |
69 | 002000 set group-ID on execution | |
70 | .lp +10 9 | |
71 | 000400 read (owner) | |
72 | .lp +10 9 | |
73 | 000200 write (owner) | |
74 | .lp +10 9 | |
75 | 000100 execute (owner) | |
76 | .lp +10 9 | |
77 | 000070 read, write, execute (group) | |
78 | .lp +10 9 | |
79 | 000007 read, write, execute (others) | |
80 | .i0 | |
81 | .sh "SEE ALSO" | |
82 | stat(I), fstat(II), fs(V) | |
83 | .sh DIAGNOSTICS | |
84 | Error bit (c-bit) | |
85 | is set if the file cannot be found. | |
86 | From C, a \*-1 return indicates an error. |