1#ifndef _KERNEL_LIBKERN_BITS_SYS_STAT_H
2#define _KERNEL_LIBKERN_BITS_SYS_STAT_H
3
4#include <libkern/types.h>
5
6/* MODES */
7#define S_IFSOCK 0xC000 /* [XSI] socket */
8#define S_IFLNK 0xA000 /* [XSI] symbolic link */
9#define S_IFREG 0x8000 /* [XSI] regular */
10#define S_IFBLK 0x6000 /* [XSI] block special */
11#define S_IFDIR 0x4000 /* [XSI] directory */
12#define S_IFCHR 0x2000 /* [XSI] character special */
13#define S_IFIFO 0x1000 /* [XSI] named pipe (fifo) */
14
15#define S_ISUID 0x0800
16#define S_ISGID 0x0400
17#define S_ISVTX 0x0200
18
19/* Read, write, execute/search by owner */
20#define S_IRWXU 0x01c0
21#define S_IRUSR 0x0100
22#define S_IWUSR 0x0080
23#define S_IXUSR 0x0040
24/* Read, write, execute/search by group */
25#define S_IRWXG 0x0038
26#define S_IRGRP 0x0020
27#define S_IWGRP 0x0010
28#define S_IXGRP 0x0008
29/* Read, write, execute/search by others */
30#define S_IRWXO 0x0007
31#define S_IROTH 0x0004
32#define S_IWOTH 0x0002
33#define S_IXOTH 0x0001
34
35struct fstat {
36 uint32_t dev; /* ID of device containing file */
37 uint32_t ino; /* inode number */
38 mode_t mode; /* protection */
39 uint32_t nlink; /* number of hard links */
40 uint32_t uid; /* user ID of owner */
41 uint32_t gid; /* group ID of owner */
42 uint32_t rdev; /* device ID (if special file) */
43 uint32_t size; /* total size, in bytes */
44 uint32_t atime; /* time of last access */
45 uint32_t mtime; /* time of last modification */
46 uint32_t ctime; /* time of last status change */
47};
48typedef struct fstat fstat_t;
49
50#endif // _KERNEL_LIBKERN_BITS_SYS_STAT_H