10 /* Grabbed from FreeBSD/sys/sys/stat.h */
12 #define O_RDONLY 0x0000
13 #define O_WRONLY 0x0001
15 #define O_ACCMODE 0x0003
17 #define O_BINARY 0x0004
19 #define O_NOINHERIT 0x0080
21 #define O_CREAT 0x0100
23 #define O_NOCTTY 0x0400
24 #define O_TRUNC 0x0800
25 #define O_APPEND 0x1000
26 #define O_NONBLOCK 0x2000
38 #define S_ISUID 0004000 /* set user id on execution */
39 #define S_ISGID 0002000 /* set group id on execution */
40 #define S_ISTXT 0001000 /* sticky bit */
42 #define S_IRWXU 0000700 /* RWX mask for owner */
43 #define S_IRUSR 0000400 /* R for owner */
44 #define S_IWUSR 0000200 /* W for owner */
45 #define S_IXUSR 0000100 /* X for owner */
47 #define S_IREAD S_IRUSR
48 #define S_IWRITE S_IWUSR
49 #define S_IEXEC S_IXUSR
51 #define S_IRWXG 0000070 /* RWX mask for group */
52 #define S_IRGRP 0000040 /* R for group */
53 #define S_IWGRP 0000020 /* W for group */
54 #define S_IXGRP 0000010 /* X for group */
56 #define S_IRWXO 0000007 /* RWX mask for other */
57 #define S_IROTH 0000004 /* R for other */
58 #define S_IWOTH 0000002 /* W for other */
59 #define S_IXOTH 0000001 /* X for other */
61 #define S_IFMT 0170000 /* type of file mask */
62 #define S_IFIFO 0010000 /* named pipe (fifo) */
63 #define S_IFCHR 0020000 /* character special */
64 #define S_IFDIR 0040000 /* directory */
65 #define S_IFBLK 0060000 /* block special */
66 #define S_IFREG 0100000 /* regular */
67 #define S_IFLNK 0120000 /* symbolic link */
68 #define S_IFSOCK 0140000 /* socket */
69 #define S_ISVTX 0001000 /* save swapped text even after use */
70 #define S_IFWHT 0160000 /* whiteout */
72 #define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */
73 #define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */
74 #define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */
75 #define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */
76 #define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */
77 #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
78 #define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */
79 #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
82 __dev_t st_dev
; /* inode's device */
83 ino_t st_ino
; /* inode's number */
84 mode_t st_mode
; /* inode protection mode */
85 nlink_t st_nlink
; /* number of hard links */
86 uid_t st_uid
; /* user ID of the file's owner */
87 gid_t st_gid
; /* group ID of the file's group */
88 __dev_t st_rdev
; /* device type */
89 struct timespec st_atim
; /* time of last access */
90 struct timespec st_mtim
; /* time of last data modification */
91 struct timespec st_ctim
; /* time of last file status change */
92 off_t st_size
; /* file size, in bytes */
93 blkcnt_t st_blocks
; /* blocks allocated for file */
94 blksize_t st_blksize
; /* optimal blocksize for I/O */
95 fflags_t st_flags
; /* user defined flags for file */
96 uint32_t st_gen
; /* file generation number */
98 struct timespec st_birthtim
; /* time of file creation */
99 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec
));
100 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec
));
108 char d_name
[255 + 1];
111 ssize_t
read(int fd
, void *buf
, size_t nbyte
);
112 ssize_t
write(int fd
, const void *buf
, size_t count
);
113 int open(const char *path
, int flags
, int mode
);
115 int unlink(const char *pathname
);
116 int rename(const char *oldpath
, const char *newpath
);
117 int mkdir(const char *pathname
, mode_t mode
);
118 int rmdir(const char *path
);
119 int stat(const char *path
, struct stat
*sb
);
120 int fstat(int fd
, struct stat
*sb
);
121 int getdents(int fd
, char *buf
, size_t count
);
123 int getSandboxDirectory(char *destination
, int *length
);