Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* Definition for struct stat. Linux/csky version. |
---|---|
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/endian.h> |
27 | #include <bits/wordsize.h> |
28 | |
29 | #if defined __USE_FILE_OFFSET64 |
30 | # define __field64(type, type64, name) type64 name |
31 | #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T |
32 | # if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T |
33 | # error "ino_t and off_t must both be the same type" |
34 | # endif |
35 | # define __field64(type, type64, name) type name |
36 | #elif __BYTE_ORDER == __LITTLE_ENDIAN |
37 | # define __field64(type, type64, name) \ |
38 | type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad |
39 | #else |
40 | # define __field64(type, type64, name) \ |
41 | int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name |
42 | #endif |
43 | |
44 | struct stat |
45 | { |
46 | #ifdef __USE_TIME_BITS64 |
47 | # include <bits/struct_stat_time64_helper.h> |
48 | #else |
49 | __dev_t st_dev; /* Device. */ |
50 | __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ |
51 | __mode_t st_mode; /* File mode. */ |
52 | __nlink_t st_nlink; /* Link count. */ |
53 | __uid_t st_uid; /* User ID of the file's owner. */ |
54 | __gid_t st_gid; /* Group ID of the file's group.*/ |
55 | __dev_t st_rdev; /* Device number, if device. */ |
56 | __dev_t __pad1; |
57 | __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ |
58 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
59 | int __pad2; |
60 | __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ |
61 | # ifdef __USE_XOPEN2K8 |
62 | /* Nanosecond resolution timestamps are stored in a format |
63 | equivalent to 'struct timespec'. This is the type used |
64 | whenever possible but the Unix namespace rules do not allow the |
65 | identifier 'timespec' to appear in the <sys/stat.h> header. |
66 | Therefore we have to handle the use of this header in strictly |
67 | standard-compliant sources special. */ |
68 | struct timespec st_atim; /* Time of last access. */ |
69 | struct timespec st_mtim; /* Time of last modification. */ |
70 | struct timespec st_ctim; /* Time of last status change. */ |
71 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ |
72 | # define st_mtime st_mtim.tv_sec |
73 | # define st_ctime st_ctim.tv_sec |
74 | # else |
75 | __time_t st_atime; /* Time of last access. */ |
76 | unsigned long int st_atimensec; /* Nscecs of last access. */ |
77 | __time_t st_mtime; /* Time of last modification. */ |
78 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ |
79 | __time_t st_ctime; /* Time of last status change. */ |
80 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ |
81 | # endif |
82 | int __glibc_reserved[2]; |
83 | #endif |
84 | }; |
85 | |
86 | #undef __field64 |
87 | |
88 | #ifdef __USE_LARGEFILE64 |
89 | struct stat64 |
90 | { |
91 | # ifdef __USE_TIME_BITS64 |
92 | # include <bits/struct_stat_time64_helper.h> |
93 | # else |
94 | __dev_t st_dev; /* Device. */ |
95 | __ino64_t st_ino; /* 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. */ |
101 | __dev_t __pad1; |
102 | __off64_t st_size; /* Size of file, in bytes. */ |
103 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
104 | int __pad2; |
105 | __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ |
106 | # ifdef __USE_XOPEN2K8 |
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. */ |
116 | # else |
117 | __time_t st_atime; /* Time of last access. */ |
118 | unsigned long int st_atimensec; /* Nscecs of last access. */ |
119 | __time_t st_mtime; /* Time of last modification. */ |
120 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ |
121 | __time_t st_ctime; /* Time of last status change. */ |
122 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ |
123 | # endif |
124 | int __glibc_reserved[2]; |
125 | # endif |
126 | }; |
127 | #endif |
128 | |
129 | /* Tell code we have these members. */ |
130 | #define _STATBUF_ST_BLKSIZE |
131 | #define _STATBUF_ST_RDEV |
132 | /* Nanosecond resolution time values are supported. */ |
133 | #define _STATBUF_ST_NSEC |
134 | |
135 | #endif /* _BITS_STRUCT_STAT_H */ |
136 |
Warning: This file is not a C or C++ file. It does not have highlighting.