]>
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 | |
25 | ||
26 | #include <bits/endian.h> | |
27 | #include <bits/wordsize.h> | |
64c1f3af | 28 | |
56ddf355 UD |
29 | struct stat |
30 | { | |
31 | __dev_t st_dev; /* Device. */ | |
32 | #if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 | |
33 | unsigned short int __pad1; | |
34 | __ino_t st_ino; /* File serial number. */ | |
35 | #else | |
36 | __ino64_t st_ino; /* File serial number. */ | |
37 | #endif | |
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. */ | |
43 | unsigned short int __pad2; | |
44 | #ifndef __USE_FILE_OFFSET64 | |
45 | __off_t st_size; /* Size of file, in bytes. */ | |
46 | #else | |
47 | __off64_t st_size; /* Size of file, in bytes. */ | |
48 | #endif | |
49 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
50 | ||
51 | #ifndef __USE_FILE_OFFSET64 | |
52 | __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ | |
53 | #else | |
54 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
55 | #endif | |
acd7f096 | 56 | #ifdef __USE_XOPEN2K8 |
d5f001d4 AJ |
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. */ | |
49783c67 UD |
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 | |
d5f001d4 AJ |
70 | __time_t st_atime; /* Time of last access. */ |
71 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
72 | __time_t st_mtime; /* Time of last modification. */ | |
73 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
74 | __time_t st_ctime; /* Time of last status change. */ | |
75 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
d5f001d4 | 76 | #endif |
d1d9eaf4 OB |
77 | unsigned long int __glibc_reserved4; |
78 | unsigned long int __glibc_reserved5; | |
56ddf355 UD |
79 | }; |
80 | ||
81 | #ifdef __USE_LARGEFILE64 | |
82 | struct stat64 | |
83 | { | |
84 | __dev_t st_dev; /* Device. */ | |
e3611aef | 85 | # if __WORDSIZE == 64 |
56ddf355 | 86 | unsigned short int __pad1; |
e3611aef | 87 | # endif |
56ddf355 UD |
88 | __ino64_t st_ino; /* File serial number. */ |
89 | __mode_t st_mode; /* File mode. */ | |
90 | __nlink_t st_nlink; /* Link count. */ | |
91 | __uid_t st_uid; /* User ID of the file's owner. */ | |
92 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
93 | __dev_t st_rdev; /* Device number, if device. */ | |
94 | unsigned short int __pad2; | |
95 | __off64_t st_size; /* Size of file, in bytes. */ | |
96 | __blksize_t st_blksize; /* Optimal block size for I/O. */ | |
97 | ||
98 | __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
acd7f096 | 99 | # ifdef __USE_XOPEN2K8 |
d5f001d4 AJ |
100 | /* Nanosecond resolution timestamps are stored in a format |
101 | equivalent to 'struct timespec'. This is the type used | |
102 | whenever possible but the Unix namespace rules do not allow the | |
103 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
104 | Therefore we have to handle the use of this header in strictly | |
105 | standard-compliant sources special. */ | |
106 | struct timespec st_atim; /* Time of last access. */ | |
107 | struct timespec st_mtim; /* Time of last modification. */ | |
108 | struct timespec st_ctim; /* Time of last status change. */ | |
e3611aef AS |
109 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ |
110 | # define st_mtime st_mtim.tv_sec | |
111 | # define st_ctime st_ctim.tv_sec | |
112 | # else | |
d5f001d4 AJ |
113 | __time_t st_atime; /* Time of last access. */ |
114 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
115 | __time_t st_mtime; /* Time of last modification. */ | |
116 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
117 | __time_t st_ctime; /* Time of last status change. */ | |
118 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
e3611aef | 119 | # endif |
d1d9eaf4 OB |
120 | unsigned long int __glibc_reserved4; |
121 | unsigned long int __glibc_reserved5; | |
56ddf355 UD |
122 | }; |
123 | #endif | |
124 | ||
125 | /* Tell code we have these members. */ | |
126 | #define _STATBUF_ST_BLKSIZE | |
127 | #define _STATBUF_ST_RDEV | |
752c83a2 UD |
128 | /* Nanosecond resolution time values are supported. */ |
129 | #define _STATBUF_ST_NSEC | |
56ddf355 | 130 | |
d8927238 | 131 | #endif /* _BITS_STRUCT_STAT_H */ |