]> git.ipfire.org Git - thirdparty/glibc.git/blob - ports/sysdeps/unix/sysv/linux/mips/bits/stat.h
becb4282ce16cf37b44ada356570e60bf0bf0ea1
[thirdparty/glibc.git] / ports / sysdeps / unix / sysv / linux / mips / bits / stat.h
1 /* Copyright (C) 1992-2013 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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/>. */
17
18 #if !defined _SYS_STAT_H && !defined _FCNTL_H
19 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
20 #endif
21
22 #ifndef _BITS_STAT_H
23 #define _BITS_STAT_H 1
24
25 #include <sgidefs.h>
26
27 /* Versions of the `struct stat' data structure. */
28 #define _STAT_VER_LINUX_OLD 1
29 #define _STAT_VER_KERNEL 1
30 #define _STAT_VER_SVR4 2
31 #define _STAT_VER_LINUX 3
32 #define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
33
34 /* Versions of the `xmknod' interface. */
35 #define _MKNOD_VER_LINUX 1
36 #define _MKNOD_VER_SVR4 2
37 #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
38
39
40 #if _MIPS_SIM == _ABIO32
41 /* Structure describing file characteristics. */
42 struct stat
43 {
44 unsigned long int st_dev;
45 long int st_pad1[3];
46 #ifndef __USE_FILE_OFFSET64
47 __ino_t st_ino; /* File serial number. */
48 #else
49 __ino64_t st_ino; /* File serial number. */
50 #endif
51 __mode_t st_mode; /* File mode. */
52 __nlink_t st_nlink; /* Link count. */
53 __uid_t st_uid; /* User ID of the file's owner. */
54 __gid_t st_gid; /* Group ID of the file's group.*/
55 unsigned long int st_rdev; /* Device number, if device. */
56 #ifndef __USE_FILE_OFFSET64
57 long int st_pad2[2];
58 __off_t st_size; /* Size of file, in bytes. */
59 /* SVR4 added this extra long to allow for expansion of off_t. */
60 long int st_pad3;
61 #else
62 long int st_pad2[3];
63 __off64_t st_size; /* Size of file, in bytes. */
64 #endif
65 #if defined __USE_MISC || defined __USE_XOPEN2K8
66 /* Nanosecond resolution timestamps are stored in a format
67 equivalent to 'struct timespec'. This is the type used
68 whenever possible but the Unix namespace rules do not allow the
69 identifier 'timespec' to appear in the <sys/stat.h> header.
70 Therefore we have to handle the use of this header in strictly
71 standard-compliant sources special. */
72 struct timespec st_atim; /* Time of last access. */
73 struct timespec st_mtim; /* Time of last modification. */
74 struct timespec st_ctim; /* Time of last status change. */
75 # define st_atime st_atim.tv_sec /* Backward compatibility. */
76 # define st_mtime st_mtim.tv_sec
77 # define st_ctime st_ctim.tv_sec
78 #else
79 __time_t st_atime; /* Time of last access. */
80 unsigned long int st_atimensec; /* Nscecs of last access. */
81 __time_t st_mtime; /* Time of last modification. */
82 unsigned long int st_mtimensec; /* Nsecs of last modification. */
83 __time_t st_ctime; /* Time of last status change. */
84 unsigned long int st_ctimensec; /* Nsecs of last status change. */
85 #endif
86 __blksize_t st_blksize; /* Optimal block size for I/O. */
87 #ifndef __USE_FILE_OFFSET64
88 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
89 #else
90 long int st_pad4;
91 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
92 #endif
93 long int st_pad5[14];
94 };
95
96 #ifdef __USE_LARGEFILE64
97 struct stat64
98 {
99 unsigned long int st_dev;
100 long int st_pad1[3];
101 __ino64_t st_ino; /* File serial number. */
102 __mode_t st_mode; /* File mode. */
103 __nlink_t st_nlink; /* Link count. */
104 __uid_t st_uid; /* User ID of the file's owner. */
105 __gid_t st_gid; /* Group ID of the file's group.*/
106 unsigned long int st_rdev; /* Device number, if device. */
107 long int st_pad2[3];
108 __off64_t st_size; /* Size of file, in bytes. */
109 # if defined __USE_MISC || defined __USE_XOPEN2K8
110 /* Nanosecond resolution timestamps are stored in a format
111 equivalent to 'struct timespec'. This is the type used
112 whenever possible but the Unix namespace rules do not allow the
113 identifier 'timespec' to appear in the <sys/stat.h> header.
114 Therefore we have to handle the use of this header in strictly
115 standard-compliant sources special. */
116 struct timespec st_atim; /* Time of last access. */
117 struct timespec st_mtim; /* Time of last modification. */
118 struct timespec st_ctim; /* Time of last status change. */
119 # else
120 __time_t st_atime; /* Time of last access. */
121 unsigned long int st_atimensec; /* Nscecs of last access. */
122 __time_t st_mtime; /* Time of last modification. */
123 unsigned long int st_mtimensec; /* Nsecs of last modification. */
124 __time_t st_ctime; /* Time of last status change. */
125 unsigned long int st_ctimensec; /* Nsecs of last status change. */
126 # endif
127 __blksize_t st_blksize; /* Optimal block size for I/O. */
128 long int st_pad3;
129 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
130 long int st_pad4[14];
131 };
132 #endif
133 #else
134 struct stat
135 {
136 __dev_t st_dev;
137 int st_pad1[3]; /* Reserved for st_dev expansion */
138 #ifndef __USE_FILE_OFFSET64
139 __ino_t st_ino;
140 #else
141 __ino64_t st_ino;
142 #endif
143 __mode_t st_mode;
144 __nlink_t st_nlink;
145 __uid_t st_uid;
146 __gid_t st_gid;
147 __dev_t st_rdev;
148 #if !defined __USE_FILE_OFFSET64
149 unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */
150 __off_t st_size;
151 int st_pad3;
152 #else
153 unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
154 __off64_t st_size;
155 #endif
156 #if defined __USE_MISC || defined __USE_XOPEN2K8
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;
178 unsigned int st_pad4;
179 #ifndef __USE_FILE_OFFSET64
180 __blkcnt_t st_blocks;
181 #else
182 __blkcnt64_t st_blocks;
183 #endif
184 int st_pad5[14];
185 };
186
187 #ifdef __USE_LARGEFILE64
188 struct stat64
189 {
190 __dev_t st_dev;
191 unsigned int st_pad1[3]; /* Reserved for st_dev expansion */
192 __ino64_t st_ino;
193 __mode_t st_mode;
194 __nlink_t st_nlink;
195 __uid_t st_uid;
196 __gid_t st_gid;
197 __dev_t st_rdev;
198 unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
199 __off64_t st_size;
200 # if defined __USE_MISC || defined __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 # else
211 __time_t st_atime; /* Time of last access. */
212 unsigned long int st_atimensec; /* Nscecs of last access. */
213 __time_t st_mtime; /* Time of last modification. */
214 unsigned long int st_mtimensec; /* Nsecs of last modification. */
215 __time_t st_ctime; /* Time of last status change. */
216 unsigned long int st_ctimensec; /* Nsecs of last status change. */
217 # endif
218 __blksize_t st_blksize;
219 unsigned int st_pad3;
220 __blkcnt64_t st_blocks;
221 int st_pad4[14];
222 };
223 #endif
224 #endif
225
226 /* Tell code we have these members. */
227 #define _STATBUF_ST_BLKSIZE
228 #define _STATBUF_ST_RDEV
229
230 /* Encoding of the file mode. */
231
232 #define __S_IFMT 0170000 /* These bits determine file type. */
233
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. */
242
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)
248
249 /* Protection bits. */
250
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. */
257
258 #ifdef __USE_ATFILE
259 # define UTIME_NOW ((1l << 30) - 1l)
260 # define UTIME_OMIT ((1l << 30) - 2l)
261 #endif
262
263 #endif /* bits/stat.h */