-
Notifications
You must be signed in to change notification settings - Fork 0
/
unistd.kai
127 lines (98 loc) · 3.74 KB
/
unistd.kai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#library "libc"
R_OK :: 4
W_OK :: 2
X_OK :: 1
F_OK :: 0
_WSTOPPED :: 0o177
_WSTATUS :: fn(x: i32) -> i32 { return x & _WSTOPPED }
WEXITSTATUS :: fn(x: i32) -> i32 { return x >> 8 }
WSTOPSIG :: fn(x: i32) -> i32 { return x >> 8 }
WIFCONTINUED :: fn(x: i32) -> i32 { return (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) == 0x13) ? 1 : 0 }
WIFSTOPPED :: fn(x: i32) -> i32 { return (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) != 0x13) ? 1 : 0 }
WIFEXITED :: fn(x: i32) -> i32 { return (_WSTATUS(x) == 0) ? 1 : 0}
WIFSIGNALED :: fn(x: i32) -> i32 { return (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) ? 1 : 0 }
#foreign libc #callconv "c" {
_exit :: (i32) -> void
access :: (*u8, i32) -> i32
alarm :: (u32) -> u32
chdir :: (*u8) -> i32
chown :: (*u8, u32, u32) -> i32
close :: (i32) -> i32
dup :: (fd: i32) -> i32
dup2 :: (fd: i32, fd2: i32) -> i32
execl :: (path: *u8, arg0: *u8, args: #cvargs ..*u8) -> i32
execle :: (path: *u8, arg0: *u8, args: #cvargs ..*u8) -> i32
execlp :: (file: *u8, arg0: *u8, args: #cvargs ..*u8) -> i32
execv :: (path: *u8, argv: **u8) -> i32
execve :: (file: *u8, argv: **u8, envp: **u8) -> i32
execvp :: (file: *u8, argv: **u8) -> i32
fork :: () -> i32
fpathconf :: (fd: i32, name: i32) -> i64
getcwd :: (buffer: *u8, size: u64) -> *u8
getegid :: () -> u32
geteuid :: () -> u32
getgid :: () -> u32
getgroups :: (gidsetsize: i32, grouplist: *u32) -> i32
getlogin :: () -> *u8
getpgrp :: () -> i32
getpid :: () -> i32
getppid :: () -> i32
getuid :: () -> u32
isatty :: (fd: i32) -> i32
link :: (path1: *u8, path2: *u8) -> i32
lseek :: (fd: i32, offset: i64, whence: i32) -> i64
pathconf :: (path: *u8, name: i32) -> i64
wait :: (statLoc: *i32) -> i32
waitpid :: (pid: i32, statLoc: *i32, options: i32) -> i32
pause :: () -> i32
pipe :: ([2]i32) -> i32
rmdir :: (path: *u8) -> i32
setgid :: (u32) -> i32
setpgid :: (pid: i32, pgid: i32) -> i32
setsid :: () -> i32
setuid :: (u32) -> i32
sleep :: (u32) -> u32
sysconf :: (i32) -> i64
tcgetpgrp :: (i32) -> i32
tcsetpgrp :: (i32, i32) -> i32
ttyname :: (fd: i32) -> *u8
ttyname_r :: (fd: i32, buf: *u8, size: u64) -> *u8
unlink :: (*u8) -> i32
read :: (fd: i32, buf: rawptr, nbytes: u64) -> i64
write :: (fd: i32, buf: rawptr, nbytes: u64) -> i64
confstr :: (name: i32, buf: *u8, size: u64) -> u64
getopt :: (argc: i32, argv: **u8, optstring: *u8) -> i32
optarg : *u8
optind : i32
opterr : i32
optopt : i32
crypt :: (key: *u8, salt: *u8) -> *u8
encrypt :: (block: *u8, edflag: i32) -> i32
fchdir :: (i32) -> i32
gethostid :: () -> i64
getpgid :: (i32) -> i32
getsid :: (i32) -> i32
lchown :: (path: *u8, owner: u32, group: u32) -> i32
lockf :: (fd: i32, function: i32, size: i64) -> i32
nice :: (i32) -> i32
pread :: (fd: i32, buf: rawptr, size: u64, offset: u64) -> i64
pwrite :: (fd: i32, buf: rawptr, size: u64, offset: u64) -> i64
setpgrp :: (pid: i32, pgid: i32) -> i32
setregid :: (u32, u32) -> i32
setreuid :: (u32, u32) -> i32
swab :: (src: rawptr, dst: rawptr, nbytes: i64) -> void
sync :: () -> void
truncate :: (*u8, i64) -> i32
ualarm :: (us: u32, interval: u32) -> u32
usleep :: (us: u32) -> i32
vfork :: () -> i32
fsync :: (fd: i32) -> i32
ftruncate :: (fd: i32, length: i64) -> i32
getlogin_r :: (buf: *u8, size: u64) -> i32
fchown :: (fd: i32, owner: u32, group: u32) -> i32
gethostname :: (name: *u8, size: u64) -> i32
readlink :: (path: *u8, buf: *u8, size: u64) -> i64
setegid :: (u32) -> i32
seteuid :: (u32) -> i32
symlink :: (*u8, *u8) -> i32
}