]>
Commit | Line | Data |
---|---|---|
d8927238 | 1 | /* Definition for struct stat. |
2b778ceb | 2 | Copyright (C) 2020-2021 Free Software Foundation, Inc. |
c9cf6dde 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 | |
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 | |
d8927238 | 16 | License along with the GNU C Library. If not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
c9cf6dde | 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." |
c9cf6dde AJ |
21 | #endif |
22 | ||
d8927238 AZ |
23 | #ifndef _BITS_STRUCT_STAT_H |
24 | #define _BITS_STRUCT_STAT_H 1 | |
64c1f3af | 25 | |
c9cf6dde AJ |
26 | struct stat |
27 | { | |
28 | __dev_t st_dev; /* Device. */ | |
d4261567 | 29 | #ifndef __x86_64__ |
76d81302 AJ |
30 | unsigned short int __pad1; |
31 | #endif | |
d4261567 | 32 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 |
c9cf6dde | 33 | __ino_t st_ino; /* File serial number. */ |
76d81302 AJ |
34 | #else |
35 | __ino_t __st_ino; /* 32bit file serial number. */ | |
36 | #endif | |
d4261567 | 37 | #ifndef __x86_64__ |
76d81302 AJ |
38 | __mode_t st_mode; /* File mode. */ |
39 | __nlink_t st_nlink; /* Link count. */ | |
40 | #else | |
c9cf6dde AJ |
41 | __nlink_t st_nlink; /* Link count. */ |
42 | __mode_t st_mode; /* File mode. */ | |
76d81302 | 43 | #endif |
c9cf6dde AJ |
44 | __uid_t st_uid; /* User ID of the file's owner. */ |
45 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
d4261567 | 46 | #ifdef __x86_64__ |
a53d3f82 | 47 | int __pad0; |
76d81302 | 48 | #endif |
c9cf6dde | 49 | __dev_t st_rdev; /* Device number, if device. */ |
d4261567 | 50 | #ifndef __x86_64__ |
76d81302 AJ |
51 | unsigned short int __pad2; |
52 | #endif | |
d4261567 | 53 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 |
76d81302 AJ |
54 | __off_t st_size; /* Size of file, in bytes. */ |
55 | #else | |
56 | __off64_t st_size; /* Size of file, in bytes. */ | |
57 | #endif | |
c9cf6dde | 58 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
d4261567 | 59 | #if defined __x86_64__ || !defined __USE_FILE_OFFSET64 |
76d81302 AJ |
60 | __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ |
61 | #else | |
62 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
63 | #endif | |
acd7f096 | 64 | #ifdef __USE_XOPEN2K8 |
d5f001d4 AJ |
65 | /* Nanosecond resolution timestamps are stored in a format |
66 | equivalent to 'struct timespec'. This is the type used | |
67 | whenever possible but the Unix namespace rules do not allow the | |
68 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
69 | Therefore we have to handle the use of this header in strictly | |
70 | standard-compliant sources special. */ | |
71 | struct timespec st_atim; /* Time of last access. */ | |
72 | struct timespec st_mtim; /* Time of last modification. */ | |
73 | struct timespec st_ctim; /* Time of last status change. */ | |
74 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
75 | # define st_mtime st_mtim.tv_sec | |
76 | # define st_ctime st_ctim.tv_sec | |
77 | #else | |
78 | __time_t st_atime; /* Time of last access. */ | |
d4261567 | 79 | __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ |
d5f001d4 | 80 | __time_t st_mtime; /* Time of last modification. */ |
d4261567 | 81 | __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ |
d5f001d4 | 82 | __time_t st_ctime; /* Time of last status change. */ |
d4261567 | 83 | __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ |
d5f001d4 | 84 | #endif |
d4261567 | 85 | #ifdef __x86_64__ |
d1d9eaf4 | 86 | __syscall_slong_t __glibc_reserved[3]; |
76d81302 AJ |
87 | #else |
88 | # ifndef __USE_FILE_OFFSET64 | |
d1d9eaf4 OB |
89 | unsigned long int __glibc_reserved4; |
90 | unsigned long int __glibc_reserved5; | |
76d81302 AJ |
91 | # else |
92 | __ino64_t st_ino; /* File serial number. */ | |
93 | # endif | |
94 | #endif | |
c9cf6dde AJ |
95 | }; |
96 | ||
97 | #ifdef __USE_LARGEFILE64 | |
76d81302 | 98 | /* Note stat64 has the same shape as stat for x86-64. */ |
c9cf6dde AJ |
99 | struct stat64 |
100 | { | |
101 | __dev_t st_dev; /* Device. */ | |
d4261567 | 102 | # ifdef __x86_64__ |
c9cf6dde AJ |
103 | __ino64_t st_ino; /* File serial number. */ |
104 | __nlink_t st_nlink; /* Link count. */ | |
105 | __mode_t st_mode; /* File mode. */ | |
e3611aef | 106 | # else |
76d81302 AJ |
107 | unsigned int __pad1; |
108 | __ino_t __st_ino; /* 32bit file serial number. */ | |
109 | __mode_t st_mode; /* File mode. */ | |
110 | __nlink_t st_nlink; /* Link count. */ | |
e3611aef | 111 | # endif |
c9cf6dde AJ |
112 | __uid_t st_uid; /* User ID of the file's owner. */ |
113 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
d4261567 | 114 | # ifdef __x86_64__ |
a53d3f82 | 115 | int __pad0; |
c9cf6dde AJ |
116 | __dev_t st_rdev; /* Device number, if device. */ |
117 | __off_t st_size; /* Size of file, in bytes. */ | |
e3611aef | 118 | # else |
76d81302 AJ |
119 | __dev_t st_rdev; /* Device number, if device. */ |
120 | unsigned int __pad2; | |
121 | __off64_t st_size; /* Size of file, in bytes. */ | |
e3611aef | 122 | # endif |
c9cf6dde AJ |
123 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
124 | __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ | |
acd7f096 | 125 | # ifdef __USE_XOPEN2K8 |
d5f001d4 AJ |
126 | /* Nanosecond resolution timestamps are stored in a format |
127 | equivalent to 'struct timespec'. This is the type used | |
128 | whenever possible but the Unix namespace rules do not allow the | |
129 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
130 | Therefore we have to handle the use of this header in strictly | |
131 | standard-compliant sources special. */ | |
132 | struct timespec st_atim; /* Time of last access. */ | |
133 | struct timespec st_mtim; /* Time of last modification. */ | |
134 | struct timespec st_ctim; /* Time of last status change. */ | |
e3611aef | 135 | # else |
d5f001d4 | 136 | __time_t st_atime; /* Time of last access. */ |
d4261567 | 137 | __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ |
d5f001d4 | 138 | __time_t st_mtime; /* Time of last modification. */ |
d4261567 | 139 | __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ |
d5f001d4 | 140 | __time_t st_ctime; /* Time of last status change. */ |
d4261567 | 141 | __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ |
e3611aef | 142 | # endif |
d4261567 | 143 | # ifdef __x86_64__ |
d1d9eaf4 | 144 | __syscall_slong_t __glibc_reserved[3]; |
e3611aef | 145 | # else |
76d81302 | 146 | __ino64_t st_ino; /* File serial number. */ |
e3611aef | 147 | # endif |
c9cf6dde AJ |
148 | }; |
149 | #endif | |
150 | ||
151 | /* Tell code we have these members. */ | |
152 | #define _STATBUF_ST_BLKSIZE | |
153 | #define _STATBUF_ST_RDEV | |
752c83a2 UD |
154 | /* Nanosecond resolution time values are supported. */ |
155 | #define _STATBUF_ST_NSEC | |
c9cf6dde | 156 | |
d8927238 | 157 | #endif /* _BITS_STRUCT_STAT_H */ |