]>
Commit | Line | Data |
---|---|---|
219aa9e9 | 1 | /* Copyright (C) 1992, 93, 94, 96, 97, 99 Free Software Foundation, Inc. |
54d79e99 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
54d79e99 UD |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | License, or (at your option) any later version. | |
28f540f4 | 8 | |
54d79e99 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Library General Public License for more details. | |
28f540f4 | 13 | |
54d79e99 UD |
14 | You should have received a copy of the GNU Library General Public |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
28f540f4 | 18 | |
f4017d20 UD |
19 | #ifndef _SYS_STAT_H |
20 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." | |
21 | #endif | |
28f540f4 | 22 | |
5107cf1d | 23 | #include <bits/types.h> |
28f540f4 RM |
24 | |
25 | /* NOTE: The size of this structure (32 ints) is known in | |
26 | <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC. MiG | |
27 | does not cope at all well with the passed C structure not being of | |
28 | the expected size. There are some filler words at the end to allow | |
29 | for future expansion. To increase the size of the structure used | |
30 | in the RPC and retain binary compatibility, we would need to assign | |
31 | a new message number. */ | |
32 | ||
33 | struct stat | |
34 | { | |
35 | int st_fstype; /* File system type. */ | |
36 | __fsid_t st_fsid; /* File system ID. */ | |
37 | #define st_dev st_fsid | |
38 | ||
dfd2257a | 39 | #ifndef __USE_FILE_OFFSET64 |
28f540f4 | 40 | __ino_t st_ino; /* File number. */ |
dfd2257a UD |
41 | #else |
42 | __ino64_t st_ino; /* File number. */ | |
43 | #endif | |
28f540f4 RM |
44 | unsigned int st_gen; /* To detect reuse of file numbers. */ |
45 | __dev_t st_rdev; /* Device if special file. */ | |
46 | __mode_t st_mode; /* File mode. */ | |
47 | __nlink_t st_nlink; /* Number of links. */ | |
48 | ||
49 | __uid_t st_uid; /* Owner. */ | |
50 | __gid_t st_gid; /* Owning group. */ | |
51 | ||
dfd2257a | 52 | #ifndef __USE_FILE_OFFSET64 |
28f540f4 | 53 | __off_t st_size; /* Size in bytes. */ |
dfd2257a UD |
54 | #else |
55 | __off64_t st_size; /* Size in bytes. */ | |
56 | #endif | |
28f540f4 RM |
57 | |
58 | __time_t st_atime; /* Access time, seconds */ | |
59 | unsigned long int st_atime_usec; /* and microseconds. */ | |
60 | __time_t st_mtime; /* Modification time, seconds */ | |
61 | unsigned long int st_mtime_usec; /* and microseconds. */ | |
62 | __time_t st_ctime; /* Status change time, seconds */ | |
63 | unsigned long int st_ctime_usec; /* and microseconds. */ | |
64 | ||
219aa9e9 | 65 | __blksize_t st_blksize; /* Optimal size for I/O. */ |
28f540f4 | 66 | |
dfd2257a UD |
67 | #ifndef __USE_FILE_OFFSET64 |
68 | __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. | |
69 | Not related to `st_blksize'. */ | |
70 | #else | |
71 | __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. | |
72 | Not related to `st_blksize'. */ | |
73 | #endif | |
74 | ||
75 | __uid_t st_author; /* File author. */ | |
76 | ||
77 | unsigned int st_flags; /* User-defined flags. | |
78 | High 16 bits can be set only by root. */ | |
79 | ||
80 | #ifndef __USE_FILE_OFFSET64 | |
81 | # define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11) | |
82 | #else | |
83 | # define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) | |
84 | #endif | |
85 | int st_spare[_SPARE_SIZE]; /* Room for future expansion. */ | |
86 | #undef _SPARE_SIZE | |
87 | }; | |
88 | ||
89 | #ifdef __USE_LARGEFILE64 | |
90 | struct stat64 | |
91 | { | |
92 | int st_fstype; /* File system type. */ | |
93 | __fsid_t st_fsid; /* File system ID. */ | |
94 | # define st_dev st_fsid | |
95 | ||
96 | __ino64_t st_ino; /* File number. */ | |
97 | unsigned int st_gen; /* To detect reuse of file numbers. */ | |
98 | __dev_t st_rdev; /* Device if special file. */ | |
99 | __mode_t st_mode; /* File mode. */ | |
100 | __nlink_t st_nlink; /* Number of links. */ | |
101 | ||
102 | __uid_t st_uid; /* Owner. */ | |
103 | __gid_t st_gid; /* Owning group. */ | |
104 | ||
105 | __off64_t st_size; /* Size in bytes. */ | |
106 | ||
107 | __time_t st_atime; /* Access time, seconds */ | |
108 | unsigned long int st_atime_usec; /* and microseconds. */ | |
109 | __time_t st_mtime; /* Modification time, seconds */ | |
110 | unsigned long int st_mtime_usec; /* and microseconds. */ | |
111 | __time_t st_ctime; /* Status change time, seconds */ | |
112 | unsigned long int st_ctime_usec; /* and microseconds. */ | |
28f540f4 | 113 | |
219aa9e9 | 114 | __blksize_t st_blksize; /* Optimal size for I/O. */ |
dfd2257a UD |
115 | |
116 | __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. | |
28f540f4 RM |
117 | Not related to `st_blksize'. */ |
118 | ||
119 | __uid_t st_author; /* File author. */ | |
120 | ||
121 | unsigned int st_flags; /* User-defined flags. | |
122 | High 16 bits can be set only by root. */ | |
123 | ||
dfd2257a | 124 | #define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) |
5107cf1d UD |
125 | int st_spare[_SPARE_SIZE]; /* Room for future expansion. */ |
126 | #undef _SPARE_SIZE | |
28f540f4 | 127 | }; |
dfd2257a UD |
128 | #endif |
129 | ||
130 | #define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ | |
28f540f4 RM |
131 | |
132 | /* Encoding of the file mode. */ | |
133 | ||
134 | #define __S_IFMT 0170000 /* These bits determine file type. */ | |
135 | ||
136 | /* File types. */ | |
137 | #define __S_IFDIR 0040000 /* Directory. */ | |
138 | #define __S_IFCHR 0020000 /* Character device. */ | |
139 | #define __S_IFBLK 0060000 /* Block device. */ | |
140 | #define __S_IFREG 0100000 /* Regular file. */ | |
141 | #define __S_IFLNK 0120000 /* Symbolic link. */ | |
142 | #define __S_IFSOCK 0140000 /* Socket. */ | |
143 | #define __S_IFIFO 0010000 /* FIFO. */ | |
144 | ||
145 | /* Protection bits. */ | |
146 | ||
147 | #define __S_ISUID 04000 /* Set user ID on execution. */ | |
148 | #define __S_ISGID 02000 /* Set group ID on execution. */ | |
149 | #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ | |
150 | #define __S_IREAD 00400 /* Read by owner. */ | |
151 | #define __S_IWRITE 00200 /* Write by owner. */ | |
152 | #define __S_IEXEC 00100 /* Execute by owner. */ | |
153 | ||
154 | ||
155 | #ifdef __USE_GNU | |
156 | /* If set, there is no benefit in caching the contents of this file. */ | |
157 | #define S_INOCACHE 000000200000 | |
158 | ||
159 | /* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below) | |
160 | control access for unknown users. If S_IUSEUNK is clear, then unknown | |
161 | users are treated as "others" for purposes of access control. */ | |
162 | #define S_IUSEUNK 000000400000 | |
163 | /* Mask of protection bits for unknown users (no effective IDs at all). */ | |
164 | #define S_IUNKNOWN 000007000000 | |
165 | /* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the | |
166 | protection bits for unknown users. */ | |
167 | #define S_IUNKSHIFT 12 | |
168 | ||
ebe3b3eb TBB |
169 | /* Read only bits: */ |
170 | ||
171 | /* There is a passive translator set for this file */ | |
172 | #define S_IPTRANS 000010000000 | |
173 | /* There is an active translator running on this file */ | |
174 | #define S_IATRANS 000020000000 | |
175 | /* This is the root of a filesystem (or single node translator) */ | |
176 | #define S_IROOT 000040000000 | |
177 | /* All the bits relevant to translators */ | |
178 | #define S_ITRANS 000070000000 | |
179 | ||
180 | /* ALL the unused bits. */ | |
181 | #define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE| \ | |
182 | S_IUSEUNK|S_IUNKNOWN|07777)) | |
28f540f4 RM |
183 | #endif |
184 | ||
185 | /* Default file creation mask (umask). */ | |
186 | #ifdef __USE_BSD | |
187 | #define CMASK 0022 | |
188 | #endif |