]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/s390/bits/stat.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / s390 / bits / stat.h
CommitLineData
04277e02 1/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
9546f2e2
AJ
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9546f2e2
AJ
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
9546f2e2 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
9546f2e2 17
f095bb72 18#if !defined _SYS_STAT_H && !defined _FCNTL_H
9546f2e2
AJ
19# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
20#endif
21
64c1f3af
UD
22#ifndef _BITS_STAT_H
23#define _BITS_STAT_H 1
24
7bf75551
UD
25#include <bits/wordsize.h>
26
27#if __WORDSIZE == 64
9546f2e2 28/* Versions of the `struct stat' data structure. */
7bf75551
UD
29# define _STAT_VER_KERNEL 0
30# define _STAT_VER_LINUX 1
31# define _STAT_VER _STAT_VER_LINUX
9546f2e2 32
7bf75551
UD
33/* Versions of the `xmknod' interface. */
34#define _MKNOD_VER_LINUX 0
35#else
36/* Versions of the `struct stat' data structure. */
37# define _STAT_VER_LINUX_OLD 1
38# define _STAT_VER_KERNEL 1
39# define _STAT_VER_SVR4 2
40# define _STAT_VER_LINUX 3
41# define _STAT_VER _STAT_VER_LINUX
9546f2e2 42
7bf75551
UD
43/* Versions of the `xmknod' interface. */
44# define _MKNOD_VER_LINUX 1
45# define _MKNOD_VER_SVR4 2
46# define _MKNOD_VER _MKNOD_VER_LINUX
47#endif
9546f2e2 48
7bf75551
UD
49#if __WORDSIZE == 64
50struct stat
51 {
52 __dev_t st_dev; /* Device. */
53 __ino_t st_ino; /* File serial number. */
54 __nlink_t st_nlink; /* Link count. */
55 __mode_t st_mode; /* File mode. */
56 __uid_t st_uid; /* User ID of the file's owner. */
57 __gid_t st_gid; /* Group ID of the file's group.*/
50936127 58 int __glibc_reserved0;
7bf75551
UD
59 __dev_t st_rdev; /* Device number, if device. */
60 __off_t st_size; /* Size of file, in bytes. */
acd7f096 61#ifdef __USE_XOPEN2K8
d5f001d4
AJ
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
7bf75551
UD
82 __blksize_t st_blksize; /* Optimal block size for I/O. */
83 __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
d1d9eaf4 84 long int __glibc_reserved[3];
7bf75551
UD
85 };
86#else
9546f2e2
AJ
87struct stat
88 {
89 __dev_t st_dev; /* Device. */
90 unsigned int __pad1;
7bf75551 91# ifndef __USE_FILE_OFFSET64
9546f2e2 92 __ino_t st_ino; /* File serial number. */
7bf75551 93# else
9546f2e2 94 __ino_t __st_ino; /* 32bit file serial number. */
7bf75551 95# endif
9546f2e2
AJ
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 unsigned int __pad2;
7bf75551 102# ifndef __USE_FILE_OFFSET64
9546f2e2 103 __off_t st_size; /* Size of file, in bytes. */
7bf75551 104# else
9546f2e2 105 __off64_t st_size; /* Size of file, in bytes. */
7bf75551 106# endif
9546f2e2
AJ
107 __blksize_t st_blksize; /* Optimal block size for I/O. */
108
7bf75551 109# ifndef __USE_FILE_OFFSET64
9546f2e2 110 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
7bf75551 111# else
9546f2e2 112 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
7bf75551 113# endif
acd7f096 114# ifdef __USE_XOPEN2K8
d5f001d4
AJ
115 /* Nanosecond resolution timestamps are stored in a format
116 equivalent to 'struct timespec'. This is the type used
117 whenever possible but the Unix namespace rules do not allow the
118 identifier 'timespec' to appear in the <sys/stat.h> header.
119 Therefore we have to handle the use of this header in strictly
120 standard-compliant sources special. */
121 struct timespec st_atim; /* Time of last access. */
122 struct timespec st_mtim; /* Time of last modification. */
123 struct timespec st_ctim; /* Time of last status change. */
e3611aef
AS
124# define st_atime st_atim.tv_sec /* Backward compatibility. */
125# define st_mtime st_mtim.tv_sec
126# define st_ctime st_ctim.tv_sec
127# else
9546f2e2 128 __time_t st_atime; /* Time of last access. */
d5f001d4 129 unsigned long int st_atimensec; /* Nscecs of last access. */
9546f2e2 130 __time_t st_mtime; /* Time of last modification. */
d5f001d4 131 unsigned long int st_mtimensec; /* Nsecs of last modification. */
9546f2e2 132 __time_t st_ctime; /* Time of last status change. */
d5f001d4 133 unsigned long int st_ctimensec; /* Nsecs of last status change. */
e3611aef 134# endif
7bf75551 135# ifndef __USE_FILE_OFFSET64
d1d9eaf4
OB
136 unsigned long int __glibc_reserved4;
137 unsigned long int __glibc_reserved5;
7bf75551 138# else
9546f2e2 139 __ino64_t st_ino; /* File serial number. */
7bf75551 140# endif
9546f2e2 141 };
7bf75551 142#endif
9546f2e2
AJ
143
144#ifdef __USE_LARGEFILE64
7bf75551
UD
145# if __WORDSIZE == 64
146/* Note stat64 is the same shape as stat. */
147struct stat64
148 {
149 __dev_t st_dev; /* Device. */
150 __ino64_t st_ino; /* File serial number. */
151 __nlink_t st_nlink; /* Link count. */
152 __mode_t st_mode; /* File mode. */
153 __uid_t st_uid; /* User ID of the file's owner. */
154 __gid_t st_gid; /* Group ID of the file's group.*/
50936127 155 int __glibc_reserved0;
7bf75551
UD
156 __dev_t st_rdev; /* Device number, if device. */
157 __off_t st_size; /* Size of file, in bytes. */
acd7f096 158# ifdef __USE_XOPEN2K8
d5f001d4
AJ
159 /* Nanosecond resolution timestamps are stored in a format
160 equivalent to 'struct timespec'. This is the type used
161 whenever possible but the Unix namespace rules do not allow the
162 identifier 'timespec' to appear in the <sys/stat.h> header.
163 Therefore we have to handle the use of this header in strictly
164 standard-compliant sources special. */
165 struct timespec st_atim; /* Time of last access. */
166 struct timespec st_mtim; /* Time of last modification. */
167 struct timespec st_ctim; /* Time of last status change. */
e3611aef
AS
168# define st_atime st_atim.tv_sec /* Backward compatibility. */
169# define st_mtime st_mtim.tv_sec
170# define st_ctime st_ctim.tv_sec
171# else
d5f001d4
AJ
172 __time_t st_atime; /* Time of last access. */
173 unsigned long int st_atimensec; /* Nscecs of last access. */
174 __time_t st_mtime; /* Time of last modification. */
175 unsigned long int st_mtimensec; /* Nsecs of last modification. */
176 __time_t st_ctime; /* Time of last status change. */
177 unsigned long int st_ctimensec; /* Nsecs of last status change. */
e3611aef 178# endif
7bf75551
UD
179 __blksize_t st_blksize; /* Optimal block size for I/O. */
180 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
d1d9eaf4 181 long int __glibc_reserved[3];
7bf75551
UD
182 };
183# else
9546f2e2
AJ
184struct stat64
185 {
186 __dev_t st_dev; /* Device. */
187 unsigned int __pad1;
188
189 __ino_t __st_ino; /* 32bit file serial number. */
190 __mode_t st_mode; /* File mode. */
191 __nlink_t st_nlink; /* Link count. */
192 __uid_t st_uid; /* User ID of the file's owner. */
193 __gid_t st_gid; /* Group ID of the file's group.*/
194 __dev_t st_rdev; /* Device number, if device. */
195 unsigned int __pad2;
196 __off64_t st_size; /* Size of file, in bytes. */
197 __blksize_t st_blksize; /* Optimal block size for I/O. */
198
199 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
acd7f096 200# ifdef __USE_XOPEN2K8
d5f001d4
AJ
201 /* Nanosecond resolution timestamps are stored in a format
202 equivalent to 'struct timespec'. This is the type used
203 whenever possible but the Unix namespace rules do not allow the
204 identifier 'timespec' to appear in the <sys/stat.h> header.
205 Therefore we have to handle the use of this header in strictly
206 standard-compliant sources special. */
207 struct timespec st_atim; /* Time of last access. */
208 struct timespec st_mtim; /* Time of last modification. */
209 struct timespec st_ctim; /* Time of last status change. */
e3611aef
AS
210# define st_atime st_atim.tv_sec /* Backward compatibility. */
211# define st_mtime st_mtim.tv_sec
212# define st_ctime st_ctim.tv_sec
213# else
9546f2e2 214 __time_t st_atime; /* Time of last access. */
d5f001d4 215 unsigned long int st_atimensec; /* Nscecs of last access. */
9546f2e2 216 __time_t st_mtime; /* Time of last modification. */
d5f001d4 217 unsigned long int st_mtimensec; /* Nsecs of last modification. */
9546f2e2 218 __time_t st_ctime; /* Time of last status change. */
d5f001d4 219 unsigned long int st_ctimensec; /* Nsecs of last status change. */
e3611aef 220# endif
9546f2e2
AJ
221 __ino64_t st_ino; /* File serial number. */
222 };
7bf75551 223# endif
9546f2e2
AJ
224#endif
225
226/* Tell code we have these members. */
227#define _STATBUF_ST_BLKSIZE
228#define _STATBUF_ST_RDEV
752c83a2
UD
229/* Nanosecond resolution time values are supported. */
230#define _STATBUF_ST_NSEC
9546f2e2
AJ
231
232/* Encoding of the file mode. */
233
234#define __S_IFMT 0170000 /* These bits determine file type. */
235
236/* File types. */
237#define __S_IFDIR 0040000 /* Directory. */
238#define __S_IFCHR 0020000 /* Character device. */
239#define __S_IFBLK 0060000 /* Block device. */
240#define __S_IFREG 0100000 /* Regular file. */
241#define __S_IFIFO 0010000 /* FIFO. */
242#define __S_IFLNK 0120000 /* Symbolic link. */
243#define __S_IFSOCK 0140000 /* Socket. */
244
368cfb94
UD
245/* POSIX.1b objects. Note that these macros always evaluate to zero. But
246 they do it by enforcing the correct use of the macros. */
247#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
248#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
249#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
9546f2e2
AJ
250
251/* Protection bits. */
252
253#define __S_ISUID 04000 /* Set user ID on execution. */
254#define __S_ISGID 02000 /* Set group ID on execution. */
255#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
256#define __S_IREAD 0400 /* Read by owner. */
257#define __S_IWRITE 0200 /* Write by owner. */
258#define __S_IEXEC 0100 /* Execute by owner. */
c27d2078 259
3e6b0a28 260#ifdef __USE_ATFILE
c27d2078
UD
261# define UTIME_NOW ((1l << 30) - 1l)
262# define UTIME_OMIT ((1l << 30) - 2l)
263#endif
64c1f3af
UD
264
265#endif /* bits/stat.h */