1570af302Sopenharmony_ci#ifndef	_SYS_STAT_H
2570af302Sopenharmony_ci#define	_SYS_STAT_H
3570af302Sopenharmony_ci#ifdef __cplusplus
4570af302Sopenharmony_ciextern "C" {
5570af302Sopenharmony_ci#endif
6570af302Sopenharmony_ci
7570af302Sopenharmony_ci#include <features.h>
8570af302Sopenharmony_ci
9570af302Sopenharmony_ci#define __NEED_dev_t
10570af302Sopenharmony_ci#define __NEED_ino_t
11570af302Sopenharmony_ci#define __NEED_mode_t
12570af302Sopenharmony_ci#define __NEED_nlink_t
13570af302Sopenharmony_ci#define __NEED_uid_t
14570af302Sopenharmony_ci#define __NEED_gid_t
15570af302Sopenharmony_ci#define __NEED_off_t
16570af302Sopenharmony_ci#define __NEED_time_t
17570af302Sopenharmony_ci#define __NEED_blksize_t
18570af302Sopenharmony_ci#define __NEED_blkcnt_t
19570af302Sopenharmony_ci#define __NEED_struct_timespec
20570af302Sopenharmony_ci
21570af302Sopenharmony_ci#include <bits/alltypes.h>
22570af302Sopenharmony_ci
23570af302Sopenharmony_ci#include <bits/stat.h>
24570af302Sopenharmony_ci
25570af302Sopenharmony_ci#define st_atime st_atim.tv_sec
26570af302Sopenharmony_ci#define st_mtime st_mtim.tv_sec
27570af302Sopenharmony_ci#define st_ctime st_ctim.tv_sec
28570af302Sopenharmony_ci
29570af302Sopenharmony_ci#define S_IFMT  0170000
30570af302Sopenharmony_ci
31570af302Sopenharmony_ci#define S_IFDIR 0040000
32570af302Sopenharmony_ci#define S_IFCHR 0020000
33570af302Sopenharmony_ci#define S_IFBLK 0060000
34570af302Sopenharmony_ci#define S_IFREG 0100000
35570af302Sopenharmony_ci#define S_IFIFO 0010000
36570af302Sopenharmony_ci#define S_IFLNK 0120000
37570af302Sopenharmony_ci#define S_IFSOCK 0140000
38570af302Sopenharmony_ci
39570af302Sopenharmony_ci#define S_TYPEISMQ(buf)  0
40570af302Sopenharmony_ci#define S_TYPEISSEM(buf) 0
41570af302Sopenharmony_ci#define S_TYPEISSHM(buf) 0
42570af302Sopenharmony_ci#define S_TYPEISTMO(buf) 0
43570af302Sopenharmony_ci
44570af302Sopenharmony_ci#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
45570af302Sopenharmony_ci#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
46570af302Sopenharmony_ci#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
47570af302Sopenharmony_ci#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
48570af302Sopenharmony_ci#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
49570af302Sopenharmony_ci#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
50570af302Sopenharmony_ci#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
51570af302Sopenharmony_ci
52570af302Sopenharmony_ci#ifndef S_IRUSR
53570af302Sopenharmony_ci#define S_ISUID 04000
54570af302Sopenharmony_ci#define S_ISGID 02000
55570af302Sopenharmony_ci#define S_ISVTX 01000
56570af302Sopenharmony_ci#define S_IRUSR 0400
57570af302Sopenharmony_ci#define S_IWUSR 0200
58570af302Sopenharmony_ci#define S_IXUSR 0100
59570af302Sopenharmony_ci#define S_IRWXU 0700
60570af302Sopenharmony_ci#define S_IRGRP 0040
61570af302Sopenharmony_ci#define S_IWGRP 0020
62570af302Sopenharmony_ci#define S_IXGRP 0010
63570af302Sopenharmony_ci#define S_IRWXG 0070
64570af302Sopenharmony_ci#define S_IROTH 0004
65570af302Sopenharmony_ci#define S_IWOTH 0002
66570af302Sopenharmony_ci#define S_IXOTH 0001
67570af302Sopenharmony_ci#define S_IRWXO 0007
68570af302Sopenharmony_ci#endif
69570af302Sopenharmony_ci
70570af302Sopenharmony_ci#define UTIME_NOW  0x3fffffff
71570af302Sopenharmony_ci#define UTIME_OMIT 0x3ffffffe
72570af302Sopenharmony_ci
73570af302Sopenharmony_ciint stat(const char *__restrict, struct stat *__restrict);
74570af302Sopenharmony_ciint fstat(int, struct stat *);
75570af302Sopenharmony_ciint lstat(const char *__restrict, struct stat *__restrict);
76570af302Sopenharmony_ciint fstatat(int, const char *__restrict, struct stat *__restrict, int);
77570af302Sopenharmony_ciint chmod(const char *, mode_t);
78570af302Sopenharmony_ciint fchmod(int, mode_t);
79570af302Sopenharmony_ciint fchmodat(int, const char *, mode_t, int);
80570af302Sopenharmony_cimode_t umask(mode_t);
81570af302Sopenharmony_ciint mkdir(const char *, mode_t);
82570af302Sopenharmony_ciint mkfifo(const char *, mode_t);
83570af302Sopenharmony_ciint mkdirat(int, const char *, mode_t);
84570af302Sopenharmony_ciint mkfifoat(int, const char *, mode_t);
85570af302Sopenharmony_ci
86570af302Sopenharmony_ci#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
87570af302Sopenharmony_ciint mknod(const char *, mode_t, dev_t);
88570af302Sopenharmony_ciint mknodat(int, const char *, mode_t, dev_t);
89570af302Sopenharmony_ci#endif
90570af302Sopenharmony_ci
91570af302Sopenharmony_ciint futimens(int, const struct timespec [2]);
92570af302Sopenharmony_ciint utimensat(int, const char *, const struct timespec [2], int);
93570af302Sopenharmony_ci
94570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
95570af302Sopenharmony_ciint lchmod(const char *, mode_t);
96570af302Sopenharmony_ci#define S_IREAD S_IRUSR
97570af302Sopenharmony_ci#define S_IWRITE S_IWUSR
98570af302Sopenharmony_ci#define S_IEXEC S_IXUSR
99570af302Sopenharmony_ci#endif
100570af302Sopenharmony_ci
101570af302Sopenharmony_ci#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
102570af302Sopenharmony_ci#define stat64 stat
103570af302Sopenharmony_ci#define fstat64 fstat
104570af302Sopenharmony_ci#define lstat64 lstat
105570af302Sopenharmony_ci#define fstatat64 fstatat
106570af302Sopenharmony_ci#define blkcnt64_t blkcnt_t
107570af302Sopenharmony_ci#define fsblkcnt64_t fsblkcnt_t
108570af302Sopenharmony_ci#define fsfilcnt64_t fsfilcnt_t
109570af302Sopenharmony_ci#define ino64_t ino_t
110570af302Sopenharmony_ci#define off64_t off_t
111570af302Sopenharmony_ci#endif
112570af302Sopenharmony_ci
113570af302Sopenharmony_ci#if _REDIR_TIME64
114570af302Sopenharmony_ci__REDIR(stat, __stat_time64);
115570af302Sopenharmony_ci__REDIR(fstat, __fstat_time64);
116570af302Sopenharmony_ci__REDIR(lstat, __lstat_time64);
117570af302Sopenharmony_ci__REDIR(fstatat, __fstatat_time64);
118570af302Sopenharmony_ci__REDIR(futimens, __futimens_time64);
119570af302Sopenharmony_ci__REDIR(utimensat, __utimensat_time64);
120570af302Sopenharmony_ci#endif
121570af302Sopenharmony_ci
122570af302Sopenharmony_ci#include <fortify/stat.h>
123570af302Sopenharmony_ci
124570af302Sopenharmony_ci#ifdef __cplusplus
125570af302Sopenharmony_ci}
126570af302Sopenharmony_ci#endif
127570af302Sopenharmony_ci#endif
128570af302Sopenharmony_ci
129570af302Sopenharmony_ci
130