]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/mips/bits/struct_stat.h
5abd71fc2398d633b07694afbd7038ebb8117a9b
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / mips / bits / struct_stat.h
1 /* Definition for struct stat.
2 Copyright (C) 2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19 #if !defined _SYS_STAT_H && !defined _FCNTL_H
20 # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
21 #endif
22
23 #ifndef _BITS_STRUCT_STAT_H
24 #define _BITS_STRUCT_STAT_H 1
25
26 #include <sgidefs.h>
27
28 #if _MIPS_SIM == _ABIO32
29 /* Structure describing file characteristics. */
30 struct stat
31 {
32 unsigned long int st_dev;
33 long int st_pad1[3];
34 #ifndef __USE_FILE_OFFSET64
35 __ino_t st_ino; /* File serial number. */
36 #else
37 __ino64_t st_ino; /* File serial number. */
38 #endif
39 __mode_t st_mode; /* File mode. */
40 __nlink_t st_nlink; /* Link count. */
41 __uid_t st_uid; /* User ID of the file's owner. */
42 __gid_t st_gid; /* Group ID of the file's group.*/
43 unsigned long int st_rdev; /* Device number, if device. */
44 #ifndef __USE_FILE_OFFSET64
45 long int st_pad2[2];
46 __off_t st_size; /* Size of file, in bytes. */
47 /* SVR4 added this extra long to allow for expansion of off_t. */
48 long int st_pad3;
49 #else
50 long int st_pad2[3];
51 __off64_t st_size; /* Size of file, in bytes. */
52 #endif
53 #ifdef __USE_XOPEN2K8
54 /* Nanosecond resolution timestamps are stored in a format
55 equivalent to 'struct timespec'. This is the type used
56 whenever possible but the Unix namespace rules do not allow the
57 identifier 'timespec' to appear in the <sys/stat.h> header.
58 Therefore we have to handle the use of this header in strictly
59 standard-compliant sources special. */
60 struct timespec st_atim; /* Time of last access. */
61 struct timespec st_mtim; /* Time of last modification. */
62 struct timespec st_ctim; /* Time of last status change. */
63 # define st_atime st_atim.tv_sec /* Backward compatibility. */
64 # define st_mtime st_mtim.tv_sec
65 # define st_ctime st_ctim.tv_sec
66 #else
67 __time_t st_atime; /* Time of last access. */
68 unsigned long int st_atimensec; /* Nscecs of last access. */
69 __time_t st_mtime; /* Time of last modification. */
70 unsigned long int st_mtimensec; /* Nsecs of last modification. */
71 __time_t st_ctime; /* Time of last status change. */
72 unsigned long int st_ctimensec; /* Nsecs of last status change. */
73 #endif
74 __blksize_t st_blksize; /* Optimal block size for I/O. */
75 #ifndef __USE_FILE_OFFSET64
76 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
77 #else
78 long int st_pad4;
79 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
80 #endif
81 long int st_pad5[14];
82 };
83
84 #ifdef __USE_LARGEFILE64
85 struct stat64
86 {
87 unsigned long int st_dev;
88 long int st_pad1[3];
89 __ino64_t st_ino; /* File serial number. */
90 __mode_t st_mode; /* File mode. */
91 __nlink_t st_nlink; /* Link count. */
92 __uid_t st_uid; /* User ID of the file's owner. */
93 __gid_t st_gid; /* Group ID of the file's group.*/
94 unsigned long int st_rdev; /* Device number, if device. */
95 long int st_pad2[3];
96 __off64_t st_size; /* Size of file, in bytes. */
97 # ifdef __USE_XOPEN2K8
98 /* Nanosecond resolution timestamps are stored in a format
99 equivalent to 'struct timespec'. This is the type used
100 whenever possible but the Unix namespace rules do not allow the
101 identifier 'timespec' to appear in the <sys/stat.h> header.
102 Therefore we have to handle the use of this header in strictly
103 standard-compliant sources special. */
104 struct timespec st_atim; /* Time of last access. */
105 struct timespec st_mtim; /* Time of last modification. */
106 struct timespec st_ctim; /* Time of last status change. */
107 # else
108 __time_t st_atime; /* Time of last access. */
109 unsigned long int st_atimensec; /* Nscecs of last access. */
110 __time_t st_mtime; /* Time of last modification. */
111 unsigned long int st_mtimensec; /* Nsecs of last modification. */
112 __time_t st_ctime; /* Time of last status change. */
113 unsigned long int st_ctimensec; /* Nsecs of last status change. */
114 # endif
115 __blksize_t st_blksize; /* Optimal block size for I/O. */
116 long int st_pad3;
117 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
118 long int st_pad4[14];
119 };
120 #endif
121 #else
122 struct stat
123 {
124 __dev_t st_dev;
125 int st_pad1[3]; /* Reserved for st_dev expansion */
126 #ifndef __USE_FILE_OFFSET64
127 __ino_t st_ino;
128 #else
129 __ino64_t st_ino;
130 #endif
131 __mode_t st_mode;
132 __nlink_t st_nlink;
133 __uid_t st_uid;
134 __gid_t st_gid;
135 __dev_t st_rdev;
136 #if !defined __USE_FILE_OFFSET64
137 unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */
138 __off_t st_size;
139 int st_pad3;
140 #else
141 unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
142 __off64_t st_size;
143 #endif
144 #ifdef __USE_XOPEN2K8
145 /* Nanosecond resolution timestamps are stored in a format
146 equivalent to 'struct timespec'. This is the type used
147 whenever possible but the Unix namespace rules do not allow the
148 identifier 'timespec' to appear in the <sys/stat.h> header.
149 Therefore we have to handle the use of this header in strictly
150 standard-compliant sources special. */
151 struct timespec st_atim; /* Time of last access. */
152 struct timespec st_mtim; /* Time of last modification. */
153 struct timespec st_ctim; /* Time of last status change. */
154 # define st_atime st_atim.tv_sec /* Backward compatibility. */
155 # define st_mtime st_mtim.tv_sec
156 # define st_ctime st_ctim.tv_sec
157 #else
158 __time_t st_atime; /* Time of last access. */
159 unsigned long int st_atimensec; /* Nscecs of last access. */
160 __time_t st_mtime; /* Time of last modification. */
161 unsigned long int st_mtimensec; /* Nsecs of last modification. */
162 __time_t st_ctime; /* Time of last status change. */
163 unsigned long int st_ctimensec; /* Nsecs of last status change. */
164 #endif
165 __blksize_t st_blksize;
166 unsigned int st_pad4;
167 #ifndef __USE_FILE_OFFSET64
168 __blkcnt_t st_blocks;
169 #else
170 __blkcnt64_t st_blocks;
171 #endif
172 int st_pad5[14];
173 };
174
175 #ifdef __USE_LARGEFILE64
176 struct stat64
177 {
178 __dev_t st_dev;
179 unsigned int st_pad1[3]; /* Reserved for st_dev expansion */
180 __ino64_t st_ino;
181 __mode_t st_mode;
182 __nlink_t st_nlink;
183 __uid_t st_uid;
184 __gid_t st_gid;
185 __dev_t st_rdev;
186 unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
187 __off64_t st_size;
188 # ifdef __USE_XOPEN2K8
189 /* Nanosecond resolution timestamps are stored in a format
190 equivalent to 'struct timespec'. This is the type used
191 whenever possible but the Unix namespace rules do not allow the
192 identifier 'timespec' to appear in the <sys/stat.h> header.
193 Therefore we have to handle the use of this header in strictly
194 standard-compliant sources special. */
195 struct timespec st_atim; /* Time of last access. */
196 struct timespec st_mtim; /* Time of last modification. */
197 struct timespec st_ctim; /* Time of last status change. */
198 # else
199 __time_t st_atime; /* Time of last access. */
200 unsigned long int st_atimensec; /* Nscecs of last access. */
201 __time_t st_mtime; /* Time of last modification. */
202 unsigned long int st_mtimensec; /* Nsecs of last modification. */
203 __time_t st_ctime; /* Time of last status change. */
204 unsigned long int st_ctimensec; /* Nsecs of last status change. */
205 # endif
206 __blksize_t st_blksize;
207 unsigned int st_pad3;
208 __blkcnt64_t st_blocks;
209 int st_pad4[14];
210 };
211 #endif
212 #endif
213
214 /* Tell code we have these members. */
215 #define _STATBUF_ST_BLKSIZE
216 #define _STATBUF_ST_RDEV
217
218 #endif /* _BITS_STRUCT_STAT_H */