2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / s390 / bits / stat.h
blob00fcf078ba3a86ed155a5f78bddd47df8d99a690
1 /* Copyright (C) 2000, 2001, 2002 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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #ifndef _SYS_STAT_H
20 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
21 #endif
23 #include <bits/wordsize.h>
25 #if __WORDSIZE == 64
26 /* Versions of the `struct stat' data structure. */
27 # define _STAT_VER_KERNEL 0
28 # define _STAT_VER_LINUX 1
29 # define _STAT_VER _STAT_VER_LINUX
31 /* Versions of the `xmknod' interface. */
32 #define _MKNOD_VER_LINUX 0
33 #else
34 /* Versions of the `struct stat' data structure. */
35 # define _STAT_VER_LINUX_OLD 1
36 # define _STAT_VER_KERNEL 1
37 # define _STAT_VER_SVR4 2
38 # define _STAT_VER_LINUX 3
39 # define _STAT_VER _STAT_VER_LINUX
41 /* Versions of the `xmknod' interface. */
42 # define _MKNOD_VER_LINUX 1
43 # define _MKNOD_VER_SVR4 2
44 # define _MKNOD_VER _MKNOD_VER_LINUX
45 #endif
47 #if __WORDSIZE == 64
48 struct stat
50 __dev_t st_dev; /* Device. */
51 __ino_t st_ino; /* File serial number. */
52 __nlink_t st_nlink; /* Link count. */
53 __mode_t st_mode; /* File mode. */
54 __uid_t st_uid; /* User ID of the file's owner. */
55 __gid_t st_gid; /* Group ID of the file's group.*/
56 int pad0;
57 __dev_t st_rdev; /* Device number, if device. */
58 __off_t st_size; /* Size of file, in bytes. */
59 #ifdef __USE_MISC
60 /* Nanosecond resolution timestamps are stored in a format
61 equivalent to 'struct timespec'. This is the type used
62 whenever possible but the Unix namespace rules do not allow the
63 identifier 'timespec' to appear in the <sys/stat.h> header.
64 Therefore we have to handle the use of this header in strictly
65 standard-compliant sources special. */
66 struct timespec st_atim; /* Time of last access. */
67 struct timespec st_mtim; /* Time of last modification. */
68 struct timespec st_ctim; /* Time of last status change. */
69 # define st_atime st_atim.tv_sec /* Backward compatibility. */
70 # define st_mtime st_mtim.tv_sec
71 # define st_ctime st_ctim.tv_sec
72 #else
73 __time_t st_atime; /* Time of last access. */
74 unsigned long int st_atimensec; /* Nscecs of last access. */
75 __time_t st_mtime; /* Time of last modification. */
76 unsigned long int st_mtimensec; /* Nsecs of last modification. */
77 __time_t st_ctime; /* Time of last status change. */
78 unsigned long int st_ctimensec; /* Nsecs of last status change. */
79 #endif
80 __blksize_t st_blksize; /* Optimal block size for I/O. */
81 __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
82 long int __unused[3];
84 #else
85 struct stat
87 __dev_t st_dev; /* Device. */
88 unsigned int __pad1;
89 # ifndef __USE_FILE_OFFSET64
90 __ino_t st_ino; /* File serial number. */
91 # else
92 __ino_t __st_ino; /* 32bit file serial number. */
93 # endif
94 __mode_t st_mode; /* File mode. */
95 __nlink_t st_nlink; /* Link count. */
96 __uid_t st_uid; /* User ID of the file's owner. */
97 __gid_t st_gid; /* Group ID of the file's group.*/
98 __dev_t st_rdev; /* Device number, if device. */
99 unsigned int __pad2;
100 # ifndef __USE_FILE_OFFSET64
101 __off_t st_size; /* Size of file, in bytes. */
102 # else
103 __off64_t st_size; /* Size of file, in bytes. */
104 # endif
105 __blksize_t st_blksize; /* Optimal block size for I/O. */
107 # ifndef __USE_FILE_OFFSET64
108 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
109 # else
110 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
111 # endif
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 # ifndef __USE_FILE_OFFSET64
134 unsigned long int __unused4;
135 unsigned long int __unused5;
136 # else
137 __ino64_t st_ino; /* File serial number. */
138 # endif
140 #endif
142 #ifdef __USE_LARGEFILE64
143 # if __WORDSIZE == 64
144 /* Note stat64 is the same shape as stat. */
145 struct stat64
147 __dev_t st_dev; /* Device. */
148 __ino64_t st_ino; /* File serial number. */
149 __nlink_t st_nlink; /* Link count. */
150 __mode_t st_mode; /* File mode. */
151 __uid_t st_uid; /* User ID of the file's owner. */
152 __gid_t st_gid; /* Group ID of the file's group.*/
153 int pad0;
154 __dev_t st_rdev; /* Device number, if device. */
155 __off_t st_size; /* Size of file, in bytes. */
156 #ifdef __USE_MISC
157 /* Nanosecond resolution timestamps are stored in a format
158 equivalent to 'struct timespec'. This is the type used
159 whenever possible but the Unix namespace rules do not allow the
160 identifier 'timespec' to appear in the <sys/stat.h> header.
161 Therefore we have to handle the use of this header in strictly
162 standard-compliant sources special. */
163 struct timespec st_atim; /* Time of last access. */
164 struct timespec st_mtim; /* Time of last modification. */
165 struct timespec st_ctim; /* Time of last status change. */
166 # define st_atime st_atim.tv_sec /* Backward compatibility. */
167 # define st_mtime st_mtim.tv_sec
168 # define st_ctime st_ctim.tv_sec
169 #else
170 __time_t st_atime; /* Time of last access. */
171 unsigned long int st_atimensec; /* Nscecs of last access. */
172 __time_t st_mtime; /* Time of last modification. */
173 unsigned long int st_mtimensec; /* Nsecs of last modification. */
174 __time_t st_ctime; /* Time of last status change. */
175 unsigned long int st_ctimensec; /* Nsecs of last status change. */
176 #endif
177 __blksize_t st_blksize; /* Optimal block size for I/O. */
178 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
179 long int __unused[3];
181 # else
182 struct stat64
184 __dev_t st_dev; /* Device. */
185 unsigned int __pad1;
187 __ino_t __st_ino; /* 32bit file serial number. */
188 __mode_t st_mode; /* File mode. */
189 __nlink_t st_nlink; /* Link count. */
190 __uid_t st_uid; /* User ID of the file's owner. */
191 __gid_t st_gid; /* Group ID of the file's group.*/
192 __dev_t st_rdev; /* Device number, if device. */
193 unsigned int __pad2;
194 __off64_t st_size; /* Size of file, in bytes. */
195 __blksize_t st_blksize; /* Optimal block size for I/O. */
197 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
198 #ifdef __USE_MISC
199 /* Nanosecond resolution timestamps are stored in a format
200 equivalent to 'struct timespec'. This is the type used
201 whenever possible but the Unix namespace rules do not allow the
202 identifier 'timespec' to appear in the <sys/stat.h> header.
203 Therefore we have to handle the use of this header in strictly
204 standard-compliant sources special. */
205 struct timespec st_atim; /* Time of last access. */
206 struct timespec st_mtim; /* Time of last modification. */
207 struct timespec st_ctim; /* Time of last status change. */
208 # define st_atime st_atim.tv_sec /* Backward compatibility. */
209 # define st_mtime st_mtim.tv_sec
210 # define st_ctime st_ctim.tv_sec
211 #else
212 __time_t st_atime; /* Time of last access. */
213 unsigned long int st_atimensec; /* Nscecs of last access. */
214 __time_t st_mtime; /* Time of last modification. */
215 unsigned long int st_mtimensec; /* Nsecs of last modification. */
216 __time_t st_ctime; /* Time of last status change. */
217 unsigned long int st_ctimensec; /* Nsecs of last status change. */
218 #endif
219 __ino64_t st_ino; /* File serial number. */
221 # endif
222 #endif
224 /* Tell code we have these members. */
225 #define _STATBUF_ST_BLKSIZE
226 #define _STATBUF_ST_RDEV
227 /* Nanosecond resolution time values are supported. */
228 #define _STATBUF_ST_NSEC
230 /* Encoding of the file mode. */
232 #define __S_IFMT 0170000 /* These bits determine file type. */
234 /* File types. */
235 #define __S_IFDIR 0040000 /* Directory. */
236 #define __S_IFCHR 0020000 /* Character device. */
237 #define __S_IFBLK 0060000 /* Block device. */
238 #define __S_IFREG 0100000 /* Regular file. */
239 #define __S_IFIFO 0010000 /* FIFO. */
240 #define __S_IFLNK 0120000 /* Symbolic link. */
241 #define __S_IFSOCK 0140000 /* Socket. */
243 /* POSIX.1b objects. Note that these macros always evaluate to zero. But
244 they do it by enforcing the correct use of the macros. */
245 #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
246 #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
247 #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
249 /* Protection bits. */
251 #define __S_ISUID 04000 /* Set user ID on execution. */
252 #define __S_ISGID 02000 /* Set group ID on execution. */
253 #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
254 #define __S_IREAD 0400 /* Read by owner. */
255 #define __S_IWRITE 0200 /* Write by owner. */
256 #define __S_IEXEC 0100 /* Execute by owner. */
258 #if defined __USE_ATFILE || defined __USE_GNU
259 /* XXX This will change to the macro for the next 2008 POSIX revision. */
260 # define UTIME_NOW ((1l << 30) - 1l)
261 # define UTIME_OMIT ((1l << 30) - 2l)
262 #endif