Warning: This file is not a C or C++ file. It does not have highlighting.

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

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of glibc/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h