Update.
[glibc.git] / sysdeps / mach / hurd / bits / stat.h
blob4679c589eeacba71f31de8b9a28d022ef4e00801
1 /* Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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. */
20 * Never include this file directly; use <sys/stat.h> instead.
23 #ifndef _BITS_STAT_H
24 #define _BITS_STAT_H 1
26 #include <bits/types.h>
28 /* NOTE: The size of this structure (32 ints) is known in
29 <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC. MiG
30 does not cope at all well with the passed C structure not being of
31 the expected size. There are some filler words at the end to allow
32 for future expansion. To increase the size of the structure used
33 in the RPC and retain binary compatibility, we would need to assign
34 a new message number. */
36 struct stat
38 int st_fstype; /* File system type. */
39 __fsid_t st_fsid; /* File system ID. */
40 #define st_dev st_fsid
42 #ifndef __USE_FILE_OFFSET64
43 __ino_t st_ino; /* File number. */
44 #else
45 __ino64_t st_ino; /* File number. */
46 #endif
47 unsigned int st_gen; /* To detect reuse of file numbers. */
48 __dev_t st_rdev; /* Device if special file. */
49 __mode_t st_mode; /* File mode. */
50 __nlink_t st_nlink; /* Number of links. */
52 __uid_t st_uid; /* Owner. */
53 __gid_t st_gid; /* Owning group. */
55 #ifndef __USE_FILE_OFFSET64
56 __off_t st_size; /* Size in bytes. */
57 #else
58 __off64_t st_size; /* Size in bytes. */
59 #endif
61 __time_t st_atime; /* Access time, seconds */
62 unsigned long int st_atime_usec; /* and microseconds. */
63 __time_t st_mtime; /* Modification time, seconds */
64 unsigned long int st_mtime_usec; /* and microseconds. */
65 __time_t st_ctime; /* Status change time, seconds */
66 unsigned long int st_ctime_usec; /* and microseconds. */
68 unsigned int st_blksize; /* Optimal size for I/O. */
70 #ifndef __USE_FILE_OFFSET64
71 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated.
72 Not related to `st_blksize'. */
73 #else
74 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
75 Not related to `st_blksize'. */
76 #endif
78 __uid_t st_author; /* File author. */
80 unsigned int st_flags; /* User-defined flags.
81 High 16 bits can be set only by root. */
83 #ifndef __USE_FILE_OFFSET64
84 # define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
85 #else
86 # define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
87 #endif
88 int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
89 #undef _SPARE_SIZE
92 #ifdef __USE_LARGEFILE64
93 struct stat64
95 int st_fstype; /* File system type. */
96 __fsid_t st_fsid; /* File system ID. */
97 # define st_dev st_fsid
99 __ino64_t st_ino; /* File number. */
100 unsigned int st_gen; /* To detect reuse of file numbers. */
101 __dev_t st_rdev; /* Device if special file. */
102 __mode_t st_mode; /* File mode. */
103 __nlink_t st_nlink; /* Number of links. */
105 __uid_t st_uid; /* Owner. */
106 __gid_t st_gid; /* Owning group. */
108 __off64_t st_size; /* Size in bytes. */
110 __time_t st_atime; /* Access time, seconds */
111 unsigned long int st_atime_usec; /* and microseconds. */
112 __time_t st_mtime; /* Modification time, seconds */
113 unsigned long int st_mtime_usec; /* and microseconds. */
114 __time_t st_ctime; /* Status change time, seconds */
115 unsigned long int st_ctime_usec; /* and microseconds. */
117 unsigned int st_blksize; /* Optimal size for I/O. */
119 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
120 Not related to `st_blksize'. */
122 __uid_t st_author; /* File author. */
124 unsigned int st_flags; /* User-defined flags.
125 High 16 bits can be set only by root. */
127 #define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
128 int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
129 #undef _SPARE_SIZE
131 #endif
133 #define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
135 /* Encoding of the file mode. */
137 #define __S_IFMT 0170000 /* These bits determine file type. */
139 /* File types. */
140 #define __S_IFDIR 0040000 /* Directory. */
141 #define __S_IFCHR 0020000 /* Character device. */
142 #define __S_IFBLK 0060000 /* Block device. */
143 #define __S_IFREG 0100000 /* Regular file. */
144 #define __S_IFLNK 0120000 /* Symbolic link. */
145 #define __S_IFSOCK 0140000 /* Socket. */
146 #define __S_IFIFO 0010000 /* FIFO. */
148 /* Protection bits. */
150 #define __S_ISUID 04000 /* Set user ID on execution. */
151 #define __S_ISGID 02000 /* Set group ID on execution. */
152 #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
153 #define __S_IREAD 00400 /* Read by owner. */
154 #define __S_IWRITE 00200 /* Write by owner. */
155 #define __S_IEXEC 00100 /* Execute by owner. */
158 #ifdef __USE_GNU
159 /* If set, there is no benefit in caching the contents of this file. */
160 #define S_INOCACHE 000000200000
162 /* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below)
163 control access for unknown users. If S_IUSEUNK is clear, then unknown
164 users are treated as "others" for purposes of access control. */
165 #define S_IUSEUNK 000000400000
166 /* Mask of protection bits for unknown users (no effective IDs at all). */
167 #define S_IUNKNOWN 000007000000
168 /* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the
169 protection bits for unknown users. */
170 #define S_IUNKSHIFT 12
172 /* Read only bits: */
174 /* There is a passive translator set for this file */
175 #define S_IPTRANS 000010000000
176 /* There is an active translator running on this file */
177 #define S_IATRANS 000020000000
178 /* This is the root of a filesystem (or single node translator) */
179 #define S_IROOT 000040000000
180 /* All the bits relevant to translators */
181 #define S_ITRANS 000070000000
183 /* ALL the unused bits. */
184 #define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE| \
185 S_IUSEUNK|S_IUNKNOWN|07777))
186 #endif
188 /* Default file creation mask (umask). */
189 #ifdef __USE_BSD
190 #define CMASK 0022
191 #endif
194 #endif /* bits/stat.h */