• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef	_SYS_STAT_H
2 #define	_SYS_STAT_H
3 #ifdef __cplusplus
4 extern "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 
73 int stat(const char *__restrict, struct stat *__restrict);
74 int fstat(int, struct stat *);
75 int lstat(const char *__restrict, struct stat *__restrict);
76 int fstatat(int, const char *__restrict, struct stat *__restrict, int);
77 int chmod(const char *, mode_t);
78 int fchmod(int, mode_t);
79 int fchmodat(int, const char *, mode_t, int);
80 mode_t umask(mode_t);
81 int mkdir(const char *, mode_t);
82 int mkfifo(const char *, mode_t);
83 int mkdirat(int, const char *, mode_t);
84 int mkfifoat(int, const char *, mode_t);
85 
86 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
87 int mknod(const char *, mode_t, dev_t);
88 int mknodat(int, const char *, mode_t, dev_t);
89 #endif
90 
91 int futimens(int, const struct timespec [2]);
92 int utimensat(int, const char *, const struct timespec [2], int);
93 
94 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
95 #define S_IREAD S_IRUSR
96 #define S_IWRITE S_IWUSR
97 #define S_IEXEC S_IXUSR
98 #endif
99 
100 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
101 #define stat64 stat
102 #define fstat64 fstat
103 #define lstat64 lstat
104 #define fstatat64 fstatat
105 #define blkcnt64_t blkcnt_t
106 #define fsblkcnt64_t fsblkcnt_t
107 #define fsfilcnt64_t fsfilcnt_t
108 #define ino64_t ino_t
109 #define off64_t off_t
110 #endif
111 
112 #if _REDIR_TIME64
113 __REDIR(stat, __stat_time64);
114 __REDIR(fstat, __fstat_time64);
115 __REDIR(lstat, __lstat_time64);
116 __REDIR(fstatat, __fstatat_time64);
117 __REDIR(futimens, __futimens_time64);
118 __REDIR(utimensat, __utimensat_time64);
119 #endif
120 
121 #include <fortify/stat.h>
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 #endif
127 
128 
129