1#pragma once
2
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#include <bits/alltypes.h>
22
23#include <bits/stat.h>
24
25#define st_atime st_atim.tv_sec
26#define st_mtime st_mtim.tv_sec
27#define st_ctime st_ctim.tv_sec
28
29#define S_IFMT 0170000
30
31#define S_IFDIR 0040000
32#define S_IFCHR 0020000
33#define S_IFBLK 0060000
34#define S_IFREG 0100000
35#define S_IFIFO 0010000
36#define S_IFLNK 0120000
37#define S_IFSOCK 0140000
38
39#define S_TYPEISMQ(buf) 0
40#define S_TYPEISSEM(buf) 0
41#define S_TYPEISSHM(buf) 0
42#define S_TYPEISTMO(buf) 0
43
44#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
45#define S_ISCHR(mode) (((mode)&S_IFMT) == S_IFCHR)
46#define S_ISBLK(mode) (((mode)&S_IFMT) == S_IFBLK)
47#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
48#define S_ISFIFO(mode) (((mode)&S_IFMT) == S_IFIFO)
49#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK)
50#define S_ISSOCK(mode) (((mode)&S_IFMT) == S_IFSOCK)
51
52#ifndef S_IRUSR
53#define S_ISUID 04000
54#define S_ISGID 02000
55#define S_ISVTX 01000
56#define S_IRUSR 0400
57#define S_IWUSR 0200
58#define S_IXUSR 0100
59#define S_IRWXU 0700
60#define S_IRGRP 0040
61#define S_IWGRP 0020
62#define S_IXGRP 0010
63#define S_IRWXG 0070
64#define S_IROTH 0004
65#define S_IWOTH 0002
66#define S_IXOTH 0001
67#define S_IRWXO 0007
68#endif
69
70#define UTIME_NOW 0x3fffffff
71#define UTIME_OMIT 0x3ffffffe
72
73int stat(const char* __restrict, struct stat* __restrict);
74int fstat(int, struct stat*);
75int lstat(const char* __restrict, struct stat* __restrict);
76int fstatat(int, const char* __restrict, struct stat* __restrict, int);
77int chmod(const char*, mode_t);
78int fchmod(int, mode_t);
79int fchmodat(int, const char*, mode_t, int);
80mode_t umask(mode_t);
81int mkdir(const char*, mode_t);
82int mknod(const char*, mode_t, dev_t);
83int mkfifo(const char*, mode_t);
84int mkdirat(int, const char*, mode_t);
85int mknodat(int, const char*, mode_t, dev_t);
86int mkfifoat(int, const char*, mode_t);
87
88int futimens(int, const struct timespec[2]);
89int utimensat(int, const char*, const struct timespec[2], int);
90
91#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
92int lchmod(const char*, mode_t);
93#define S_IREAD S_IRUSR
94#define S_IWRITE S_IWUSR
95#define S_IEXEC S_IXUSR
96#endif
97
98#ifdef __cplusplus
99}
100#endif
101