]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mach/hurd/bits/stat.h
Use <> for include of kernel-features.h.
[thirdparty/glibc.git] / sysdeps / mach / hurd / bits / stat.h
CommitLineData
f095bb72
UD
1/* Copyright (C) 1992-1994,1996,1997,1999,2000,2005,2010
2 Free Software Foundation, Inc.
54d79e99 3 This file is part of the GNU C Library.
28f540f4 4
54d79e99 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.
28f540f4 9
54d79e99
UD
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.
28f540f4 14
41bdb6e2
AJ
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
28f540f4 19
f095bb72 20#if !defined _SYS_STAT_H && !defined _FCNTL_H
f4017d20
UD
21# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
22#endif
28f540f4 23
64c1f3af
UD
24#ifndef _BITS_STAT_H
25#define _BITS_STAT_H 1
26
5107cf1d 27#include <bits/types.h>
28f540f4
RM
28
29/* NOTE: The size of this structure (32 ints) is known in
30 <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC. MiG
31 does not cope at all well with the passed C structure not being of
32 the expected size. There are some filler words at the end to allow
33 for future expansion. To increase the size of the structure used
34 in the RPC and retain binary compatibility, we would need to assign
35 a new message number. */
36
37struct stat
38 {
39 int st_fstype; /* File system type. */
40 __fsid_t st_fsid; /* File system ID. */
41#define st_dev st_fsid
42
dfd2257a 43#ifndef __USE_FILE_OFFSET64
28f540f4 44 __ino_t st_ino; /* File number. */
dfd2257a
UD
45#else
46 __ino64_t st_ino; /* File number. */
47#endif
28f540f4
RM
48 unsigned int st_gen; /* To detect reuse of file numbers. */
49 __dev_t st_rdev; /* Device if special file. */
50 __mode_t st_mode; /* File mode. */
51 __nlink_t st_nlink; /* Number of links. */
52
53 __uid_t st_uid; /* Owner. */
54 __gid_t st_gid; /* Owning group. */
55
dfd2257a 56#ifndef __USE_FILE_OFFSET64
28f540f4 57 __off_t st_size; /* Size in bytes. */
dfd2257a
UD
58#else
59 __off64_t st_size; /* Size in bytes. */
60#endif
28f540f4
RM
61
62 __time_t st_atime; /* Access time, seconds */
63 unsigned long int st_atime_usec; /* and microseconds. */
64 __time_t st_mtime; /* Modification time, seconds */
65 unsigned long int st_mtime_usec; /* and microseconds. */
66 __time_t st_ctime; /* Status change time, seconds */
67 unsigned long int st_ctime_usec; /* and microseconds. */
68
219aa9e9 69 __blksize_t st_blksize; /* Optimal size for I/O. */
28f540f4 70
dfd2257a
UD
71#ifndef __USE_FILE_OFFSET64
72 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated.
73 Not related to `st_blksize'. */
74#else
75 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
76 Not related to `st_blksize'. */
77#endif
78
79 __uid_t st_author; /* File author. */
80
81 unsigned int st_flags; /* User-defined flags.
82 High 16 bits can be set only by root. */
83
84#ifndef __USE_FILE_OFFSET64
85# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
86#else
87# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
88#endif
89 int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
90#undef _SPARE_SIZE
91 };
92
93#ifdef __USE_LARGEFILE64
94struct stat64
95 {
96 int st_fstype; /* File system type. */
97 __fsid_t st_fsid; /* File system ID. */
98# define st_dev st_fsid
99
100 __ino64_t st_ino; /* File number. */
101 unsigned int st_gen; /* To detect reuse of file numbers. */
102 __dev_t st_rdev; /* Device if special file. */
103 __mode_t st_mode; /* File mode. */
104 __nlink_t st_nlink; /* Number of links. */
105
106 __uid_t st_uid; /* Owner. */
107 __gid_t st_gid; /* Owning group. */
108
109 __off64_t st_size; /* Size in bytes. */
110
111 __time_t st_atime; /* Access time, seconds */
112 unsigned long int st_atime_usec; /* and microseconds. */
113 __time_t st_mtime; /* Modification time, seconds */
114 unsigned long int st_mtime_usec; /* and microseconds. */
115 __time_t st_ctime; /* Status change time, seconds */
116 unsigned long int st_ctime_usec; /* and microseconds. */
28f540f4 117
219aa9e9 118 __blksize_t st_blksize; /* Optimal size for I/O. */
dfd2257a
UD
119
120 __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
28f540f4
RM
121 Not related to `st_blksize'. */
122
123 __uid_t st_author; /* File author. */
124
125 unsigned int st_flags; /* User-defined flags.
126 High 16 bits can be set only by root. */
127
dfd2257a 128#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
5107cf1d
UD
129 int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
130#undef _SPARE_SIZE
28f540f4 131 };
dfd2257a
UD
132#endif
133
134#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
28f540f4
RM
135
136/* Encoding of the file mode. */
137
138#define __S_IFMT 0170000 /* These bits determine file type. */
139
140/* File types. */
141#define __S_IFDIR 0040000 /* Directory. */
142#define __S_IFCHR 0020000 /* Character device. */
143#define __S_IFBLK 0060000 /* Block device. */
144#define __S_IFREG 0100000 /* Regular file. */
145#define __S_IFLNK 0120000 /* Symbolic link. */
146#define __S_IFSOCK 0140000 /* Socket. */
147#define __S_IFIFO 0010000 /* FIFO. */
148
2fcbf75b
UD
149/* POSIX.1b objects. */
150#define __S_TYPEISMQ(buf) (0)
151#define __S_TYPEISSEM(buf) (0)
152#define __S_TYPEISSHM(buf) (0)
153
28f540f4
RM
154/* Protection bits. */
155
156#define __S_ISUID 04000 /* Set user ID on execution. */
157#define __S_ISGID 02000 /* Set group ID on execution. */
158#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
159#define __S_IREAD 00400 /* Read by owner. */
160#define __S_IWRITE 00200 /* Write by owner. */
161#define __S_IEXEC 00100 /* Execute by owner. */
162
163
164#ifdef __USE_GNU
165/* If set, there is no benefit in caching the contents of this file. */
166#define S_INOCACHE 000000200000
167
168/* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below)
169 control access for unknown users. If S_IUSEUNK is clear, then unknown
170 users are treated as "others" for purposes of access control. */
171#define S_IUSEUNK 000000400000
172/* Mask of protection bits for unknown users (no effective IDs at all). */
173#define S_IUNKNOWN 000007000000
174/* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the
175 protection bits for unknown users. */
176#define S_IUNKSHIFT 12
177
ebe3b3eb
TBB
178/* Read only bits: */
179
180/* There is a passive translator set for this file */
181#define S_IPTRANS 000010000000
182/* There is an active translator running on this file */
183#define S_IATRANS 000020000000
184/* This is the root of a filesystem (or single node translator) */
185#define S_IROOT 000040000000
186/* All the bits relevant to translators */
187#define S_ITRANS 000070000000
188
ce306528
RM
189/* Definitely no mmaps to this. */
190#define S_IMMAP0 000100000000
191
ebe3b3eb 192/* ALL the unused bits. */
ce306528 193#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0| \
ebe3b3eb 194 S_IUSEUNK|S_IUNKNOWN|07777))
28f540f4
RM
195#endif
196
197/* Default file creation mask (umask). */
198#ifdef __USE_BSD
64c1f3af 199# define CMASK 0022
28f540f4 200#endif
64c1f3af
UD
201
202#endif /* bits/stat.h */