stdlib: fix the return value of exit()
[neatlibc.git] / sys / stat.h
blob16a931ec1eb0bfc61fc3bd94afe8f6215fccfb58
1 #ifndef _SYS_STAT_H
2 #define _SYS_STAT_H
4 #include <inttypes.h>
6 #define S_IRWXU 00700
7 #define S_IRUSR 00400
8 #define S_IWUSR 00200
9 #define S_IXUSR 00100
11 #define S_IRWXG 00070
12 #define S_IRGRP 00040
13 #define S_IWGRP 00020
14 #define S_IXGRP 00010
16 #define S_IRWXO 00007
17 #define S_IROTH 00004
18 #define S_IWOTH 00002
19 #define S_IXOTH 00001
21 #define S_IFMT 0170000
22 #define S_IFSOCK 0140000
23 #define S_IFLNK 0120000
24 #define S_IFREG 0100000
25 #define S_IFBLK 0060000
26 #define S_IFDIR 0040000
27 #define S_IFCHR 0020000
28 #define S_IFIFO 0010000
29 #define S_ISUID 0004000
30 #define S_ISGID 0002000
31 #define S_ISVTX 0001000
33 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
34 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
35 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
36 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
37 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
38 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
39 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
41 struct stat {
42 uint32_t st_dev;
43 unsigned long st_ino;
44 uint16_t st_mode;
45 uint16_t st_nlink;
46 uint16_t st_uid;
47 uint16_t st_gid;
48 uint32_t st_rdev;
49 unsigned long st_size;
50 unsigned long st_blksize;
51 unsigned long st_blocks;
52 long st_atime;
53 unsigned long st_atime_nsec;
54 long st_mtime;
55 unsigned long st_mtime_nsec;
56 long st_ctime;
57 unsigned long st_ctime_nsec;
58 unsigned long __unused4;
59 unsigned long __unused5;
62 int stat(char *file, struct stat *buf);
63 int fstat(int fd, struct stat *buf);
64 int lstat(char *file, struct stat *buf);
66 int chmod(char *file, int mode);
67 int fchmod(int fd, int mode);
68 int umask(int mask);
69 int mkdir(char *path, int mode);
70 int mknod(char *path, int mode, int dev);
71 int mkfifo(char *path, int mode);
73 #endif