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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
// Copyright 2026 Gabriel Bjørnager Jensen.
//
// This file is part of LOOKLOOK.
//
// LOOKLOOK is free software: you can redistribute it and/or modify it under the
// terms of the GNU Affero General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later ver-
// sion.
//
// LOOKLOOK is distributed in the hope that it will be useful, but WITHOUT ANY WAR-
// RANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License along
// with LOOKLOOK. If not, see <https://www.gnu.org/licenses/>.
//! Foreign function interfaces for the emulator.
/// The `EXIT_SIGNAL` value.
pub const EXIT_SIGNAL: i32 = 256;
/// The `O_CREAT` value.
pub const O_CREAT: i32 = 1;
/// The `O_TRUNC` value.
pub const O_TRUNC: i32 = 2;
/// The `O_APPEND` value.
pub const O_APPEND: i32 = 4;
/// The `O_EXEC` value.
pub const O_EXEC: i32 = 8;
/// The `O_RDONLY` value.
pub const O_RDONLY: i32 = 16;
/// The `O_RDRW` value.
pub const O_RDRW: i32 = 32;
/// The `O_WRONLY` value.
pub const O_WRONLY: i32 = 64;
/// The `EDOM` `errno` value.
pub const EDOM: i32 = 1;
/// The `ERANGE` `errno` value.
pub const ERANGE: i32 = 2;
/// The `EILSEQ` `errno` value.
pub const EILSEQ: i32 = 3;
/// The `E2BIG` `errno` value.
pub const E2BIG: i32 = 4;
/// The `EACCES` `errno` value.
pub const EACCES: i32 = 5;
/// The `EADDRINUSE` `errno` value.
pub const EADDRINUSE: i32 = 6;
/// The `EADDRNOTAVAIL` `errno` value.
pub const EADDRNOTAVAIL: i32 = 7;
/// The `EAFNOSUPPORT` `errno` value.
pub const EAFNOSUPPORT: i32 = 8;
/// The `EAGAIN` `errno` value.
pub const EAGAIN: i32 = 9;
/// The `EALREADY` `errno` value.
pub const EALREADY: i32 = 10;
/// The `EBADF` `errno` value.
pub const EBADF: i32 = 11;
/// The `EBADMSG` `errno` value.
pub const EBADMSG: i32 = 12;
/// The `EBUSY` `errno` value.
pub const EBUSY: i32 = 13;
/// The `ECANCELED` `errno` value.
pub const ECANCELED: i32 = 14;
/// The `ECHILD` `errno` value.
pub const ECHILD: i32 = 15;
/// The `ECONNABORTED` `errno` value.
pub const ECONNABORTED: i32 = 16;
/// The `ECONNREFUSED` `errno` value.
pub const ECONNREFUSED: i32 = 17;
/// The `ECONNRESET` `errno` value.
pub const ECONNRESET: i32 = 18;
/// The `EDEADLK` `errno` value.
pub const EDEADLK: i32 = 19;
/// The `EDESTADDRREQ` `errno` value.
pub const EDESTADDRREQ: i32 = 20;
/// The `EEXIST` `errno` value.
pub const EEXIST: i32 = 21;
/// The `EFAULT` `errno` value.
pub const EFAULT: i32 = 22;
/// The `EFBIG` `errno` value.
pub const EFBIG: i32 = 23;
/// The `EHOSTUNREACH` `errno` value.
pub const EHOSTUNREACH: i32 = 24;
/// The `EIDRM` `errno` value.
pub const EIDRM: i32 = 25;
/// The `EINPROGRESS` `errno` value.
pub const EINPROGRESS: i32 = 26;
/// The `EINTR` `errno` value.
pub const EINTR: i32 = 27;
/// The `EINVAL` `errno` value.
pub const EINVAL: i32 = 28;
/// The `EIO` `errno` value.
pub const EIO: i32 = 29;
/// The `EISCONN` `errno` value.
pub const EISCONN: i32 = 30;
/// The `EISDIR` `errno` value.
pub const EISDIR: i32 = 31;
/// The `ELOOP` `errno` value.
pub const ELOOP: i32 = 32;
/// The `EMFILE` `errno` value.
pub const EMFILE: i32 = 33;
/// The `EMLINK` `errno` value.
pub const EMLINK: i32 = 34;
/// The `EMSGSIZE` `errno` value.
pub const EMSGSIZE: i32 = 35;
/// The `ENAMETOOLONG` `errno` value.
pub const ENAMETOOLONG: i32 = 36;
/// The `ENETDOWN` `errno` value.
pub const ENETDOWN: i32 = 37;
/// The `ENETRESET` `errno` value.
pub const ENETRESET: i32 = 38;
/// The `ENETUNREACH` `errno` value.
pub const ENETUNREACH: i32 = 39;
/// The `ENFILE` `errno` value.
pub const ENFILE: i32 = 40;
/// The `ENOBUFS` `errno` value.
pub const ENOBUFS: i32 = 41;
/// The `ENODATA` `errno` value.
pub const ENODATA: i32 = 42;
/// The `ENODEV` `errno` value.
pub const ENODEV: i32 = 43;
/// The `ENOENT` `errno` value.
pub const ENOENT: i32 = 44;
/// The `ENOEXEC` `errno` value.
pub const ENOEXEC: i32 = 45;
/// The `ENOLCK` `errno` value.
pub const ENOLCK: i32 = 46;
/// The `ENOLINK` `errno` value.
pub const ENOLINK: i32 = 47;
/// The `ENOMEM` `errno` value.
pub const ENOMEM: i32 = 48;
/// The `ENOMSG` `errno` value.
pub const ENOMSG: i32 = 49;
/// The `ENOPROTOOPT` `errno` value.
pub const ENOPROTOOPT: i32 = 50;
/// The `ENOSPC` `errno` value.
pub const ENOSPC: i32 = 51;
/// The `ENOSR` `errno` value.
pub const ENOSR: i32 = 52;
/// The `ENOSTR` `errno` value.
pub const ENOSTR: i32 = 53;
/// The `ENOSYS` `errno` value.
pub const ENOSYS: i32 = 54;
/// The `ENOTCONN` `errno` value.
pub const ENOTCONN: i32 = 55;
/// The `ENOTDIR` `errno` value.
pub const ENOTDIR: i32 = 56;
/// The `ENOTEMPTY` `errno` value.
pub const ENOTEMPTY: i32 = 57;
/// The `ENOTRECOVERABLE` `errno` value.
pub const ENOTRECOVERABLE: i32 = 58;
/// The `ENOTSOCK` `errno` value.
pub const ENOTSOCK: i32 = 59;
/// The `ENOTSUP` `errno` value.
pub const ENOTSUP: i32 = 60;
/// The `ENOTTY` `errno` value.
pub const ENOTTY: i32 = 61;
/// The `ENXIO` `errno` value.
pub const ENXIO: i32 = 62;
/// The `EOPNOTSUPP` `errno` value.
pub const EOPNOTSUPP: i32 = 63;
/// The `EOVERFLOW` `errno` value.
pub const EOVERFLOW: i32 = 64;
/// The `EOWNERDEAD` `errno` value.
pub const EOWNERDEAD: i32 = 65;
/// The `EPERM` `errno` value.
pub const EPERM: i32 = 66;
/// The `EPIPE` `errno` value.
pub const EPIPE: i32 = 67;
/// The `EPROTO` `errno` value.
pub const EPROTO: i32 = 68;
/// The `EPROTONOSUPPORT` `errno` value.
pub const EPROTONOSUPPORT: i32 = 69;
/// The `EPROTOTYPE` `errno` value.
pub const EPROTOTYPE: i32 = 70;
/// The `EROFS` `errno` value.
pub const EROFS: i32 = 71;
/// The `ESPIPE` `errno` value.
pub const ESPIPE: i32 = 72;
/// The `ESRCH` `errno` value.
pub const ESRCH: i32 = 73;
/// The `ETIME` `errno` value.
pub const ETIME: i32 = 74;
/// The `ETIMEDOUT` `errno` value.
pub const ETIMEDOUT: i32 = 75;
/// The `ETXTBSY` `errno` value.
pub const ETXTBSY: i32 = 76;
/// The `EWOULDBLOCK` `errno` value.
pub const EWOULDBLOCK: i32 = 77;
/// The `EXDEV` `errno` value.
pub const EXDEV: i32 = 78;
/// The `SIGABRT` signal.
pub const SIGABRT: i32 = 0;
/// The `SIGFPE` signal.
pub const SIGFPE: i32 = 1;
/// The `SIGILL` signal.
pub const SIGILL: i32 = 2;
/// The `SIGINT` signal.
pub const SIGINT: i32 = 3;
/// The `SIGSEGV` signal.
pub const SIGSEGV: i32 = 4;
/// The `SIGTERM` signal.
pub const SIGTERM: i32 = 5;