]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/mips/bits/stat.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / mips / bits / stat.h
CommitLineData
04277e02 1/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
eec226c3
UD
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
3214b89b
AJ
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.
eec226c3
UD
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
3214b89b 12 Lesser General Public License for more details.
eec226c3 13
3214b89b 14 You should have received a copy of the GNU Lesser General Public
ab84e3ff 15 License along with the GNU C Library. If not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
eec226c3 17
60a0880e 18#if !defined _SYS_STAT_H && !defined _FCNTL_H
90571408
UD
19# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
20#endif
eec226c3 21
cbbf2c84
JM
22#ifndef _BITS_STAT_H
23#define _BITS_STAT_H 1
24
24c4c341
AJ
25#include <sgidefs.h>
26
eec226c3
UD
27/* Versions of the `struct stat' data structure. */
28#define _STAT_VER_LINUX_OLD 1
8c082916 29#define _STAT_VER_KERNEL 1
eec226c3
UD
30#define _STAT_VER_SVR4 2
31#define _STAT_VER_LINUX 3
8c082916 32#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
eec226c3
UD
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
8c082916 39
73a227e2 40#if _MIPS_SIM == _ABIO32
eec226c3
UD
41/* Structure describing file characteristics. */
42struct stat
43 {
44 unsigned long int st_dev;
45 long int st_pad1[3];
3abeec50 46#ifndef __USE_FILE_OFFSET64
eec226c3 47 __ino_t st_ino; /* File serial number. */
3abeec50
UD
48#else
49 __ino64_t st_ino; /* File serial number. */
50#endif
eec226c3
UD
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. */
3abeec50 56#ifndef __USE_FILE_OFFSET64
546afa8c 57 long int st_pad2[2];
eec226c3 58 __off_t st_size; /* Size of file, in bytes. */
2489c7f1
AJ
59 /* SVR4 added this extra long to allow for expansion of off_t. */
60 long int st_pad3;
3abeec50 61#else
546afa8c 62 long int st_pad2[3];
3abeec50
UD
63 __off64_t st_size; /* Size of file, in bytes. */
64#endif
acd7f096 65#ifdef __USE_XOPEN2K8
dab75788
DJ
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
dbeb7063
JM
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. */
dab75788 85#endif
69967934 86 __blksize_t st_blksize; /* Optimal block size for I/O. */
3abeec50
UD
87#ifndef __USE_FILE_OFFSET64
88 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
89#else
2489c7f1 90 long int st_pad4;
3abeec50
UD
91 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
92#endif
90d3df73 93 long int st_pad5[14];
eec226c3
UD
94 };
95
3abeec50
UD
96#ifdef __USE_LARGEFILE64
97struct 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. */
546afa8c 107 long int st_pad2[3];
3abeec50 108 __off64_t st_size; /* Size of file, in bytes. */
acd7f096 109# ifdef __USE_XOPEN2K8
dab75788
DJ
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. */
b00ec948 119# else
dbeb7063
JM
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. */
b00ec948 126# endif
69967934 127 __blksize_t st_blksize; /* Optimal block size for I/O. */
2489c7f1 128 long int st_pad3;
3abeec50 129 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
2489c7f1 130 long int st_pad4[14];
3abeec50
UD
131 };
132#endif
e635cc8c
AO
133#else
134struct 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
acd7f096 156#ifdef __USE_XOPEN2K8
dab75788
DJ
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
dbeb7063
JM
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. */
dab75788 176#endif
e635cc8c
AO
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
188struct 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;
acd7f096 200# ifdef __USE_XOPEN2K8
dab75788
DJ
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. */
b00ec948 210# else
dbeb7063
JM
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. */
b00ec948 217# endif
e635cc8c
AO
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
3abeec50 225
649d6c33
UD
226/* Tell code we have these members. */
227#define _STATBUF_ST_BLKSIZE
228#define _STATBUF_ST_RDEV
eec226c3
UD
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. */
eec226c3
UD
240#define __S_IFLNK 0120000 /* Symbolic link. */
241#define __S_IFSOCK 0140000 /* Socket. */
242
5c4a6461
UD
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)
afda9935 248
eec226c3
UD
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. */
8c276674 257
2e3804ef 258#ifdef __USE_ATFILE
8c276674
DJ
259# define UTIME_NOW ((1l << 30) - 1l)
260# define UTIME_OMIT ((1l << 30) - 2l)
261#endif
cbbf2c84
JM
262
263#endif /* bits/stat.h */