Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / unix / sysv / linux / s390 / bits / stat.h
blob46125093211553061a5d86e69aaf8551260e5553
1 /* Copyright (C) 2000-2015 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, see
16 <http://www.gnu.org/licenses/>. */
18 #if !defined _SYS_STAT_H && !defined _FCNTL_H
19 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
20 #endif
22 #ifndef _BITS_STAT_H
23 #define _BITS_STAT_H 1
25 #include <bits/wordsize.h>
27 #if __WORDSIZE == 64
28 /* Versions of the `struct stat' data structure. */
29 # define _STAT_VER_KERNEL 0
30 # define _STAT_VER_LINUX 1
31 # define _STAT_VER _STAT_VER_LINUX
33 /* Versions of the `xmknod' interface. */
34 #define _MKNOD_VER_LINUX 0
35 #else
36 /* Versions of the `struct stat' data structure. */
37 # define _STAT_VER_LINUX_OLD 1
38 # define _STAT_VER_KERNEL 1
39 # define _STAT_VER_SVR4 2
40 # define _STAT_VER_LINUX 3
41 # define _STAT_VER _STAT_VER_LINUX
43 /* Versions of the `xmknod' interface. */
44 # define _MKNOD_VER_LINUX 1
45 # define _MKNOD_VER_SVR4 2
46 # define _MKNOD_VER _MKNOD_VER_LINUX
47 #endif
49 #if __WORDSIZE == 64
50 struct stat
52 __dev_t st_dev; /* Device. */
53 __ino_t st_ino; /* File serial number. */
54 __nlink_t st_nlink; /* Link count. */
55 __mode_t st_mode; /* File mode. */
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 int __glibc_reserved0;
59 __dev_t st_rdev; /* Device number, if device. */
60 __off_t st_size; /* Size of file, in bytes. */
61 #ifdef __USE_XOPEN2K8
62 /* Nanosecond resolution timestamps are stored in a format
63 equivalent to 'struct timespec'. This is the type used
64 whenever possible but the Unix namespace rules do not allow the
65 identifier 'timespec' to appear in the <sys/stat.h> header.
66 Therefore we have to handle the use of this header in strictly
67 standard-compliant sources special. */
68 struct timespec st_atim; /* Time of last access. */
69 struct timespec st_mtim; /* Time of last modification. */
70 struct timespec st_ctim; /* Time of last status change. */
71 # define st_atime st_atim.tv_sec /* Backward compatibility. */
72 # define st_mtime st_mtim.tv_sec
73 # define st_ctime st_ctim.tv_sec
74 #else
75 __time_t st_atime; /* Time of last access. */
76 unsigned long int st_atimensec; /* Nscecs of last access. */
77 __time_t st_mtime; /* Time of last modification. */
78 unsigned long int st_mtimensec; /* Nsecs of last modification. */
79 __time_t st_ctime; /* Time of last status change. */
80 unsigned long int st_ctimensec; /* Nsecs of last status change. */
81 #endif
82 __blksize_t st_blksize; /* Optimal block size for I/O. */
83 __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
84 long int __glibc_reserved[3];
86 #else
87 struct stat
89 __dev_t st_dev; /* Device. */
90 unsigned int __pad1;
91 # ifndef __USE_FILE_OFFSET64
92 __ino_t st_ino; /* File serial number. */
93 # else
94 __ino_t __st_ino; /* 32bit file serial number. */
95 # endif
96 __mode_t st_mode; /* File mode. */
97 __nlink_t st_nlink; /* Link count. */
98 __uid_t st_uid; /* User ID of the file's owner. */
99 __gid_t st_gid; /* Group ID of the file's group.*/
100 __dev_t st_rdev; /* Device number, if device. */
101 unsigned int __pad2;
102 # ifndef __USE_FILE_OFFSET64
103 __off_t st_size; /* Size of file, in bytes. */
104 # else
105 __off64_t st_size; /* Size of file, in bytes. */
106 # endif
107 __blksize_t st_blksize; /* Optimal block size for I/O. */
109 # ifndef __USE_FILE_OFFSET64
110 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
111 # else
112 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
113 # endif
114 # ifdef __USE_XOPEN2K8
115 /* Nanosecond resolution timestamps are stored in a format
116 equivalent to 'struct timespec'. This is the type used
117 whenever possible but the Unix namespace rules do not allow the
118 identifier 'timespec' to appear in the <sys/stat.h> header.
119 Therefore we have to handle the use of this header in strictly
120 standard-compliant sources special. */
121 struct timespec st_atim; /* Time of last access. */
122 struct timespec st_mtim; /* Time of last modification. */
123 struct timespec st_ctim; /* Time of last status change. */
124 # define st_atime st_atim.tv_sec /* Backward compatibility. */
125 # define st_mtime st_mtim.tv_sec
126 # define st_ctime st_ctim.tv_sec
127 # else
128 __time_t st_atime; /* Time of last access. */
129 unsigned long int st_atimensec; /* Nscecs of last access. */
130 __time_t st_mtime; /* Time of last modification. */
131 unsigned long int st_mtimensec; /* Nsecs of last modification. */
132 __time_t st_ctime; /* Time of last status change. */
133 unsigned long int st_ctimensec; /* Nsecs of last status change. */
134 # endif
135 # ifndef __USE_FILE_OFFSET64
136 unsigned long int __glibc_reserved4;
137 unsigned long int __glibc_reserved5;
138 # else
139 __ino64_t st_ino; /* File serial number. */
140 # endif
142 #endif
144 #ifdef __USE_LARGEFILE64
145 # if __WORDSIZE == 64
146 /* Note stat64 is the same shape as stat. */
147 struct stat64
149 __dev_t st_dev; /* Device. */
150 __ino64_t st_ino; /* File serial number. */
151 __nlink_t st_nlink; /* Link count. */
152 __mode_t st_mode; /* File mode. */
153 __uid_t st_uid; /* User ID of the file's owner. */
154 __gid_t st_gid; /* Group ID of the file's group.*/
155 int __glibc_reserved0;
156 __dev_t st_rdev; /* Device number, if device. */
157 __off_t st_size; /* Size of file, in bytes. */
158 # ifdef __USE_XOPEN2K8
159 /* Nanosecond resolution timestamps are stored in a format
160 equivalent to 'struct timespec'. This is the type used
161 whenever possible but the Unix namespace rules do not allow the
162 identifier 'timespec' to appear in the <sys/stat.h> header.
163 Therefore we have to handle the use of this header in strictly
164 standard-compliant sources special. */
165 struct timespec st_atim; /* Time of last access. */
166 struct timespec st_mtim; /* Time of last modification. */
167 struct timespec st_ctim; /* Time of last status change. */
168 # define st_atime st_atim.tv_sec /* Backward compatibility. */
169 # define st_mtime st_mtim.tv_sec
170 # define st_ctime st_ctim.tv_sec
171 # else
172 __time_t st_atime; /* Time of last access. */
173 unsigned long int st_atimensec; /* Nscecs of last access. */
174 __time_t st_mtime; /* Time of last modification. */
175 unsigned long int st_mtimensec; /* Nsecs of last modification. */
176 __time_t st_ctime; /* Time of last status change. */
177 unsigned long int st_ctimensec; /* Nsecs of last status change. */
178 # endif
179 __blksize_t st_blksize; /* Optimal block size for I/O. */
180 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
181 long int __glibc_reserved[3];
183 # else
184 struct stat64
186 __dev_t st_dev; /* Device. */
187 unsigned int __pad1;
189 __ino_t __st_ino; /* 32bit file serial number. */
190 __mode_t st_mode; /* File mode. */
191 __nlink_t st_nlink; /* Link count. */
192 __uid_t st_uid; /* User ID of the file's owner. */
193 __gid_t st_gid; /* Group ID of the file's group.*/
194 __dev_t st_rdev; /* Device number, if device. */
195 unsigned int __pad2;
196 __off64_t st_size; /* Size of file, in bytes. */
197 __blksize_t st_blksize; /* Optimal block size for I/O. */
199 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
200 # ifdef __USE_XOPEN2K8
201 /* Nanosecond resolution timestamps are stored in a format
202 equivalent to 'struct timespec'. This is the type used
203 whenever possible but the Unix namespace rules do not allow the
204 identifier 'timespec' to appear in the <sys/stat.h> header.
205 Therefore we have to handle the use of this header in strictly
206 standard-compliant sources special. */
207 struct timespec st_atim; /* Time of last access. */
208 struct timespec st_mtim; /* Time of last modification. */
209 struct timespec st_ctim; /* Time of last status change. */
210 # define st_atime st_atim.tv_sec /* Backward compatibility. */
211 # define st_mtime st_mtim.tv_sec
212 # define st_ctime st_ctim.tv_sec
213 # else
214 __time_t st_atime; /* Time of last access. */
215 unsigned long int st_atimensec; /* Nscecs of last access. */
216 __time_t st_mtime; /* Time of last modification. */
217 unsigned long int st_mtimensec; /* Nsecs of last modification. */
218 __time_t st_ctime; /* Time of last status change. */
219 unsigned long int st_ctimensec; /* Nsecs of last status change. */
220 # endif
221 __ino64_t st_ino; /* File serial number. */
223 # endif
224 #endif
226 /* Tell code we have these members. */
227 #define _STATBUF_ST_BLKSIZE
228 #define _STATBUF_ST_RDEV
229 /* Nanosecond resolution time values are supported. */
230 #define _STATBUF_ST_NSEC
232 /* Encoding of the file mode. */
234 #define __S_IFMT 0170000 /* These bits determine file type. */
236 /* File types. */
237 #define __S_IFDIR 0040000 /* Directory. */
238 #define __S_IFCHR 0020000 /* Character device. */
239 #define __S_IFBLK 0060000 /* Block device. */
240 #define __S_IFREG 0100000 /* Regular file. */
241 #define __S_IFIFO 0010000 /* FIFO. */
242 #define __S_IFLNK 0120000 /* Symbolic link. */
243 #define __S_IFSOCK 0140000 /* Socket. */
245 /* POSIX.1b objects. Note that these macros always evaluate to zero. But
246 they do it by enforcing the correct use of the macros. */
247 #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
248 #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
249 #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
251 /* Protection bits. */
253 #define __S_ISUID 04000 /* Set user ID on execution. */
254 #define __S_ISGID 02000 /* Set group ID on execution. */
255 #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
256 #define __S_IREAD 0400 /* Read by owner. */
257 #define __S_IWRITE 0200 /* Write by owner. */
258 #define __S_IEXEC 0100 /* Execute by owner. */
260 #ifdef __USE_ATFILE
261 # define UTIME_NOW ((1l << 30) - 1l)
262 # define UTIME_OMIT ((1l << 30) - 2l)
263 #endif
265 #endif /* bits/stat.h */