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