master
  1#ifndef	_SYS_STAT_H
  2#define	_SYS_STAT_H
  3#ifdef __cplusplus
  4extern "C" {
  5#endif
  6
  7#include <features.h>
  8
  9#define __NEED_dev_t
 10#define __NEED_ino_t
 11#define __NEED_mode_t
 12#define __NEED_nlink_t
 13#define __NEED_uid_t
 14#define __NEED_gid_t
 15#define __NEED_off_t
 16#define __NEED_time_t
 17#define __NEED_blksize_t
 18#define __NEED_blkcnt_t
 19#define __NEED_struct_timespec
 20
 21#ifdef _GNU_SOURCE
 22#define __NEED_int64_t
 23#define __NEED_uint64_t
 24#define __NEED_uint32_t
 25#define __NEED_uint16_t
 26#endif
 27
 28#include <bits/alltypes.h>
 29
 30#include <bits/stat.h>
 31
 32#define st_atime st_atim.tv_sec
 33#define st_mtime st_mtim.tv_sec
 34#define st_ctime st_ctim.tv_sec
 35
 36#define S_IFMT  0170000
 37
 38#define S_IFDIR 0040000
 39#define S_IFCHR 0020000
 40#define S_IFBLK 0060000
 41#define S_IFREG 0100000
 42#define S_IFIFO 0010000
 43#define S_IFLNK 0120000
 44#define S_IFSOCK 0140000
 45
 46#define S_TYPEISMQ(buf)  0
 47#define S_TYPEISSEM(buf) 0
 48#define S_TYPEISSHM(buf) 0
 49#define S_TYPEISTMO(buf) 0
 50
 51#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
 52#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
 53#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
 54#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
 55#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
 56#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
 57#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
 58
 59#ifndef S_IRUSR
 60#define S_ISUID 04000
 61#define S_ISGID 02000
 62#define S_ISVTX 01000
 63#define S_IRUSR 0400
 64#define S_IWUSR 0200
 65#define S_IXUSR 0100
 66#define S_IRWXU 0700
 67#define S_IRGRP 0040
 68#define S_IWGRP 0020
 69#define S_IXGRP 0010
 70#define S_IRWXG 0070
 71#define S_IROTH 0004
 72#define S_IWOTH 0002
 73#define S_IXOTH 0001
 74#define S_IRWXO 0007
 75#endif
 76
 77#define UTIME_NOW  0x3fffffff
 78#define UTIME_OMIT 0x3ffffffe
 79
 80int stat(const char *__restrict, struct stat *__restrict);
 81int fstat(int, struct stat *);
 82int lstat(const char *__restrict, struct stat *__restrict);
 83int fstatat(int, const char *__restrict, struct stat *__restrict, int);
 84int chmod(const char *, mode_t);
 85int fchmod(int, mode_t);
 86int fchmodat(int, const char *, mode_t, int);
 87mode_t umask(mode_t);
 88int mkdir(const char *, mode_t);
 89int mkfifo(const char *, mode_t);
 90int mkdirat(int, const char *, mode_t);
 91int mkfifoat(int, const char *, mode_t);
 92
 93#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 94int mknod(const char *, mode_t, dev_t);
 95int mknodat(int, const char *, mode_t, dev_t);
 96#endif
 97
 98int futimens(int, const struct timespec [2]);
 99int utimensat(int, const char *, const struct timespec [2], int);
100
101#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
102int lchmod(const char *, mode_t);
103#define S_IREAD S_IRUSR
104#define S_IWRITE S_IWUSR
105#define S_IEXEC S_IXUSR
106#endif
107
108#if defined(_GNU_SOURCE)
109#define STATX_TYPE 1U
110#define STATX_MODE 2U
111#define STATX_NLINK 4U
112#define STATX_UID 8U
113#define STATX_GID 0x10U
114#define STATX_ATIME 0x20U
115#define STATX_MTIME 0x40U
116#define STATX_CTIME 0x80U
117#define STATX_INO 0x100U
118#define STATX_SIZE 0x200U
119#define STATX_BLOCKS 0x400U
120#define STATX_BASIC_STATS 0x7ffU
121#define STATX_BTIME 0x800U
122#define STATX_ALL 0xfffU
123
124struct statx_timestamp {
125	int64_t tv_sec;
126	uint32_t tv_nsec, __pad;
127};
128
129struct statx {
130	uint32_t stx_mask;
131	uint32_t stx_blksize;
132	uint64_t stx_attributes;
133	uint32_t stx_nlink;
134	uint32_t stx_uid;
135	uint32_t stx_gid;
136	uint16_t stx_mode;
137	uint16_t __pad0[1];
138	uint64_t stx_ino;
139	uint64_t stx_size;
140	uint64_t stx_blocks;
141	uint64_t stx_attributes_mask;
142	struct statx_timestamp stx_atime;
143	struct statx_timestamp stx_btime;
144	struct statx_timestamp stx_ctime;
145	struct statx_timestamp stx_mtime;
146	uint32_t stx_rdev_major;
147	uint32_t stx_rdev_minor;
148	uint32_t stx_dev_major;
149	uint32_t stx_dev_minor;
150	uint64_t __pad1[14];
151};
152
153int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
154#endif
155
156#if defined(_LARGEFILE64_SOURCE)
157#define stat64 stat
158#define fstat64 fstat
159#define lstat64 lstat
160#define fstatat64 fstatat
161#define blkcnt64_t blkcnt_t
162#define fsblkcnt64_t fsblkcnt_t
163#define fsfilcnt64_t fsfilcnt_t
164#define ino64_t ino_t
165#define off64_t off_t
166#endif
167
168#if _REDIR_TIME64
169__REDIR(stat, __stat_time64);
170__REDIR(fstat, __fstat_time64);
171__REDIR(lstat, __lstat_time64);
172__REDIR(fstatat, __fstatat_time64);
173__REDIR(futimens, __futimens_time64);
174__REDIR(utimensat, __utimensat_time64);
175#endif
176
177#ifdef __cplusplus
178}
179#endif
180#endif
181
182