diff options
Diffstat (limited to 'src/include/sys')
-rw-r--r-- | src/include/sys/stat.h | 58 | ||||
-rw-r--r-- | src/include/sys/times.h | 15 | ||||
-rw-r--r-- | src/include/sys/types.h | 46 | ||||
-rw-r--r-- | src/include/sys/utsname.h | 16 | ||||
-rw-r--r-- | src/include/sys/wait.h | 23 |
5 files changed, 158 insertions, 0 deletions
diff --git a/src/include/sys/stat.h b/src/include/sys/stat.h new file mode 100644 index 0000000..41c3840 --- /dev/null +++ b/src/include/sys/stat.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef _SYS_STAT_H | ||
2 | #define _SYS_STAT_H | ||
3 | |||
4 | #include <sys/types.h> | ||
5 | |||
6 | struct stat { | ||
7 | dev_t st_dev; | ||
8 | ino_t st_ino; | ||
9 | umode_t st_mode; | ||
10 | nlink_t st_nlink; | ||
11 | uid_t st_uid; | ||
12 | gid_t st_gid; | ||
13 | dev_t st_rdev; | ||
14 | off_t st_size; | ||
15 | time_t st_atime; | ||
16 | time_t st_mtime; | ||
17 | time_t st_ctime; | ||
18 | }; | ||
19 | |||
20 | #define S_IFMT 00170000 | ||
21 | #define S_IFREG 0100000 | ||
22 | #define S_IFBLK 0060000 | ||
23 | #define S_IFDIR 0040000 | ||
24 | #define S_IFCHR 0020000 | ||
25 | #define S_IFIFO 0010000 | ||
26 | #define S_ISUID 0004000 | ||
27 | #define S_ISGID 0002000 | ||
28 | #define S_ISVTX 0001000 | ||
29 | |||
30 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||
31 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
32 | #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||
33 | #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||
34 | #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||
35 | |||
36 | #define S_IRWXU 00700 | ||
37 | #define S_IRUSR 00400 | ||
38 | #define S_IWUSR 00200 | ||
39 | #define S_IXUSR 00100 | ||
40 | |||
41 | #define S_IRWXG 00070 | ||
42 | #define S_IRGRP 00040 | ||
43 | #define S_IWGRP 00020 | ||
44 | #define S_IXGRP 00010 | ||
45 | |||
46 | #define S_IRWXO 00007 | ||
47 | #define S_IROTH 00004 | ||
48 | #define S_IWOTH 00002 | ||
49 | #define S_IXOTH 00001 | ||
50 | |||
51 | extern int chmod(const char *_path, mode_t mode); | ||
52 | extern int fstat(int fildes, struct stat *stat_buf); | ||
53 | extern int mkdir(const char *_path, mode_t mode); | ||
54 | extern int mkfifo(const char *_path, mode_t mode); | ||
55 | extern int stat(const char *filename, struct stat *stat_buf); | ||
56 | extern mode_t umask(mode_t mask); | ||
57 | |||
58 | #endif | ||
diff --git a/src/include/sys/times.h b/src/include/sys/times.h new file mode 100644 index 0000000..68d5bfb --- /dev/null +++ b/src/include/sys/times.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef _TIMES_H | ||
2 | #define _TIMES_H | ||
3 | |||
4 | #include <sys/types.h> | ||
5 | |||
6 | struct tms { | ||
7 | time_t tms_utime; | ||
8 | time_t tms_stime; | ||
9 | time_t tms_cutime; | ||
10 | time_t tms_cstime; | ||
11 | }; | ||
12 | |||
13 | extern time_t times(struct tms * tp); | ||
14 | |||
15 | #endif | ||
diff --git a/src/include/sys/types.h b/src/include/sys/types.h new file mode 100644 index 0000000..557aa31 --- /dev/null +++ b/src/include/sys/types.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _SYS_TYPES_H | ||
2 | #define _SYS_TYPES_H | ||
3 | |||
4 | #ifndef _SIZE_T | ||
5 | #define _SIZE_T | ||
6 | typedef unsigned int size_t; | ||
7 | #endif | ||
8 | |||
9 | #ifndef _TIME_T | ||
10 | #define _TIME_T | ||
11 | typedef long time_t; | ||
12 | #endif | ||
13 | |||
14 | #ifndef _PTRDIFF_T | ||
15 | #define _PTRDIFF_T | ||
16 | typedef long ptrdiff_t; | ||
17 | #endif | ||
18 | |||
19 | #ifndef NULL | ||
20 | #define NULL ((void *) 0) | ||
21 | #endif | ||
22 | |||
23 | typedef int pid_t; | ||
24 | typedef unsigned short uid_t; | ||
25 | typedef unsigned char gid_t; | ||
26 | typedef unsigned short dev_t; | ||
27 | typedef unsigned short ino_t; | ||
28 | typedef unsigned short mode_t; | ||
29 | typedef unsigned short umode_t; | ||
30 | typedef unsigned char nlink_t; | ||
31 | typedef int daddr_t; | ||
32 | typedef long off_t; | ||
33 | typedef unsigned char u_char; | ||
34 | typedef unsigned short ushort; | ||
35 | |||
36 | typedef struct { int quot,rem; } div_t; | ||
37 | typedef struct { long quot,rem; } ldiv_t; | ||
38 | |||
39 | struct ustat { | ||
40 | daddr_t f_tfree; | ||
41 | ino_t f_tinode; | ||
42 | char f_fname[6]; | ||
43 | char f_fpack[6]; | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/src/include/sys/utsname.h b/src/include/sys/utsname.h new file mode 100644 index 0000000..0a1c5a0 --- /dev/null +++ b/src/include/sys/utsname.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _SYS_UTSNAME_H | ||
2 | #define _SYS_UTSNAME_H | ||
3 | |||
4 | #include <sys/types.h> | ||
5 | |||
6 | struct utsname { | ||
7 | char sysname[9]; | ||
8 | char nodename[9]; | ||
9 | char release[9]; | ||
10 | char version[9]; | ||
11 | char machine[9]; | ||
12 | }; | ||
13 | |||
14 | extern int uname(struct utsname * utsbuf); | ||
15 | |||
16 | #endif | ||
diff --git a/src/include/sys/wait.h b/src/include/sys/wait.h new file mode 100644 index 0000000..53190c2 --- /dev/null +++ b/src/include/sys/wait.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _SYS_WAIT_H | ||
2 | #define _SYS_WAIT_H | ||
3 | |||
4 | #include <sys/types.h> | ||
5 | |||
6 | #define _LOW(v) ( (v) & 0377) | ||
7 | #define _HIGH(v) ( ((v) >> 8) & 0377) | ||
8 | |||
9 | /* options for waitpid, WUNTRACED not supported */ | ||
10 | #define WNOHANG 1 | ||
11 | #define WUNTRACED 2 | ||
12 | |||
13 | #define WIFEXITED(s) (!((s)&0xFF) | ||
14 | #define WIFSTOPPED(s) (((s)&0xFF)==0x7F) | ||
15 | #define WEXITSTATUS(s) (((s)>>8)&0xFF) | ||
16 | #define WTERMSIG(s) ((s)&0x7F) | ||
17 | #define WSTOPSIG(s) (((s)>>8)&0xFF) | ||
18 | #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) | ||
19 | |||
20 | pid_t wait(int *stat_loc); | ||
21 | pid_t waitpid(pid_t pid, int *stat_loc, int options); | ||
22 | |||
23 | #endif | ||