blob: 2a7ce233661ae9b43af88c799982ae3c0ccd5a1c [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _SYS_STAT_H
2#define _SYS_STAT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#define __NEED_dev_t
8#define __NEED_ino_t
9#define __NEED_mode_t
10#define __NEED_nlink_t
11#define __NEED_uid_t
12#define __NEED_gid_t
13#define __NEED_off_t
14#define __NEED_time_t
15#define __NEED_blksize_t
16#define __NEED_blkcnt_t
Rich Felker74eea622011-02-14 18:41:25 -050017#define __NEED_struct_timespec
Rich Felker0b44a032011-02-12 00:22:29 -050018
19#include <bits/alltypes.h>
20
21#include <bits/stat.h>
22
Rich Felker74eea622011-02-14 18:41:25 -050023#define st_atime st_atim.tv_sec
24#define st_mtime st_mtim.tv_sec
25#define st_ctime st_ctim.tv_sec
26
Rich Felker0b44a032011-02-12 00:22:29 -050027#define S_IFMT 0170000
28
29#define S_IFDIR 0040000
30#define S_IFCHR 0020000
31#define S_IFBLK 0060000
32#define S_IFREG 0100000
33#define S_IFIFO 0010000
34#define S_IFLNK 0120000
35#define S_IFSOCK 0140000
36
37#define S_TYPEISMQ(buf) 0
38#define S_TYPEISSEM(buf) 0
39#define S_TYPEISSHM(buf) 0
40#define S_TYPEISTMO(buf) 0
41
42#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
43#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
44#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
45#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
46#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
47#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
48#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
49
Rich Felkerac12eb92011-03-08 12:35:35 -050050#ifndef S_IRUSR
Rich Felker0b44a032011-02-12 00:22:29 -050051#define S_ISUID 04000
52#define S_ISGID 02000
53#define S_ISVTX 01000
Rich Felker0b44a032011-02-12 00:22:29 -050054#define S_IRUSR 0400
55#define S_IWUSR 0200
56#define S_IXUSR 0100
57#define S_IRWXU 0700
Rich Felker0b44a032011-02-12 00:22:29 -050058#define S_IRGRP 0040
59#define S_IWGRP 0020
60#define S_IXGRP 0010
61#define S_IRWXG 0070
Rich Felker0b44a032011-02-12 00:22:29 -050062#define S_IROTH 0004
63#define S_IWOTH 0002
64#define S_IXOTH 0001
65#define S_IRWXO 0007
Rich Felkerac12eb92011-03-08 12:35:35 -050066#endif
Rich Felker0b44a032011-02-12 00:22:29 -050067
Rich Felker4a196342011-04-10 18:32:59 -040068#define UTIME_NOW 0x3fffffff
69#define UTIME_OMIT 0x3ffffffe
70
Rich Felker0b44a032011-02-12 00:22:29 -050071int stat(const char *, struct stat *);
72int fstat(int, struct stat *);
73int lstat(const char *, struct stat *);
74int fstatat(int, const char *, struct stat *, int);
75int chmod(const char *, mode_t);
76int fchmod(int, mode_t);
77int fchmodat(int, const char *, mode_t, int);
78mode_t umask(mode_t);
79int mkdir(const char *, mode_t);
80int mknod(const char *, mode_t, dev_t);
81int mkfifo(const char *, mode_t);
82int mkdirat(int, const char *, mode_t);
83int mknodat(int, const char *, mode_t, dev_t);
84int mkfifoat(int, const char *, mode_t);
85
Rich Felkereda8e9d2011-02-27 03:48:57 -050086int futimens(int, const struct timespec [2]);
87int utimensat(int, const char *, const struct timespec [2], int);
88
Rich Felkerd5ca0672011-02-17 23:13:46 -050089#ifdef _BSD_SOURCE
90int lchmod(const char *, mode_t);
91#endif
Rich Felker0b44a032011-02-12 00:22:29 -050092
Rich Felker419ae6d2012-05-22 21:52:08 -040093#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
Rich Felker7ecab792011-04-12 12:01:20 -040094#define S_IREAD S_IRUSR
95#define S_IWRITE S_IWUSR
96#define S_IEXEC S_IXUSR
97#endif
98
Rich Felker3b94dab2012-06-04 08:03:56 -040099#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
Rich Felkerf0b85fd2012-05-04 00:31:25 -0400100#define stat64 stat
101#define fstat64 fstat
102#define lstat64 lstat
103#define fstatat64 fstatat
104#define blksize64_t blksize_t
105#define blkcnt64_t blkcnt_t
106#define ino64_t ino_t
107#define off64_t off_t
108#endif
109
Rich Felker0b44a032011-02-12 00:22:29 -0500110#ifdef __cplusplus
111}
112#endif
113#endif
114
115