]>
Commit | Line | Data |
---|---|---|
d8927238 | 1 | /* Definition for struct stat. |
6d7e8eda | 2 | Copyright (C) 2020-2023 Free Software Foundation, Inc. |
77569014 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 | |
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. | |
77569014 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 | |
3214b89b | 13 | Lesser General Public License for more details. |
77569014 | 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/>. */ |
77569014 | 18 | |
54faff05 | 19 | #if !defined _SYS_STAT_H && !defined _FCNTL_H |
d8927238 | 20 | # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead." |
90571408 | 21 | #endif |
77569014 | 22 | |
d8927238 AZ |
23 | #ifndef _BITS_STRUCT_STAT_H |
24 | #define _BITS_STRUCT_STAT_H 1 | |
aa576322 | 25 | |
77569014 UD |
26 | struct stat |
27 | { | |
28 | __dev_t st_dev; /* Device. */ | |
def4a5f0 UD |
29 | #ifdef __USE_FILE_OFFSET64 |
30 | __ino64_t st_ino; /* File serial number. */ | |
31 | #else | |
77569014 | 32 | __ino_t st_ino; /* File serial number. */ |
b4d2a423 | 33 | int __pad0; /* 64-bit st_ino. */ |
def4a5f0 | 34 | #endif |
77569014 UD |
35 | __dev_t st_rdev; /* Device number, if device. */ |
36 | __off_t st_size; /* Size of file, in bytes. */ | |
def4a5f0 UD |
37 | #ifdef __USE_FILE_OFFSET64 |
38 | __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ | |
39 | #else | |
40 | __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ | |
b4d2a423 | 41 | int __pad1; /* 64-bit st_blocks. */ |
def4a5f0 | 42 | #endif |
b4d2a423 RH |
43 | __mode_t st_mode; /* File mode. */ |
44 | __uid_t st_uid; /* User ID of the file's owner. */ | |
45 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
69967934 | 46 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
b4d2a423 RH |
47 | __nlink_t st_nlink; /* Link count. */ |
48 | int __pad2; /* Real padding. */ | |
d5520585 MT |
49 | #ifdef __USE_XOPEN2K8 |
50 | /* Nanosecond resolution timestamps are stored in a format | |
51 | equivalent to 'struct timespec'. This is the type used | |
52 | whenever possible but the Unix namespace rules do not allow the | |
53 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
54 | Therefore we have to handle the use of this header in strictly | |
55 | standard-compliant sources special. */ | |
56 | struct timespec st_atim; /* Time of last access. */ | |
57 | struct timespec st_mtim; /* Time of last modification. */ | |
58 | struct timespec st_ctim; /* Time of last status change. */ | |
59 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
60 | # define st_mtime st_mtim.tv_sec | |
61 | # define st_ctime st_ctim.tv_sec | |
62 | #else | |
63 | __time_t st_atime; /* Time of last access. */ | |
64 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
65 | __time_t st_mtime; /* Time of last modification. */ | |
66 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
67 | __time_t st_ctime; /* Time of last status change. */ | |
68 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
69 | #endif | |
d1d9eaf4 | 70 | long __glibc_reserved[3]; |
77569014 UD |
71 | }; |
72 | ||
def4a5f0 UD |
73 | #ifdef __USE_LARGEFILE64 |
74 | /* Note stat64 is the same shape as stat. */ | |
75 | struct stat64 | |
76 | { | |
77 | __dev_t st_dev; /* Device. */ | |
78 | __ino64_t st_ino; /* File serial number. */ | |
def4a5f0 UD |
79 | __dev_t st_rdev; /* Device number, if device. */ |
80 | __off_t st_size; /* Size of file, in bytes. */ | |
def4a5f0 | 81 | __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ |
b4d2a423 RH |
82 | __mode_t st_mode; /* File mode. */ |
83 | __uid_t st_uid; /* User ID of the file's owner. */ | |
84 | __gid_t st_gid; /* Group ID of the file's group.*/ | |
69967934 | 85 | __blksize_t st_blksize; /* Optimal block size for I/O. */ |
b4d2a423 RH |
86 | __nlink_t st_nlink; /* Link count. */ |
87 | int __pad0; /* Real padding. */ | |
d5520585 MT |
88 | #ifdef __USE_XOPEN2K8 |
89 | /* Nanosecond resolution timestamps are stored in a format | |
90 | equivalent to 'struct timespec'. This is the type used | |
91 | whenever possible but the Unix namespace rules do not allow the | |
92 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
93 | Therefore we have to handle the use of this header in strictly | |
94 | standard-compliant sources special. */ | |
95 | struct timespec st_atim; /* Time of last access. */ | |
96 | struct timespec st_mtim; /* Time of last modification. */ | |
97 | struct timespec st_ctim; /* Time of last status change. */ | |
98 | # define st_atime st_atim.tv_sec /* Backward compatibility. */ | |
99 | # define st_mtime st_mtim.tv_sec | |
100 | # define st_ctime st_ctim.tv_sec | |
101 | #else | |
102 | __time_t st_atime; /* Time of last access. */ | |
103 | unsigned long int st_atimensec; /* Nscecs of last access. */ | |
104 | __time_t st_mtime; /* Time of last modification. */ | |
105 | unsigned long int st_mtimensec; /* Nsecs of last modification. */ | |
106 | __time_t st_ctime; /* Time of last status change. */ | |
107 | unsigned long int st_ctimensec; /* Nsecs of last status change. */ | |
108 | #endif | |
d1d9eaf4 | 109 | long __glibc_reserved[3]; |
def4a5f0 UD |
110 | }; |
111 | #endif | |
112 | ||
649d6c33 UD |
113 | /* Tell code we have these members. */ |
114 | #define _STATBUF_ST_BLKSIZE | |
115 | #define _STATBUF_ST_RDEV | |
b4d2a423 | 116 | #define _STATBUF_ST_NSEC |
def4a5f0 | 117 | |
77569014 | 118 | |
d8927238 | 119 | #endif /* _BITS_STRUCT_STAT_H */ |