Experimental patch to default PPC64 to no-execstack support. This will need
[glibc.git] / sysdeps / unix / sysv / linux / powerpc / bits / stat.h
blob53457ef1fa9fadd1e50813be2e927f74d0da5597
1 /* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _SYS_STAT_H
21 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
22 #endif
24 #include <bits/wordsize.h>
26 /* Versions of the `struct stat' data structure. */
27 #define _STAT_VER_LINUX_OLD 1
28 #define _STAT_VER_KERNEL 1
29 #define _STAT_VER_SVR4 2
30 #define _STAT_VER_LINUX 3
31 #if __WORDSIZE == 32
32 # define _STAT_VER _STAT_VER_LINUX
33 #else
34 # define _STAT_VER _STAT_VER_KERNEL
35 #endif
37 /* Versions of the `xmknod' interface. */
38 #define _MKNOD_VER_LINUX 1
39 #define _MKNOD_VER_SVR4 2
40 #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
43 #if __WORDSIZE == 32
45 struct stat
47 __dev_t st_dev; /* Device. */
48 # ifndef __USE_FILE_OFFSET64
49 unsigned short int __pad1;
50 __ino_t st_ino; /* File serial number. */
51 # else
52 __ino64_t st_ino; /* File serial number. */
53 # endif
54 __mode_t st_mode; /* File mode. */
55 __nlink_t st_nlink; /* Link count. */
56 __uid_t st_uid; /* User ID of the file's owner. */
57 __gid_t st_gid; /* Group ID of the file's group.*/
58 __dev_t st_rdev; /* Device number, if device. */
59 unsigned short int __pad2;
60 # ifndef __USE_FILE_OFFSET64
61 __off_t st_size; /* Size of file, in bytes. */
62 # else
63 __off64_t st_size; /* Size of file, in bytes. */
64 # endif
65 __blksize_t st_blksize; /* Optimal block size for I/O. */
67 # ifndef __USE_FILE_OFFSET64
68 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
69 # else
70 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
71 # endif
72 #ifdef __USE_MISC
73 /* Nanosecond resolution timestamps are stored in a format
74 equivalent to 'struct timespec'. This is the type used
75 whenever possible but the Unix namespace rules do not allow the
76 identifier 'timespec' to appear in the <sys/stat.h> header.
77 Therefore we have to handle the use of this header in strictly
78 standard-compliant sources special. */
79 struct timespec st_atim; /* Time of last access. */
80 struct timespec st_mtim; /* Time of last modification. */
81 struct timespec st_ctim; /* Time of last status change. */
82 # define st_atime st_atim.tv_sec /* Backward compatibility. */
83 # define st_mtime st_mtim.tv_sec
84 # define st_ctime st_ctim.tv_sec
85 #else
86 __time_t st_atime; /* Time of last access. */
87 unsigned long int st_atimensec; /* Nscecs of last access. */
88 __time_t st_mtime; /* Time of last modification. */
89 unsigned long int st_mtimensec; /* Nsecs of last modification. */
90 __time_t st_ctime; /* Time of last status change. */
91 unsigned long int st_ctimensec; /* Nsecs of last status change. */
92 #endif
93 unsigned long int __unused4;
94 unsigned long int __unused5;
98 # ifdef __USE_LARGEFILE64
99 struct stat64
101 __dev_t st_dev; /* Device. */
102 __ino64_t st_ino; /* File serial number. */
103 __mode_t st_mode; /* File mode. */
104 __nlink_t st_nlink; /* Link count. */
105 __uid_t st_uid; /* User ID of the file's owner. */
106 __gid_t st_gid; /* Group ID of the file's group.*/
107 __dev_t st_rdev; /* Device number, if device. */
108 unsigned short int __pad2;
109 __off64_t st_size; /* Size of file, in bytes. */
110 __blksize_t st_blksize; /* Optimal block size for I/O. */
111 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
112 #ifdef __USE_MISC
113 /* Nanosecond resolution timestamps are stored in a format
114 equivalent to 'struct timespec'. This is the type used
115 whenever possible but the Unix namespace rules do not allow the
116 identifier 'timespec' to appear in the <sys/stat.h> header.
117 Therefore we have to handle the use of this header in strictly
118 standard-compliant sources special. */
119 struct timespec st_atim; /* Time of last access. */
120 struct timespec st_mtim; /* Time of last modification. */
121 struct timespec st_ctim; /* Time of last status change. */
122 # define st_atime st_atim.tv_sec /* Backward compatibility. */
123 # define st_mtime st_mtim.tv_sec
124 # define st_ctime st_ctim.tv_sec
125 #else
126 __time_t st_atime; /* Time of last access. */
127 unsigned long int st_atimensec; /* Nscecs of last access. */
128 __time_t st_mtime; /* Time of last modification. */
129 unsigned long int st_mtimensec; /* Nsecs of last modification. */
130 __time_t st_ctime; /* Time of last status change. */
131 unsigned long int st_ctimensec; /* Nsecs of last status change. */
132 #endif
133 unsigned long int __unused4;
134 unsigned long int __unused5;
136 # endif /* __USE_LARGEFILE64 */
138 #else /* __WORDSIZE == 32 */
140 struct stat
142 __dev_t st_dev; /* Device. */
143 # ifndef __USE_FILE_OFFSET64
144 __ino_t st_ino; /* File serial number. */
145 # else
146 __ino64_t st_ino; /* File serial number. */
147 # endif
148 __nlink_t st_nlink; /* Link count. */
149 __mode_t st_mode; /* File mode. */
150 __uid_t st_uid; /* User ID of the file's owner. */
151 __gid_t st_gid; /* Group ID of the file's group.*/
152 int __pad2;
153 __dev_t st_rdev; /* Device number, if device. */
154 # ifndef __USE_FILE_OFFSET64
155 __off_t st_size; /* Size of file, in bytes. */
156 # else
157 __off64_t st_size; /* Size of file, in bytes. */
158 # endif
159 __blksize_t st_blksize; /* Optimal block size for I/O. */
161 # ifndef __USE_FILE_OFFSET64
162 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
163 # else
164 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
165 # endif
166 #ifdef __USE_MISC
167 /* Nanosecond resolution timestamps are stored in a format
168 equivalent to 'struct timespec'. This is the type used
169 whenever possible but the Unix namespace rules do not allow the
170 identifier 'timespec' to appear in the <sys/stat.h> header.
171 Therefore we have to handle the use of this header in strictly
172 standard-compliant sources special. */
173 struct timespec st_atim; /* Time of last access. */
174 struct timespec st_mtim; /* Time of last modification. */
175 struct timespec st_ctim; /* Time of last status change. */
176 # define st_atime st_atim.tv_sec /* Backward compatibility. */
177 # define st_mtime st_mtim.tv_sec
178 # define st_ctime st_ctim.tv_sec
179 #else
180 __time_t st_atime; /* Time of last access. */
181 unsigned long int st_atimensec; /* Nscecs of last access. */
182 __time_t st_mtime; /* Time of last modification. */
183 unsigned long int st_mtimensec; /* Nsecs of last modification. */
184 __time_t st_ctime; /* Time of last status change. */
185 unsigned long int st_ctimensec; /* Nsecs of last status change. */
186 #endif
187 unsigned long int __unused4;
188 unsigned long int __unused5;
189 unsigned long int __unused6;
192 # ifdef __USE_LARGEFILE64
193 struct stat64
195 __dev_t st_dev; /* Device. */
196 __ino64_t st_ino; /* File serial number. */
197 __nlink_t st_nlink; /* Link count. */
198 __mode_t st_mode; /* File mode. */
199 __uid_t st_uid; /* User ID of the file's owner. */
200 __gid_t st_gid; /* Group ID of the file's group.*/
201 int __pad2;
202 __dev_t st_rdev; /* Device number, if device. */
203 __off64_t st_size; /* Size of file, in bytes. */
204 __blksize_t st_blksize; /* Optimal block size for I/O. */
205 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
206 #ifdef __USE_MISC
207 /* Nanosecond resolution timestamps are stored in a format
208 equivalent to 'struct timespec'. This is the type used
209 whenever possible but the Unix namespace rules do not allow the
210 identifier 'timespec' to appear in the <sys/stat.h> header.
211 Therefore we have to handle the use of this header in strictly
212 standard-compliant sources special. */
213 struct timespec st_atim; /* Time of last access. */
214 struct timespec st_mtim; /* Time of last modification. */
215 struct timespec st_ctim; /* Time of last status change. */
216 # define st_atime st_atim.tv_sec /* Backward compatibility. */
217 # define st_mtime st_mtim.tv_sec
218 # define st_ctime st_ctim.tv_sec
219 #else
220 __time_t st_atime; /* Time of last access. */
221 unsigned long int st_atimensec; /* Nscecs of last access. */
222 __time_t st_mtime; /* Time of last modification. */
223 unsigned long int st_mtimensec; /* Nsecs of last modification. */
224 __time_t st_ctime; /* Time of last status change. */
225 unsigned long int st_ctimensec; /* Nsecs of last status change. */
226 #endif
227 unsigned long int __unused4;
228 unsigned long int __unused5;
229 unsigned long int __unused6;
231 # endif /* __USE_LARGEFILE64 */
232 #endif
235 /* Tell code we have these members. */
236 #define _STATBUF_ST_BLKSIZE
237 #define _STATBUF_ST_RDEV
238 /* Nanosecond resolution time values are supported. */
239 #define _STATBUF_ST_NSEC
241 /* Encoding of the file mode. */
243 #define __S_IFMT 0170000 /* These bits determine file type. */
245 /* File types. */
246 #define __S_IFDIR 0040000 /* Directory. */
247 #define __S_IFCHR 0020000 /* Character device. */
248 #define __S_IFBLK 0060000 /* Block device. */
249 #define __S_IFREG 0100000 /* Regular file. */
250 #define __S_IFIFO 0010000 /* FIFO. */
251 #define __S_IFLNK 0120000 /* Symbolic link. */
252 #define __S_IFSOCK 0140000 /* Socket. */
254 /* POSIX.1b objects. Note that these macros always evaluate to zero. But
255 they do it by enforcing the correct use of the macros. */
256 #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
257 #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
258 #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
260 /* Protection bits. */
262 #define __S_ISUID 04000 /* Set user ID on execution. */
263 #define __S_ISGID 02000 /* Set group ID on execution. */
264 #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
265 #define __S_IREAD 0400 /* Read by owner. */
266 #define __S_IWRITE 0200 /* Write by owner. */
267 #define __S_IEXEC 0100 /* Execute by owner. */
269 #if defined __USE_ATFILE || defined __USE_GNU
270 /* XXX This will change to the macro for the next 2008 POSIX revision. */
271 # define UTIME_NOW ((1l << 30) - 1l)
272 # define UTIME_OMIT ((1l << 30) - 2l)
273 #endif