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