fix x32 msghdr struct by removing x32 bits/socket.h
[musl.git] / include / sys / stat.h
blob10d446c463eca4862b6bb8d394d52c13d27c4cf9
1 #ifndef _SYS_STAT_H
2 #define _SYS_STAT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
7 #include <features.h>
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
21 #include <bits/alltypes.h>
23 #include <bits/stat.h>
25 #define st_atime st_atim.tv_sec
26 #define st_mtime st_mtim.tv_sec
27 #define st_ctime st_ctim.tv_sec
29 #define S_IFMT 0170000
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
39 #define S_TYPEISMQ(buf) 0
40 #define S_TYPEISSEM(buf) 0
41 #define S_TYPEISSHM(buf) 0
42 #define S_TYPEISTMO(buf) 0
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)
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
70 #define UTIME_NOW 0x3fffffff
71 #define UTIME_OMIT 0x3ffffffe
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);
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
91 int futimens(int, const struct timespec [2]);
92 int utimensat(int, const char *, const struct timespec [2], int);
94 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
95 int lchmod(const char *, mode_t);
96 #define S_IREAD S_IRUSR
97 #define S_IWRITE S_IWUSR
98 #define S_IEXEC S_IXUSR
99 #endif
101 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
102 #define stat64 stat
103 #define fstat64 fstat
104 #define lstat64 lstat
105 #define fstatat64 fstatat
106 #define blkcnt64_t blkcnt_t
107 #define fsblkcnt64_t fsblkcnt_t
108 #define fsfilcnt64_t fsfilcnt_t
109 #define ino64_t ino_t
110 #define off64_t off_t
111 #endif
113 #if _REDIR_TIME64
114 __REDIR(stat, __stat_time64);
115 __REDIR(fstat, __fstat_time64);
116 __REDIR(lstat, __lstat_time64);
117 __REDIR(fstatat, __fstatat_time64);
118 __REDIR(futimens, __futimens_time64);
119 __REDIR(utimensat, __utimensat_time64);
120 #endif
122 #ifdef __cplusplus
124 #endif
125 #endif