]>
Commit | Line | Data |
---|---|---|
d8927238 | 1 | /* Definition for struct stat. |
dff8da6b | 2 | Copyright (C) 2020-2024 Free Software Foundation, Inc. |
e2d69068 AS |
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 | |
3214b89b 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. | |
e2d69068 AS |
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 | |
3214b89b | 13 | Lesser General Public License for more details. |
e2d69068 | 14 | |
3214b89b | 15 | You should have received a copy of the GNU Lesser General Public |
ab84e3ff | 16 | License along with the GNU C Library. If not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
e2d69068 | 18 | |
2f12146a | 19 | #if !defined _SYS_STAT_H && !defined _FCNTL_H |
d8927238 | 20 | # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead." |
e2d69068 AS |
21 | #endif |
22 | ||
d8927238 AZ |
23 | #ifndef _BITS_STRUCT_STAT_H |
24 | #define _BITS_STRUCT_STAT_H 1 | |
fdefc0e1 | 25 | |
e2d69068 AS |
26 | struct stat |
27 | { | |
a4ed0471 | 28 | #ifdef __USE_TIME64_REDIRECTS |
4e852133 LM |
29 | # include <bits/struct_stat_time64_helper.h> |
30 | #else | |
e2d69068 | 31 | __dev_t st_dev; /* Device. */ |
e2d69068 | 32 | unsigned short int __pad1; |
4e852133 | 33 | # ifndef __USE_FILE_OFFSET64 |
e2d69068 | 34 | __ino_t st_ino; /* File serial number. */ |
4e852133 | 35 | # else |
e2d69068 | 36 | __ino_t __st_ino; /* 32bit file serial number. */ |
4e852133 | 37 | # endif |
e2d69068 AS |
38 | __mode_t st_mode; /* File mode. */ |
39 | __nlink_t st_nlink; /* Link count. */ | |
40 | __uid_t st_uid; /* User ID of the file's owner. */ | |
41 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
42 | __dev_t st_rdev; /* Device number, if device. */ | |
e2d69068 | 43 | unsigned short int __pad2; |
4e852133 | 44 | # ifndef __USE_FILE_OFFSET64 |
e2d69068 | 45 | __off_t st_size; /* Size of file, in bytes. */ |
4e852133 | 46 | # else |
e2d69068 | 47 | __off64_t st_size; /* Size of file, in bytes. */ |
4e852133 | 48 | # endif |
e2d69068 AS |
49 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
50 | ||
4e852133 | 51 | # ifndef __USE_FILE_OFFSET64 |
e2d69068 | 52 | __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ |
4e852133 | 53 | # else |
e2d69068 | 54 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ |
4e852133 LM |
55 | # endif |
56 | # ifdef __USE_XOPEN2K8 | |
2bf8a54e AS |
57 | /* Nanosecond resolution timestamps are stored in a format |
58 | equivalent to 'struct timespec'. This is the type used | |
59 | whenever possible but the Unix namespace rules do not allow the | |
60 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
61 | Therefore we have to handle the use of this header in strictly | |
62 | standard-compliant sources special. */ | |
63 | struct timespec st_atim; /* Time of last access. */ | |
64 | struct timespec st_mtim; /* Time of last modification. */ | |
65 | struct timespec st_ctim; /* Time of last status change. */ | |
4e852133 LM |
66 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ |
67 | # define st_mtime st_mtim.tv_sec | |
68 | # define st_ctime st_ctim.tv_sec | |
69 | # else | |
e2d69068 | 70 | __time_t st_atime; /* Time of last access. */ |
2bf8a54e | 71 | unsigned long int st_atimensec; /* Nscecs of last access. */ |
e2d69068 | 72 | __time_t st_mtime; /* Time of last modification. */ |
2bf8a54e | 73 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ |
e2d69068 | 74 | __time_t st_ctime; /* Time of last status change. */ |
2bf8a54e | 75 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ |
4e852133 LM |
76 | # endif |
77 | # ifndef __USE_FILE_OFFSET64 | |
d1d9eaf4 OB |
78 | unsigned long int __glibc_reserved4; |
79 | unsigned long int __glibc_reserved5; | |
4e852133 | 80 | # else |
e2d69068 | 81 | __ino64_t st_ino; /* File serial number. */ |
4e852133 | 82 | # endif |
a4ed0471 | 83 | #endif /* __USE_TIME64_REDIRECTS */ |
e2d69068 AS |
84 | }; |
85 | ||
86 | #ifdef __USE_LARGEFILE64 | |
87 | struct stat64 | |
88 | { | |
a4ed0471 | 89 | # ifdef __USE_TIME64_REDIRECTS |
4e852133 LM |
90 | # include <bits/struct_stat_time64_helper.h> |
91 | # else | |
e2d69068 | 92 | __dev_t st_dev; /* Device. */ |
79e6a4e0 | 93 | unsigned short int __pad1; |
e2d69068 AS |
94 | |
95 | __ino_t __st_ino; /* 32bit file serial number. */ | |
96 | __mode_t st_mode; /* File mode. */ | |
97 | __nlink_t st_nlink; /* Link count. */ | |
98 | __uid_t st_uid; /* User ID of the file's owner. */ | |
99 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
100 | __dev_t st_rdev; /* Device number, if device. */ | |
79e6a4e0 | 101 | unsigned short int __pad2; |
e2d69068 AS |
102 | __off64_t st_size; /* Size of file, in bytes. */ |
103 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
104 | ||
105 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
4e852133 | 106 | # ifdef __USE_XOPEN2K8 |
2bf8a54e AS |
107 | /* Nanosecond resolution timestamps are stored in a format |
108 | equivalent to 'struct timespec'. This is the type used | |
109 | whenever possible but the Unix namespace rules do not allow the | |
110 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
111 | Therefore we have to handle the use of this header in strictly | |
112 | standard-compliant sources special. */ | |
113 | struct timespec st_atim; /* Time of last access. */ | |
114 | struct timespec st_mtim; /* Time of last modification. */ | |
115 | struct timespec st_ctim; /* Time of last status change. */ | |
4e852133 | 116 | # else |
e2d69068 | 117 | __time_t st_atime; /* Time of last access. */ |
2bf8a54e | 118 | unsigned long int st_atimensec; /* Nscecs of last access. */ |
e2d69068 | 119 | __time_t st_mtime; /* Time of last modification. */ |
2bf8a54e | 120 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ |
e2d69068 | 121 | __time_t st_ctime; /* Time of last status change. */ |
2bf8a54e | 122 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ |
4e852133 | 123 | # endif |
e2d69068 | 124 | __ino64_t st_ino; /* File serial number. */ |
a4ed0471 | 125 | # endif /* __USE_TIME64_REDIRECTS */ |
e2d69068 AS |
126 | }; |
127 | #endif | |
128 | ||
129 | /* Tell code we have these members. */ | |
130 | #define _STATBUF_ST_BLKSIZE | |
131 | #define _STATBUF_ST_RDEV | |
66f558e1 UD |
132 | /* Nanosecond resolution time values are supported. */ |
133 | #define _STATBUF_ST_NSEC | |
e2d69068 | 134 | |
d8927238 | 135 | #endif /* _BITS_STRUCT_STAT_H */ |