Deleted Added
full compact
stat.h (189817) stat.h (205792)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 18 unchanged lines hidden (view full) ---

27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)stat.h 8.12 (Berkeley) 6/16/95
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 18 unchanged lines hidden (view full) ---

27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)stat.h 8.12 (Berkeley) 6/16/95
35 * $FreeBSD: head/sys/sys/stat.h 189817 2009-03-14 19:11:08Z das $
35 * $FreeBSD: head/sys/sys/stat.h 205792 2010-03-28 13:13:22Z ed $
36 */
37
38#ifndef _SYS_STAT_H_
39#define _SYS_STAT_H_
40
41#include <sys/cdefs.h>
36 */
37
38#ifndef _SYS_STAT_H_
39#define _SYS_STAT_H_
40
41#include <sys/cdefs.h>
42#include <sys/_timespec.h>
42#include <sys/_types.h>
43
44#ifndef _BLKSIZE_T_DECLARED
45typedef __blksize_t blksize_t;
46#define _BLKSIZE_T_DECLARED
47#endif
48
49#ifndef _BLKCNT_T_DECLARED

--- 31 unchanged lines hidden (view full) ---

81#define _NLINK_T_DECLARED
82#endif
83
84#ifndef _OFF_T_DECLARED
85typedef __off_t off_t;
86#define _OFF_T_DECLARED
87#endif
88
43#include <sys/_types.h>
44
45#ifndef _BLKSIZE_T_DECLARED
46typedef __blksize_t blksize_t;
47#define _BLKSIZE_T_DECLARED
48#endif
49
50#ifndef _BLKCNT_T_DECLARED

--- 31 unchanged lines hidden (view full) ---

82#define _NLINK_T_DECLARED
83#endif
84
85#ifndef _OFF_T_DECLARED
86typedef __off_t off_t;
87#define _OFF_T_DECLARED
88#endif
89
89#ifndef _TIME_T_DECLARED
90typedef __time_t time_t;
91#define _TIME_T_DECLARED
92#endif
93
94#ifndef _UID_T_DECLARED
95typedef __uid_t uid_t;
96#define _UID_T_DECLARED
97#endif
98
99#if !defined(_KERNEL) && __BSD_VISIBLE
100/*
90#ifndef _UID_T_DECLARED
91typedef __uid_t uid_t;
92#define _UID_T_DECLARED
93#endif
94
95#if !defined(_KERNEL) && __BSD_VISIBLE
96/*
101 * XXX we need this for struct timespec. We get miscellaneous namespace
102 * pollution with it.
97 * XXX We get miscellaneous namespace pollution with this.
103 */
104#include <sys/time.h>
105#endif
106
98 */
99#include <sys/time.h>
100#endif
101
107#if !__BSD_VISIBLE
108#include <sys/_timespec.h>
109#endif
110
111#if __BSD_VISIBLE
112struct ostat {
113 __uint16_t st_dev; /* inode's device */
114 ino_t st_ino; /* inode's number */
115 mode_t st_mode; /* inode protection mode */
116 nlink_t st_nlink; /* number of hard links */
117 __uint16_t st_uid; /* user ID of the file's owner */
118 __uint16_t st_gid; /* group ID of the file's group */
119 __uint16_t st_rdev; /* device type */
120 __int32_t st_size; /* file size, in bytes */
102#if __BSD_VISIBLE
103struct ostat {
104 __uint16_t st_dev; /* inode's device */
105 ino_t st_ino; /* inode's number */
106 mode_t st_mode; /* inode protection mode */
107 nlink_t st_nlink; /* number of hard links */
108 __uint16_t st_uid; /* user ID of the file's owner */
109 __uint16_t st_gid; /* group ID of the file's group */
110 __uint16_t st_rdev; /* device type */
111 __int32_t st_size; /* file size, in bytes */
121 struct timespec st_atimespec; /* time of last access */
122 struct timespec st_mtimespec; /* time of last data modification */
123 struct timespec st_ctimespec; /* time of last file status change */
112 struct timespec st_atim; /* time of last access */
113 struct timespec st_mtim; /* time of last data modification */
114 struct timespec st_ctim; /* time of last file status change */
124 __int32_t st_blksize; /* optimal blocksize for I/O */
125 __int32_t st_blocks; /* blocks allocated for file */
126 fflags_t st_flags; /* user defined flags for file */
127 __uint32_t st_gen; /* file generation number */
128};
129#endif /* __BSD_VISIBLE */
130
131struct stat {
132 __dev_t st_dev; /* inode's device */
133 ino_t st_ino; /* inode's number */
134 mode_t st_mode; /* inode protection mode */
135 nlink_t st_nlink; /* number of hard links */
136 uid_t st_uid; /* user ID of the file's owner */
137 gid_t st_gid; /* group ID of the file's group */
138 __dev_t st_rdev; /* device type */
115 __int32_t st_blksize; /* optimal blocksize for I/O */
116 __int32_t st_blocks; /* blocks allocated for file */
117 fflags_t st_flags; /* user defined flags for file */
118 __uint32_t st_gen; /* file generation number */
119};
120#endif /* __BSD_VISIBLE */
121
122struct stat {
123 __dev_t st_dev; /* inode's device */
124 ino_t st_ino; /* inode's number */
125 mode_t st_mode; /* inode protection mode */
126 nlink_t st_nlink; /* number of hard links */
127 uid_t st_uid; /* user ID of the file's owner */
128 gid_t st_gid; /* group ID of the file's group */
129 __dev_t st_rdev; /* device type */
139#if __BSD_VISIBLE
140 struct timespec st_atimespec; /* time of last access */
141 struct timespec st_mtimespec; /* time of last data modification */
142 struct timespec st_ctimespec; /* time of last file status change */
143#else
144 time_t st_atime; /* time of last access */
145 long __st_atimensec; /* nsec of last access */
146 time_t st_mtime; /* time of last data modification */
147 long __st_mtimensec; /* nsec of last data modification */
148 time_t st_ctime; /* time of last file status change */
149 long __st_ctimensec; /* nsec of last file status change */
150#endif
130 struct timespec st_atim; /* time of last access */
131 struct timespec st_mtim; /* time of last data modification */
132 struct timespec st_ctim; /* time of last file status change */
151 off_t st_size; /* file size, in bytes */
152 blkcnt_t st_blocks; /* blocks allocated for file */
153 blksize_t st_blksize; /* optimal blocksize for I/O */
154 fflags_t st_flags; /* user defined flags for file */
155 __uint32_t st_gen; /* file generation number */
156 __int32_t st_lspare;
133 off_t st_size; /* file size, in bytes */
134 blkcnt_t st_blocks; /* blocks allocated for file */
135 blksize_t st_blksize; /* optimal blocksize for I/O */
136 fflags_t st_flags; /* user defined flags for file */
137 __uint32_t st_gen; /* file generation number */
138 __int32_t st_lspare;
157#if __BSD_VISIBLE
158 struct timespec st_birthtimespec; /* time of file creation */
139 struct timespec st_birthtim; /* time of file creation */
159 /*
140 /*
160 * Explicitly pad st_birthtimespec to 16 bytes so that the size of
141 * Explicitly pad st_birthtim to 16 bytes so that the size of
161 * struct stat is backwards compatible. We use bitfields instead
162 * of an array of chars so that this doesn't require a C99 compiler
163 * to compile if the size of the padding is 0. We use 2 bitfields
164 * to cover up to 64 bits on 32-bit machines. We assume that
165 * CHAR_BIT is 8...
166 */
167 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
168 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
142 * struct stat is backwards compatible. We use bitfields instead
143 * of an array of chars so that this doesn't require a C99 compiler
144 * to compile if the size of the padding is 0. We use 2 bitfields
145 * to cover up to 64 bits on 32-bit machines. We assume that
146 * CHAR_BIT is 8...
147 */
148 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
149 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
169#else
170 time_t st_birthtime; /* time of file creation */
171 long st_birthtimensec; /* nsec of file creation */
172 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
173 unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
174#endif
175};
176
177#if __BSD_VISIBLE
178struct nstat {
179 __dev_t st_dev; /* inode's device */
180 ino_t st_ino; /* inode's number */
181 __uint32_t st_mode; /* inode protection mode */
182 __uint32_t st_nlink; /* number of hard links */
183 uid_t st_uid; /* user ID of the file's owner */
184 gid_t st_gid; /* group ID of the file's group */
185 __dev_t st_rdev; /* device type */
150};
151
152#if __BSD_VISIBLE
153struct nstat {
154 __dev_t st_dev; /* inode's device */
155 ino_t st_ino; /* inode's number */
156 __uint32_t st_mode; /* inode protection mode */
157 __uint32_t st_nlink; /* number of hard links */
158 uid_t st_uid; /* user ID of the file's owner */
159 gid_t st_gid; /* group ID of the file's group */
160 __dev_t st_rdev; /* device type */
186 struct timespec st_atimespec; /* time of last access */
187 struct timespec st_mtimespec; /* time of last data modification */
188 struct timespec st_ctimespec; /* time of last file status change */
161 struct timespec st_atim; /* time of last access */
162 struct timespec st_mtim; /* time of last data modification */
163 struct timespec st_ctim; /* time of last file status change */
189 off_t st_size; /* file size, in bytes */
190 blkcnt_t st_blocks; /* blocks allocated for file */
191 blksize_t st_blksize; /* optimal blocksize for I/O */
192 fflags_t st_flags; /* user defined flags for file */
193 __uint32_t st_gen; /* file generation number */
164 off_t st_size; /* file size, in bytes */
165 blkcnt_t st_blocks; /* blocks allocated for file */
166 blksize_t st_blksize; /* optimal blocksize for I/O */
167 fflags_t st_flags; /* user defined flags for file */
168 __uint32_t st_gen; /* file generation number */
194 struct timespec st_birthtimespec; /* time of file creation */
169 struct timespec st_birthtim; /* time of file creation */
195 /*
196 * See above about the following padding.
197 */
198 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
199 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
200};
201#endif
202
170 /*
171 * See above about the following padding.
172 */
173 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
174 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
175};
176#endif
177
178#ifndef _KERNEL
179#define st_atime st_atim.tv_sec
180#define st_mtime st_mtim.tv_sec
181#define st_ctime st_ctim.tv_sec
203#if __BSD_VISIBLE
182#if __BSD_VISIBLE
204#define st_atime st_atimespec.tv_sec
205#define st_mtime st_mtimespec.tv_sec
206#define st_ctime st_ctimespec.tv_sec
207#define st_birthtime st_birthtimespec.tv_sec
183#define st_birthtime st_birthtim.tv_sec
208#endif
209
184#endif
185
186/* For compatibility. */
187#if __BSD_VISIBLE
188#define st_atimespec st_atim
189#define st_mtimespec st_mtim
190#define st_ctimespec st_ctim
191#define st_birthtimespec st_birthtim
192#endif
193#endif /* !_KERNEL */
194
210#define S_ISUID 0004000 /* set user id on execution */
211#define S_ISGID 0002000 /* set group id on execution */
212#if __BSD_VISIBLE
213#define S_ISTXT 0001000 /* sticky bit */
214#endif
215
216#define S_IRWXU 0000700 /* RWX mask for owner */
217#define S_IRUSR 0000400 /* R for owner */

--- 132 unchanged lines hidden ---
195#define S_ISUID 0004000 /* set user id on execution */
196#define S_ISGID 0002000 /* set group id on execution */
197#if __BSD_VISIBLE
198#define S_ISTXT 0001000 /* sticky bit */
199#endif
200
201#define S_IRWXU 0000700 /* RWX mask for owner */
202#define S_IRUSR 0000400 /* R for owner */

--- 132 unchanged lines hidden ---