warpo 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/assemblyscript/std/README.md +5 -0
  2. package/assemblyscript/std/assembly/array.ts +542 -0
  3. package/assemblyscript/std/assembly/arraybuffer.ts +72 -0
  4. package/assemblyscript/std/assembly/builtins.ts +2312 -0
  5. package/assemblyscript/std/assembly/compat.ts +2 -0
  6. package/assemblyscript/std/assembly/dataview.ts +144 -0
  7. package/assemblyscript/std/assembly/date.ts +383 -0
  8. package/assemblyscript/std/assembly/diagnostics.ts +11 -0
  9. package/assemblyscript/std/assembly/error.ts +39 -0
  10. package/assemblyscript/std/assembly/function.ts +44 -0
  11. package/assemblyscript/std/assembly/iterator.ts +24 -0
  12. package/assemblyscript/std/assembly/map.ts +304 -0
  13. package/assemblyscript/std/assembly/math.ts +3401 -0
  14. package/assemblyscript/std/assembly/memory.ts +110 -0
  15. package/assemblyscript/std/assembly/number.ts +388 -0
  16. package/assemblyscript/std/assembly/object.ts +30 -0
  17. package/assemblyscript/std/assembly/polyfills.ts +24 -0
  18. package/assemblyscript/std/assembly/process.ts +7 -0
  19. package/assemblyscript/std/assembly/promise.ts +172 -0
  20. package/assemblyscript/std/assembly/reference.ts +48 -0
  21. package/assemblyscript/std/assembly/regexp.ts +16 -0
  22. package/assemblyscript/std/assembly/rt/common.ts +79 -0
  23. package/assemblyscript/std/assembly/rt/index-incremental.ts +4 -0
  24. package/assemblyscript/std/assembly/rt/index-radical.ts +4 -0
  25. package/assemblyscript/std/assembly/rt/index.d.ts +37 -0
  26. package/assemblyscript/std/assembly/rt/itcms.ts +415 -0
  27. package/assemblyscript/std/assembly/rt/tcms.ts +276 -0
  28. package/assemblyscript/std/assembly/rt/tlsf.ts +564 -0
  29. package/assemblyscript/std/assembly/rt.ts +71 -0
  30. package/assemblyscript/std/assembly/set.ts +261 -0
  31. package/assemblyscript/std/assembly/shared/feature.ts +69 -0
  32. package/assemblyscript/std/assembly/shared/host.ts +12 -0
  33. package/assemblyscript/std/assembly/shared/runtime.ts +9 -0
  34. package/assemblyscript/std/assembly/shared/target.ts +9 -0
  35. package/assemblyscript/std/assembly/shared/tsconfig.json +9 -0
  36. package/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
  37. package/assemblyscript/std/assembly/staticarray.ts +446 -0
  38. package/assemblyscript/std/assembly/string.ts +892 -0
  39. package/assemblyscript/std/assembly/symbol.ts +61 -0
  40. package/assemblyscript/std/assembly/table.ts +15 -0
  41. package/assemblyscript/std/assembly/tsconfig.json +4 -0
  42. package/assemblyscript/std/assembly/tuple.ts +36 -0
  43. package/assemblyscript/std/assembly/typedarray.ts +2000 -0
  44. package/assemblyscript/std/assembly/uri.ts +17 -0
  45. package/assemblyscript/std/assembly/util/bytes.ts +90 -0
  46. package/assemblyscript/std/assembly/util/casemap.ts +264 -0
  47. package/assemblyscript/std/assembly/util/error.ts +54 -0
  48. package/assemblyscript/std/assembly/util/hash.ts +117 -0
  49. package/assemblyscript/std/assembly/util/math.ts +1922 -0
  50. package/assemblyscript/std/assembly/util/memory.ts +309 -0
  51. package/assemblyscript/std/assembly/util/number.ts +884 -0
  52. package/assemblyscript/std/assembly/util/sort.ts +282 -0
  53. package/assemblyscript/std/assembly/util/string.ts +1075 -0
  54. package/assemblyscript/std/assembly/util/uri.ts +251 -0
  55. package/assemblyscript/std/assembly/vector.ts +3 -0
  56. package/dist/debug_server/debugSession.d.ts +1 -0
  57. package/dist/debug_server/debugSession.js +15 -6
  58. package/dist/debug_server/debugSession.js.map +1 -1
  59. package/dist/debug_server/debuggerWasmModule.d.ts +3 -0
  60. package/dist/debug_server/debuggerWasmModule.js +47 -2
  61. package/dist/debug_server/debuggerWasmModule.js.map +1 -1
  62. package/dist/debug_server/tests/debugSession.test.js +96 -0
  63. package/dist/debug_server/tests/debugSession.test.js.map +1 -1
  64. package/dist/debug_server/tests/testModule/debugger_closure_stepping.d.ts +1 -0
  65. package/dist/debug_server/tests/testModule/debugger_closure_stepping.js +12 -0
  66. package/dist/debug_server/tests/testModule/debugger_closure_stepping.js.map +1 -0
  67. package/dist/debug_server/tests/testModule/debugger_std_array.d.ts +1 -0
  68. package/dist/debug_server/tests/testModule/debugger_std_array.js +6 -0
  69. package/dist/debug_server/tests/testModule/debugger_std_array.js.map +1 -0
  70. package/dist/debug_server/tests/testModule/debugger_string_stepping.d.ts +1 -0
  71. package/dist/debug_server/tests/testModule/debugger_string_stepping.js +9 -0
  72. package/dist/debug_server/tests/testModule/debugger_string_stepping.js.map +1 -0
  73. package/package.json +7 -7
  74. package/warpo_extension/std/tsconfig.json +4 -0
  75. package/warpo_extension/std/warpo/ffi.ts +16 -0
  76. package/warpo_extension/std/warpo/test/comparison.ts +122 -0
  77. package/warpo_extension/std/warpo/test/env.ts +33 -0
  78. package/warpo_extension/std/warpo/test/expect.ts +101 -0
  79. package/warpo_extension/std/warpo/test/formatPrint.ts +99 -0
  80. package/warpo_extension/std/warpo/test/implement.ts +41 -0
  81. package/warpo_extension/std/warpo/test/index.d.ts +0 -0
  82. package/warpo_extension/std/warpo/test/index.ts +39 -0
  83. package/warpo_extension/std/warpo/test/mockInstrument.ts +26 -0
  84. package/warpo_extension/std/warpo/utf8/const_str.ts +17 -0
  85. package/warpo_extension/std/wasi_snapshot_preview1/LICENSE +202 -0
  86. package/warpo_extension/std/wasi_snapshot_preview1/README.md +1 -0
  87. package/warpo_extension/std/wasi_snapshot_preview1/bindings/wasi_snapshot_preview1.ts +1731 -0
  88. package/warpo_extension/std/wasi_snapshot_preview1/wasi_console.ts +96 -0
  89. package/warpo_extension/std/wasi_snapshot_preview1/wasi_crypto.ts +8 -0
  90. package/warpo_extension/std/wasi_snapshot_preview1/wasi_date.ts +13 -0
  91. package/warpo_extension/std/wasi_snapshot_preview1/wasi_internal.ts +119 -0
  92. package/warpo_extension/std/wasi_snapshot_preview1/wasi_performance.ts +11 -0
  93. package/warpo_extension/std/wasi_snapshot_preview1/wasi_process.ts +191 -0
@@ -0,0 +1,1731 @@
1
+ // Phase: wasi_snapshot_preview1
2
+ // See: https://github.com/WebAssembly/WASI/tree/main/phases/snapshot/witx
3
+
4
+ // helper types to be more explicit
5
+ type char = u8;
6
+ type ptr<T> = usize; // all pointers are usize'd
7
+ type struct<T> = T; // structs are references already in AS
8
+
9
+ /** Read command-line argument data. */
10
+ // @ts-ignore: decorator
11
+ @unsafe
12
+ export declare function args_get(
13
+ /** Input: Pointer to a buffer to write the argument pointers. */
14
+ argv: ptr<ptr<char>>,
15
+ /** Input: Pointer to a buffer to write the argument string data. */
16
+ argv_buf: ptr<char>
17
+ ): errno;
18
+
19
+ /** Return command-line argument data sizes. */
20
+ // @ts-ignore: decorator
21
+ @unsafe
22
+ export declare function args_sizes_get(
23
+ /** Output: Number of arguments. */
24
+ argc: ptr<usize>,
25
+ /** Output: Size of the argument string data. */
26
+ argv_buf_size: ptr<usize>
27
+ ): errno;
28
+
29
+ /** Return the resolution of a clock. */
30
+ // @ts-ignore: decorator
31
+ @unsafe
32
+ export declare function clock_res_get(
33
+ /** Input: The clock for which to return the resolution. */
34
+ clock: clockid,
35
+ /** Output: The resolution of the clock. */
36
+ resolution: ptr<timestamp>
37
+ ): errno;
38
+
39
+ /** Return the time value of a clock. */
40
+ // @ts-ignore: decorator
41
+ @unsafe
42
+ export declare function clock_time_get(
43
+ /** Input: Cock for which to return the time. */
44
+ clock: clockid,
45
+ /** Input: Maximum lag (exclusive) that the returned time value may have, compared to its actual value. */
46
+ precision: timestamp,
47
+ /** Output: Time value of the clock. */
48
+ time: ptr<timestamp>
49
+ ): errno;
50
+
51
+ /** Read environment variable data. */
52
+ // @ts-ignore: decorator
53
+ @unsafe
54
+ export declare function environ_get(
55
+ /** Input: Pointer to a buffer to write the environment variable pointers. */
56
+ environ: ptr<usize>,
57
+ /** Input: Pointer to a buffer to write the environment variable string data. */
58
+ environ_buf: usize
59
+ ): errno;
60
+
61
+ /** Return command-line argument data sizes. */
62
+ // @ts-ignore: decorator
63
+ @unsafe
64
+ export declare function environ_sizes_get(
65
+ /** Output: The number of environment variables. */
66
+ environ_count: ptr<usize>,
67
+ /** Output: The size of the environment variable string data. */
68
+ environ_buf_size: ptr<usize>
69
+ ): errno;
70
+
71
+ /** Provide file advisory information on a file descriptor. */
72
+ // @ts-ignore: decorator
73
+ @unsafe
74
+ export declare function fd_advise(
75
+ /** Input: The file descriptor for the file for which to provide file advisory information. */
76
+ fd: fd,
77
+ /** Input: The offset within the file to which the advisory applies. */
78
+ offset: filesize,
79
+ /** Input: The length of the region to which the advisory applies. */
80
+ len: filesize,
81
+ /** Input: The advice. */
82
+ advice: advice
83
+ ): errno;
84
+
85
+ /** Provide file advisory information on a file descriptor. */
86
+ // @ts-ignore: decorator
87
+ @unsafe
88
+ export declare function fd_allocate(
89
+ /** Input: The file descriptor for the file in which to allocate space. */
90
+ fd: fd,
91
+ /** Input: The offset at which to start the allocation. */
92
+ offset: filesize,
93
+ /** Input: The length of the area that is allocated. */
94
+ len: filesize
95
+ ): errno;
96
+
97
+ /** Close a file descriptor. */
98
+ // @ts-ignore: decorator
99
+ @unsafe
100
+ export declare function fd_close(
101
+ /** Input: The file descriptor to close. */
102
+ fd: fd
103
+ ): errno;
104
+
105
+ /** Synchronize the data of a file to disk. */
106
+ // @ts-ignore: decorator
107
+ @unsafe
108
+ export declare function fd_datasync(
109
+ /** Input: The file descriptor of the file to synchronize to disk. */
110
+ fd: fd
111
+ ): errno;
112
+
113
+ /** Get the attributes of a file descriptor. */
114
+ // @ts-ignore: decorator
115
+ @unsafe
116
+ export declare function fd_fdstat_get(
117
+ /** Input: The file descriptor to inspect. */
118
+ fd: fd,
119
+ /** Input: The buffer where the file descriptor's attributes are stored. */
120
+ buf: struct<fdstat>
121
+ ): errno;
122
+
123
+ /** Adjust the flags associated with a file descriptor. */
124
+ // @ts-ignore: decorator
125
+ @unsafe
126
+ export declare function fd_fdstat_set_flags(
127
+ /** Input: The file descriptor to operate on. */
128
+ fd: fd,
129
+ /** Input: The desired values of the file descriptor flags. */
130
+ flags: fdflags
131
+ ): errno;
132
+
133
+ /** Adjust the rights associated with a file descriptor. */
134
+ // @ts-ignore: decorator
135
+ @unsafe
136
+ export declare function fd_fdstat_set_rights(
137
+ /** Input: The file descriptor to operate on. */
138
+ fd: fd,
139
+ /** Input: The desired rights of the file descriptor. */
140
+ fs_rights_base: rights,
141
+ /** Input: The desired rights of the file descriptor. */
142
+ fs_rights_inheriting: rights
143
+ ): errno;
144
+
145
+ /** Return the attributes of an open file. */
146
+ // @ts-ignore: decorator
147
+ @unsafe
148
+ export declare function fd_filestat_get(
149
+ /** Input: The file descriptor to inspect. */
150
+ fd: fd,
151
+ /** Input: The buffer where the file's attributes are stored. */
152
+ buf: struct<filestat>
153
+ ): errno;
154
+
155
+ /** Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros. */
156
+ // @ts-ignore: decorator
157
+ @unsafe
158
+ export declare function fd_filestat_set_size(
159
+ /** Input: A file descriptor for the file to adjust. */
160
+ fd: fd,
161
+ /** Input: The desired file size. */
162
+ size: filesize
163
+ ): errno;
164
+
165
+ /** Adjust the timestamps of an open file or directory. */
166
+ // @ts-ignore: decorator
167
+ @unsafe
168
+ export declare function fd_filestat_set_times(
169
+ /** Input: The file descriptor to operate on. */
170
+ fd: fd,
171
+ /** Input: The desired values of the data access timestamp. */
172
+ st_atim: timestamp,
173
+ /** Input: The desired values of the data modification timestamp. */
174
+ st_mtim: timestamp,
175
+ /** Input: A bitmask indicating which timestamps to adjust. */
176
+ fstflags: fstflags
177
+ ): errno;
178
+
179
+ /** Read from a file descriptor, without using and updating the file descriptor's offset. */
180
+ // @ts-ignore: decorator
181
+ @unsafe
182
+ export declare function fd_pread(
183
+ /** Input: The file descriptor from which to read data. */
184
+ fd: fd,
185
+ /** Input: List of scatter/gather vectors in which to store data. */
186
+ iovs: ptr<struct<iovec>>,
187
+ /** Input: Length of the list of scatter/gather vectors in which to store data. */
188
+ iovs_len: usize,
189
+ /** Input: The offset within the file at which to read. */
190
+ offset: filesize,
191
+ /** Output: The number of bytes read. */
192
+ nread: ptr<usize>
193
+ ): errno;
194
+
195
+ /** Return a description of the given preopened file descriptor. */
196
+ // @ts-ignore: decorator
197
+ @unsafe
198
+ export declare function fd_prestat_get(
199
+ /** Input: The file descriptor about which to retrieve information. */
200
+ fd: fd,
201
+ /** Input: The buffer where the description is stored. */
202
+ buf: struct<prestat>
203
+ ): errno;
204
+
205
+ /** Return a description of the given preopened file descriptor. */
206
+ // @ts-ignore: decorator
207
+ @unsafe
208
+ export declare function fd_prestat_dir_name(
209
+ /** Input: The file descriptor about which to retrieve information. */
210
+ fd: fd,
211
+ /** Input: Buffer into which to write the preopened directory name. */
212
+ path: ptr<char>,
213
+ /** Input: Length of the buffer into which to write the preopened directory name. */
214
+ path_len: usize
215
+ ): errno;
216
+
217
+ /** Write to a file descriptor, without using and updating the file descriptor's offset. */
218
+ // @ts-ignore: decorator
219
+ @unsafe
220
+ export declare function fd_pwrite(
221
+ /** Input: The file descriptor to which to write data. */
222
+ fd: fd,
223
+ /** Input: List of scatter/gather vectors from which to retrieve data. */
224
+ iovs: ptr<struct<iovec>>,
225
+ /** Input: Length of the list of scatter/gather vectors from which to retrieve data. */
226
+ iovs_len: usize,
227
+ /** Input: The offset within the file at which to write. */
228
+ offset: filesize,
229
+ /** Output: The number of bytes written. */
230
+ nwritten: ptr<usize>
231
+ ): errno;
232
+
233
+ /** Read from a file descriptor. */
234
+ // @ts-ignore: decorator
235
+ @unsafe
236
+ export declare function fd_read(
237
+ /** Input: The file descriptor from which to read data. */
238
+ fd: fd,
239
+ /** Input: List of scatter/gather vectors to which to store data. */
240
+ iovs: ptr<struct<iovec>>,
241
+ /** Input: Length of the list of scatter/gather vectors to which to store data. */
242
+ iovs_len: usize,
243
+ /** Output: The number of bytes read. */
244
+ nread: ptr<usize>
245
+ ): errno;
246
+
247
+ /** Read directory entries from a directory. */
248
+ // @ts-ignore: decorator
249
+ @unsafe
250
+ export declare function fd_readdir(
251
+ /** Input: Directory from which to read the directory entries. */
252
+ fd: fd,
253
+ /** Input: Buffer where directory entries are stored. */
254
+ buf: ptr<struct<dirent>>,
255
+ /** Input: Length of the buffer where directory entries are stored. */
256
+ buf_len: usize,
257
+ /** Input: Location within the directory to start reading. */
258
+ cookie: dircookie,
259
+ /** Output: Number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached. */
260
+ buf_used: ptr<usize>
261
+ ): errno;
262
+
263
+ /** Atomically replace a file descriptor by renumbering another file descriptor. */
264
+ // @ts-ignore: decorator
265
+ @unsafe
266
+ export declare function fd_renumber(
267
+ /** Input: The file descriptor to renumber. */
268
+ from: fd,
269
+ /** Input: The file descriptor to overwrite. */
270
+ to: fd
271
+ ): errno;
272
+
273
+ /** Move the offset of a file descriptor. */
274
+ // @ts-ignore: decorator
275
+ @unsafe
276
+ export declare function fd_seek(
277
+ /** Input: The file descriptor to operate on. */
278
+ fd: fd,
279
+ /** Input: The number of bytes to move. */
280
+ offset: filedelta,
281
+ /** Input: The base from which the offset is relative. */
282
+ whence: whence,
283
+ /** Output: The new offset of the file descriptor, relative to the start of the file. */
284
+ newoffset: ptr<filesize>
285
+ ): errno;
286
+
287
+ /** Synchronize the data and metadata of a file to disk. */
288
+ // @ts-ignore: decorator
289
+ @unsafe
290
+ export declare function fd_sync(
291
+ /** Input: The file descriptor of the file containing the data and metadata to synchronize to disk. */
292
+ fd: fd
293
+ ): errno;
294
+
295
+ /** Return the current offset of a file descriptor. */
296
+ // @ts-ignore: decorator
297
+ @unsafe
298
+ export declare function fd_tell(
299
+ /** Input: The file descriptor to inspect. */
300
+ fd: fd,
301
+ /** Output: The current offset of the file descriptor, relative to the start of the file. */
302
+ newoffset: ptr<filesize>
303
+ ): errno;
304
+
305
+ /** Write to a file descriptor. */
306
+ // @ts-ignore: decorator
307
+ @unsafe
308
+ export declare function fd_write(
309
+ /** Input: The file descriptor to which to write data. */
310
+ fd: fd,
311
+ /** Input: List of scatter/gather vectors from which to retrieve data. */
312
+ iovs: ptr<struct<iovec>>,
313
+ /** Input: List of scatter/gather vectors from which to retrieve data. */
314
+ iovs_len: usize,
315
+ /** Output: The number of bytes written. */
316
+ nwritten: ptr<usize>
317
+ ): errno;
318
+
319
+ /* Create a directory. */
320
+ // @ts-ignore: decorator
321
+ @unsafe
322
+ export declare function path_create_directory(
323
+ /** Input: The working directory at which the resolution of the path starts. */
324
+ fd: fd,
325
+ /** Input: The path at which to create the directory. */
326
+ path: ptr<char>,
327
+ /** Input: The path at which to create the directory. */
328
+ path_len: usize
329
+ ): errno;
330
+
331
+ /** Return the attributes of a file or directory. */
332
+ // @ts-ignore: decorator
333
+ @unsafe
334
+ export declare function path_filestat_get(
335
+ /** Input: The working directory at which the resolution of the path starts. */
336
+ fd: fd,
337
+ /** Input: Flags determining the method of how the path is resolved. */
338
+ flags: lookupflags,
339
+ /** Input: The path of the file or directory to inspect. */
340
+ path: ptr<char>,
341
+ /** Input: The path of the file or directory to inspect. */
342
+ path_len: usize,
343
+ /** Input: The buffer where the file's attributes are stored. */
344
+ buf: struct<filestat>
345
+ ): errno;
346
+
347
+ /** Adjust the timestamps of a file or directory. */
348
+ // @ts-ignore: decorator
349
+ @unsafe
350
+ export declare function path_filestat_set_times(
351
+ /** Input: The working directory at which the resolution of the path starts. */
352
+ fd: fd,
353
+ /** Input: Flags determining the method of how the path is resolved. */
354
+ flags: lookupflags,
355
+ /** Input: The path of the file or directory to operate on. */
356
+ path: ptr<char>,
357
+ /** Input: The path of the file or directory to operate on. */
358
+ path_len: usize,
359
+ /** Input: The desired values of the data access timestamp. */
360
+ st_atim: timestamp,
361
+ /** Input: The desired values of the data modification timestamp. */
362
+ st_mtim: timestamp,
363
+ /** Input: A bitmask indicating which timestamps to adjust. */
364
+ fstflags: fstflags
365
+ ): errno;
366
+
367
+ /** Create a hard link. */
368
+ // @ts-ignore: decorator
369
+ @unsafe
370
+ export declare function path_link(
371
+ /** Input: The working directory at which the resolution of the old path starts. */
372
+ old_fd: fd,
373
+ /** Input: Flags determining the method of how the path is resolved. */
374
+ old_flags: lookupflags,
375
+ /** Input: The source path from which to link. */
376
+ old_path: ptr<char>,
377
+ /** Input: The source path from which to link. */
378
+ old_path_len: usize,
379
+ /** Input: The working directory at which the resolution of the new path starts. */
380
+ new_fd: fd,
381
+ /** Input: The destination path at which to create the hard link. */
382
+ new_path: ptr<char>,
383
+ /** Input: The length of the destination path at which to create the hard link. */
384
+ new_path_len: usize
385
+ ): errno;
386
+
387
+ /** Open a file or directory. */
388
+ // @ts-ignore: decorator
389
+ @unsafe
390
+ export declare function path_open(
391
+ /** Input: The working directory at which the resolution of the path starts. */
392
+ dirfd: fd,
393
+ /** Input: Flags determining the method of how the path is resolved. */
394
+ dirflags: lookupflags,
395
+ /** Input: The path of the file or directory to open. */
396
+ path: ptr<char>,
397
+ /** Input: The length of the path of the file or directory to open. */
398
+ path_len: usize,
399
+ /** Input: The method by which to open the file. */
400
+ oflags: oflags,
401
+ /** Input: The initial base rights that apply to operations using the file descriptor itself. */
402
+ fs_rights_base: rights,
403
+ /** Input: The initial inheriting rights that apply to file descriptors derived from it. */
404
+ fs_rights_inheriting: rights,
405
+ /** Input: The initial flags of the file descriptor. */
406
+ fs_flags: fdflags,
407
+ /** Output: The file descriptor of the file that has been opened. */
408
+ fd: ptr<fd>
409
+ ): errno;
410
+
411
+ /** Read the contents of a symbolic link. */
412
+ // @ts-ignore: decorator
413
+ @unsafe
414
+ export declare function path_readlink(
415
+ /** Input: The working directory at which the resolution of the path starts. */
416
+ fd: fd,
417
+ /** Input: The path of the symbolic link from which to read. */
418
+ path: ptr<char>,
419
+ /** Input: The length of the path of the symbolic link from which to read. */
420
+ path_len: usize,
421
+ /** Input: The buffer to which to write the contents of the symbolic link. */
422
+ buf: ptr<char>,
423
+ /** Input: The length of the buffer to which to write the contents of the symbolic link. */
424
+ buf_len: usize,
425
+ /** Output: The number of bytes placed in the buffer. */
426
+ buf_used: ptr<usize>
427
+ ): errno;
428
+
429
+ /** Remove a directory. */
430
+ // @ts-ignore: decorator
431
+ @unsafe
432
+ export declare function path_remove_directory(
433
+ /** Input: The working directory at which the resolution of the path starts. */
434
+ fd: fd,
435
+ /** Input: The path to a directory to remove. */
436
+ path: ptr<char>,
437
+ /** Input: The length of the path to a directory to remove. */
438
+ path_len: usize
439
+ ): errno;
440
+
441
+ /** Rename a file or directory. */
442
+ // @ts-ignore: decorator
443
+ @unsafe
444
+ export declare function path_rename(
445
+ /** Input: The working directory at which the resolution of the old path starts. */
446
+ old_fd: fd,
447
+ /** Input: The source path of the file or directory to rename. */
448
+ old_path: ptr<char>,
449
+ /** Input: The length of the source path of the file or directory to rename. */
450
+ old_path_len: usize,
451
+ /** Input: The working directory at which the resolution of the new path starts. */
452
+ new_fd: fd,
453
+ /** Input: The destination path to which to rename the file or directory. */
454
+ new_path: ptr<char>,
455
+ /** Input: The length of the destination path to which to rename the file or directory. */
456
+ new_path_len: usize
457
+ ): errno;
458
+
459
+ /** Create a symbolic link. */
460
+ // @ts-ignore: decorator
461
+ @unsafe
462
+ export declare function path_symlink(
463
+ /** Input: The contents of the symbolic link. */
464
+ old_path: ptr<char>,
465
+ /** Input: The length of the contents of the symbolic link. */
466
+ old_path_len: usize,
467
+ /** Input: The working directory at which the resolution of the path starts. */
468
+ fd: fd,
469
+ /** Input: The destination path at which to create the symbolic link. */
470
+ new_path: ptr<char>,
471
+ /** Input: The length of the destination path at which to create the symbolic link. */
472
+ new_path_len: usize
473
+ ): errno;
474
+
475
+ /** Unlink a file. */
476
+ // @ts-ignore: decorator
477
+ @unsafe
478
+ export declare function path_unlink_file(
479
+ /** Input: The working directory at which the resolution of the path starts. */
480
+ fd: fd,
481
+ /** Input: The path to a file to unlink. */
482
+ path: ptr<char>,
483
+ /** Input: The length of the path to a file to unlink. */
484
+ path_len: usize
485
+ ): errno;
486
+
487
+ /** Concurrently poll for the occurrence of a set of events. */
488
+ // @ts-ignore: decorator
489
+ @unsafe
490
+ export declare function poll_oneoff(
491
+ /** Input: The events to which to subscribe. */
492
+ in_: ptr<struct<subscription>>,
493
+ /** Input: The events that have occurred. */
494
+ out: ptr<struct<event>>,
495
+ /** Input: Both the number of subscriptions and events. */
496
+ nsubscriptions: usize,
497
+ /** Output: The number of events stored. */
498
+ nevents: ptr<usize>
499
+ ): errno;
500
+
501
+ /** Terminate the process normally. An exit code of 0 indicates successful termination of the program. The meanings of other values is dependent on the environment. */
502
+ // @ts-ignore: decorator
503
+ @unsafe
504
+ export declare function proc_exit(
505
+ /** Input: The exit code returned by the process. */
506
+ rval: u32
507
+ ): void;
508
+
509
+ /** Send a signal to the process of the calling thread. */
510
+ // @ts-ignore: decorator
511
+ @unsafe
512
+ export declare function proc_raise(
513
+ /** Input: The signal condition to trigger. */
514
+ sig: signal
515
+ ): errno;
516
+
517
+ /** Write high-quality random data into a buffer. */
518
+ // @ts-ignore: decorator
519
+ @unsafe
520
+ export declare function random_get(
521
+ /** Input: The buffer to fill with random data. */
522
+ buf: usize,
523
+ /** Input: The length of the buffer to fill with random data. */
524
+ buf_len: usize
525
+ ): errno;
526
+
527
+ /** Temporarily yield execution of the calling thread. */
528
+ // @ts-ignore: decorator
529
+ @unsafe
530
+ export declare function sched_yield(): errno;
531
+
532
+ /** Receive a message from a socket. */
533
+ // @ts-ignore: decorator
534
+ @unsafe
535
+ export declare function sock_recv(
536
+ /** Input: The socket on which to receive data. */
537
+ sock: fd,
538
+ /** Input: List of scatter/gather vectors to which to store data. */
539
+ ri_data: ptr<struct<iovec>>,
540
+ /** Input: The length of the list of scatter/gather vectors to which to store data. */
541
+ ri_data_len: usize,
542
+ /** Input: Message flags. */
543
+ ri_flags: riflags,
544
+ /** Output: Number of bytes stored in `ri_data`. */
545
+ ro_datalen: ptr<usize>,
546
+ /** Output: Message flags. */
547
+ ro_flags: ptr<roflags>
548
+ ): errno;
549
+
550
+ /** Send a message on a socket. */
551
+ // @ts-ignore: decorator
552
+ @unsafe
553
+ export declare function sock_send(
554
+ /** Input: The socket on which to send data. */
555
+ sock: fd,
556
+ /** Input: List of scatter/gather vectors to which to retrieve data */
557
+ si_data: ptr<struct<iovec>>,
558
+ /** Input: The length of the list of scatter/gather vectors to which to retrieve data */
559
+ si_data_len: usize,
560
+ /** Input: Message flags. */
561
+ si_flags: siflags,
562
+ /** Output: Number of bytes transmitted. */
563
+ so_datalen: ptr<usize>
564
+ ): errno;
565
+
566
+ /** Shut down socket send and receive channels. */
567
+ // @ts-ignore: decorator
568
+ @unsafe
569
+ export declare function sock_shutdown(
570
+ /** Input: The socket on which to shutdown channels. */
571
+ sock: fd,
572
+ /** Input: Which channels on the socket to shut down. */
573
+ how: sdflags
574
+ ): errno;
575
+
576
+ // === Types ======================================================================================
577
+
578
+ /** File or memory access pattern advisory information. */
579
+ export namespace advice {
580
+ /** The application has no advice to give on its behavior with respect to the specified data. */
581
+ // @ts-ignore: decorator
582
+ @inline
583
+ export const NORMAL: advice = 0;
584
+ /** The application expects to access the specified data sequentially from lower offsets to higher offsets. */
585
+ // @ts-ignore: decorator
586
+ @inline
587
+ export const SEQUENTIAL: advice = 1;
588
+ /** The application expects to access the specified data in a random order. */
589
+ // @ts-ignore: decorator
590
+ @inline
591
+ export const RANDOM: advice = 2;
592
+ /** The application expects to access the specified data in the near future. */
593
+ // @ts-ignore: decorator
594
+ @inline
595
+ export const WILLNEED: advice = 3;
596
+ /** The application expects that it will not access the specified data in the near future. */
597
+ // @ts-ignore: decorator
598
+ @inline
599
+ export const DONTNEED: advice = 4;
600
+ /** The application expects to access the specified data once and then not reuse it thereafter. */
601
+ // @ts-ignore: decorator
602
+ @inline
603
+ export const NOREUSE: advice = 5;
604
+ }
605
+ export type advice = u8;
606
+
607
+ /** Identifiers for clocks. */
608
+ export namespace clockid {
609
+ /** The clock measuring real time. Time value zero corresponds with 1970-01-01T00:00:00Z. */
610
+ // @ts-ignore: decorator
611
+ @inline
612
+ export const REALTIME: clockid = 0;
613
+ /** The store-wide monotonic clock. Absolute value has no meaning. */
614
+ // @ts-ignore: decorator
615
+ @inline
616
+ export const MONOTONIC: clockid = 1;
617
+ /** The CPU-time clock associated with the current process. */
618
+ // @ts-ignore: decorator
619
+ @inline
620
+ export const PROCESS_CPUTIME_ID: clockid = 2;
621
+ /** The CPU-time clock associated with the current thread. */
622
+ // @ts-ignore: decorator
623
+ @inline
624
+ export const THREAD_CPUTIME_ID: clockid = 3;
625
+ }
626
+ export type clockid = u32;
627
+
628
+ /** Identifier for a device containing a file system. Can be used in combination with `inode` to uniquely identify a file or directory in the filesystem. */
629
+ export type device = u64;
630
+
631
+ /** A reference to the offset of a directory entry. The value 0 signifies the start of the directory. */
632
+ export type dircookie = u64;
633
+
634
+ /** A directory entry. */
635
+ @unmanaged export class dirent {
636
+ /** The offset of the next directory entry stored in this directory. */
637
+ next: dircookie;
638
+ /** The serial number of the file referred to by this directory entry. */
639
+ ino: inode;
640
+ /** The length of the name of the directory entry. */
641
+ namlen: u32;
642
+ /** The type of the file referred to by this directory entry. */
643
+ type: filetype;
644
+ private __padding0: u16;
645
+ }
646
+
647
+ /** Error codes returned by functions. */
648
+ export namespace errno {
649
+ /** No error occurred. System call completed successfully. */
650
+ // @ts-ignore: decorator
651
+ @inline
652
+ export const SUCCESS: errno = 0;
653
+ /** Argument list too long. */
654
+ // @ts-ignore: decorator
655
+ @inline
656
+ export const TOOBIG: errno = 1;
657
+ /** Permission denied. */
658
+ // @ts-ignore: decorator
659
+ @inline
660
+ export const ACCES: errno = 2;
661
+ /** Address in use. */
662
+ // @ts-ignore: decorator
663
+ @inline
664
+ export const ADDRINUSE: errno = 3;
665
+ /** Address not available. */
666
+ // @ts-ignore: decorator
667
+ @inline
668
+ export const ADDRNOTAVAIL: errno = 4;
669
+ /** Address family not supported. */
670
+ // @ts-ignore: decorator
671
+ @inline
672
+ export const AFNOSUPPORT: errno = 5;
673
+ /** Resource unavailable, or operation would block. */
674
+ // @ts-ignore: decorator
675
+ @inline
676
+ export const AGAIN: errno = 6;
677
+ /** Connection already in progress. */
678
+ // @ts-ignore: decorator
679
+ @inline
680
+ export const ALREADY: errno = 7;
681
+ /** Bad file descriptor. */
682
+ // @ts-ignore: decorator
683
+ @inline
684
+ export const BADF: errno = 8;
685
+ /** Bad message. */
686
+ // @ts-ignore: decorator
687
+ @inline
688
+ export const BADMSG: errno = 9;
689
+ /** Device or resource busy. */
690
+ // @ts-ignore: decorator
691
+ @inline
692
+ export const BUSY: errno = 10;
693
+ /** Operation canceled. */
694
+ // @ts-ignore: decorator
695
+ @inline
696
+ export const CANCELED: errno = 11;
697
+ /** No child processes. */
698
+ // @ts-ignore: decorator
699
+ @inline
700
+ export const CHILD: errno = 12;
701
+ /** Connection aborted. */
702
+ // @ts-ignore: decorator
703
+ @inline
704
+ export const CONNABORTED: errno = 13;
705
+ /** Connection refused. */
706
+ // @ts-ignore: decorator
707
+ @inline
708
+ export const CONNREFUSED: errno = 14;
709
+ /** Connection reset. */
710
+ // @ts-ignore: decorator
711
+ @inline
712
+ export const CONNRESET: errno = 15;
713
+ /** Resource deadlock would occur. */
714
+ // @ts-ignore: decorator
715
+ @inline
716
+ export const DEADLK: errno = 16;
717
+ /** Destination address required. */
718
+ // @ts-ignore: decorator
719
+ @inline
720
+ export const DESTADDRREQ: errno = 17;
721
+ /** Mathematics argument out of domain of function. */
722
+ // @ts-ignore: decorator
723
+ @inline
724
+ export const DOM: errno = 18;
725
+ /** Reserved. */
726
+ // @ts-ignore: decorator
727
+ @inline
728
+ export const DQUOT: errno = 19;
729
+ /** File exists. */
730
+ // @ts-ignore: decorator
731
+ @inline
732
+ export const EXIST: errno = 20;
733
+ /** Bad address. */
734
+ // @ts-ignore: decorator
735
+ @inline
736
+ export const FAULT: errno = 21;
737
+ /** File too large. */
738
+ // @ts-ignore: decorator
739
+ @inline
740
+ export const FBIG: errno = 22;
741
+ /** Host is unreachable. */
742
+ // @ts-ignore: decorator
743
+ @inline
744
+ export const HOSTUNREACH: errno = 23;
745
+ /** Identifier removed. */
746
+ // @ts-ignore: decorator
747
+ @inline
748
+ export const IDRM: errno = 24;
749
+ /** Illegal byte sequence. */
750
+ // @ts-ignore: decorator
751
+ @inline
752
+ export const ILSEQ: errno = 25;
753
+ /** Operation in progress. */
754
+ // @ts-ignore: decorator
755
+ @inline
756
+ export const INPROGRESS: errno = 26;
757
+ /** Interrupted function. */
758
+ // @ts-ignore: decorator
759
+ @inline
760
+ export const INTR: errno = 27;
761
+ /** Invalid argument. */
762
+ // @ts-ignore: decorator
763
+ @inline
764
+ export const INVAL: errno = 28;
765
+ /** I/O error. */
766
+ // @ts-ignore: decorator
767
+ @inline
768
+ export const IO: errno = 29;
769
+ /** Socket is connected. */
770
+ // @ts-ignore: decorator
771
+ @inline
772
+ export const ISCONN: errno = 30;
773
+ /** Is a directory. */
774
+ // @ts-ignore: decorator
775
+ @inline
776
+ export const ISDIR: errno = 31;
777
+ /** Too many levels of symbolic links. */
778
+ // @ts-ignore: decorator
779
+ @inline
780
+ export const LOOP: errno = 32;
781
+ /** File descriptor value too large. */
782
+ // @ts-ignore: decorator
783
+ @inline
784
+ export const MFILE: errno = 33;
785
+ /** Too many links. */
786
+ // @ts-ignore: decorator
787
+ @inline
788
+ export const MLINK: errno = 34;
789
+ /** Message too large. */
790
+ // @ts-ignore: decorator
791
+ @inline
792
+ export const MSGSIZE: errno = 35;
793
+ /** Reserved. */
794
+ // @ts-ignore: decorator
795
+ @inline
796
+ export const MULTIHOP: errno = 36;
797
+ /** Filename too long. */
798
+ // @ts-ignore: decorator
799
+ @inline
800
+ export const NAMETOOLONG: errno = 37;
801
+ /** Network is down. */
802
+ // @ts-ignore: decorator
803
+ @inline
804
+ export const NETDOWN: errno = 38;
805
+ /** Connection aborted by network. */
806
+ // @ts-ignore: decorator
807
+ @inline
808
+ export const NETRESET: errno = 39;
809
+ /** Network unreachable. */
810
+ // @ts-ignore: decorator
811
+ @inline
812
+ export const NETUNREACH: errno = 40;
813
+ /** Too many files open in system. */
814
+ // @ts-ignore: decorator
815
+ @inline
816
+ export const NFILE: errno = 41;
817
+ /** No buffer space available. */
818
+ // @ts-ignore: decorator
819
+ @inline
820
+ export const NOBUFS: errno = 42;
821
+ /** No such device. */
822
+ // @ts-ignore: decorator
823
+ @inline
824
+ export const NODEV: errno = 43;
825
+ /** No such file or directory. */
826
+ // @ts-ignore: decorator
827
+ @inline
828
+ export const NOENT: errno = 44;
829
+ /** Executable file format error. */
830
+ // @ts-ignore: decorator
831
+ @inline
832
+ export const NOEXEC: errno = 45;
833
+ /** No locks available. */
834
+ // @ts-ignore: decorator
835
+ @inline
836
+ export const NOLCK: errno = 46;
837
+ /** Reserved. */
838
+ // @ts-ignore: decorator
839
+ @inline
840
+ export const NOLINK: errno = 47;
841
+ /** Not enough space. */
842
+ // @ts-ignore: decorator
843
+ @inline
844
+ export const NOMEM: errno = 48;
845
+ /** No message of the desired type. */
846
+ // @ts-ignore: decorator
847
+ @inline
848
+ export const NOMSG: errno = 49;
849
+ /** Protocol not available. */
850
+ // @ts-ignore: decorator
851
+ @inline
852
+ export const NOPROTOOPT: errno = 50;
853
+ /** No space left on device. */
854
+ // @ts-ignore: decorator
855
+ @inline
856
+ export const NOSPC: errno = 51;
857
+ /** Function not supported. */
858
+ // @ts-ignore: decorator
859
+ @inline
860
+ export const NOSYS: errno = 52;
861
+ /** The socket is not connected. */
862
+ // @ts-ignore: decorator
863
+ @inline
864
+ export const NOTCONN: errno = 53;
865
+ /** Not a directory or a symbolic link to a directory. */
866
+ // @ts-ignore: decorator
867
+ @inline
868
+ export const NOTDIR: errno = 54;
869
+ /** Directory not empty. */
870
+ // @ts-ignore: decorator
871
+ @inline
872
+ export const NOTEMPTY: errno = 55;
873
+ /** State not recoverable. */
874
+ // @ts-ignore: decorator
875
+ @inline
876
+ export const NOTRECOVERABLE: errno = 56;
877
+ /** Not a socket. */
878
+ // @ts-ignore: decorator
879
+ @inline
880
+ export const NOTSOCK: errno = 57;
881
+ /** Not supported, or operation not supported on socket. */
882
+ // @ts-ignore: decorator
883
+ @inline
884
+ export const NOTSUP: errno = 58;
885
+ /** Inappropriate I/O control operation. */
886
+ // @ts-ignore: decorator
887
+ @inline
888
+ export const NOTTY: errno = 59;
889
+ /** No such device or address. */
890
+ // @ts-ignore: decorator
891
+ @inline
892
+ export const NXIO: errno = 60;
893
+ /** Value too large to be stored in data type. */
894
+ // @ts-ignore: decorator
895
+ @inline
896
+ export const OVERFLOW: errno = 61;
897
+ /** Previous owner died. */
898
+ // @ts-ignore: decorator
899
+ @inline
900
+ export const OWNERDEAD: errno = 62;
901
+ /** Operation not permitted. */
902
+ // @ts-ignore: decorator
903
+ @inline
904
+ export const PERM: errno = 63;
905
+ /** Broken pipe. */
906
+ // @ts-ignore: decorator
907
+ @inline
908
+ export const PIPE: errno = 64;
909
+ /** Protocol error. */
910
+ // @ts-ignore: decorator
911
+ @inline
912
+ export const PROTO: errno = 65;
913
+ /** Protocol not supported. */
914
+ // @ts-ignore: decorator
915
+ @inline
916
+ export const PROTONOSUPPORT: errno = 66;
917
+ /** Protocol wrong type for socket. */
918
+ // @ts-ignore: decorator
919
+ @inline
920
+ export const PROTOTYPE: errno = 67;
921
+ /** Result too large. */
922
+ // @ts-ignore: decorator
923
+ @inline
924
+ export const RANGE: errno = 68;
925
+ /** Read-only file system. */
926
+ // @ts-ignore: decorator
927
+ @inline
928
+ export const ROFS: errno = 69;
929
+ /** Invalid seek. */
930
+ // @ts-ignore: decorator
931
+ @inline
932
+ export const SPIPE: errno = 70;
933
+ /** No such process. */
934
+ // @ts-ignore: decorator
935
+ @inline
936
+ export const SRCH: errno = 71;
937
+ /** Reserved. */
938
+ // @ts-ignore: decorator
939
+ @inline
940
+ export const STALE: errno = 72;
941
+ /** Connection timed out. */
942
+ // @ts-ignore: decorator
943
+ @inline
944
+ export const TIMEDOUT: errno = 73;
945
+ /** Text file busy. */
946
+ // @ts-ignore: decorator
947
+ @inline
948
+ export const TXTBSY: errno = 74;
949
+ /** Cross-device link. */
950
+ // @ts-ignore: decorator
951
+ @inline
952
+ export const XDEV: errno = 75;
953
+ /** Extension: Capabilities insufficient. */
954
+ // @ts-ignore: decorator
955
+ @inline
956
+ export const NOTCAPABLE: errno = 76;
957
+ }
958
+ export type errno = u16;
959
+
960
+ /** Translates an error code to a string. */
961
+ export function errnoToString(err: errno): string {
962
+ switch (err) {
963
+ case errno.SUCCESS:
964
+ return "SUCCESS";
965
+ case errno.TOOBIG:
966
+ return "TOOBIG";
967
+ case errno.ACCES:
968
+ return "ACCES";
969
+ case errno.ADDRINUSE:
970
+ return "ADDRINUSE";
971
+ case errno.ADDRNOTAVAIL:
972
+ return "ADDRNOTAVAIL";
973
+ case errno.AFNOSUPPORT:
974
+ return "AFNOSUPPORT";
975
+ case errno.AGAIN:
976
+ return "AGAIN";
977
+ case errno.ALREADY:
978
+ return "ALREADY";
979
+ case errno.BADF:
980
+ return "BADF";
981
+ case errno.BADMSG:
982
+ return "BADMSG";
983
+ case errno.BUSY:
984
+ return "BUSY";
985
+ case errno.CANCELED:
986
+ return "CANCELED";
987
+ case errno.CHILD:
988
+ return "CHILD";
989
+ case errno.CONNABORTED:
990
+ return "CONNABORTED";
991
+ case errno.CONNREFUSED:
992
+ return "CONNREFUSED";
993
+ case errno.CONNRESET:
994
+ return "CONNRESET";
995
+ case errno.DEADLK:
996
+ return "DEADLK";
997
+ case errno.DESTADDRREQ:
998
+ return "DESTADDRREQ";
999
+ case errno.DOM:
1000
+ return "DOM";
1001
+ case errno.DQUOT:
1002
+ return "DQUOT";
1003
+ case errno.EXIST:
1004
+ return "EXIST";
1005
+ case errno.FAULT:
1006
+ return "FAULT";
1007
+ case errno.FBIG:
1008
+ return "FBIG";
1009
+ case errno.HOSTUNREACH:
1010
+ return "HOSTUNREACH";
1011
+ case errno.IDRM:
1012
+ return "IDRM";
1013
+ case errno.ILSEQ:
1014
+ return "ILSEQ";
1015
+ case errno.INPROGRESS:
1016
+ return "INPROGRESS";
1017
+ case errno.INTR:
1018
+ return "INTR";
1019
+ case errno.INVAL:
1020
+ return "INVAL";
1021
+ case errno.IO:
1022
+ return "IO";
1023
+ case errno.ISCONN:
1024
+ return "ISCONN";
1025
+ case errno.ISDIR:
1026
+ return "ISDIR";
1027
+ case errno.LOOP:
1028
+ return "LOOP";
1029
+ case errno.MFILE:
1030
+ return "MFILE";
1031
+ case errno.MLINK:
1032
+ return "MLINK";
1033
+ case errno.MSGSIZE:
1034
+ return "MSGSIZE";
1035
+ case errno.MULTIHOP:
1036
+ return "MULTIHOP";
1037
+ case errno.NAMETOOLONG:
1038
+ return "NAMETOOLONG";
1039
+ case errno.NETDOWN:
1040
+ return "NETDOWN";
1041
+ case errno.NETRESET:
1042
+ return "NETRESET";
1043
+ case errno.NETUNREACH:
1044
+ return "NETUNREACH";
1045
+ case errno.NFILE:
1046
+ return "NFILE";
1047
+ case errno.NOBUFS:
1048
+ return "NOBUFS";
1049
+ case errno.NODEV:
1050
+ return "NODEV";
1051
+ case errno.NOENT:
1052
+ return "NOENT";
1053
+ case errno.NOEXEC:
1054
+ return "NOEXEC";
1055
+ case errno.NOLCK:
1056
+ return "NOLCK";
1057
+ case errno.NOLINK:
1058
+ return "NOLINK";
1059
+ case errno.NOMEM:
1060
+ return "NOMEM";
1061
+ case errno.NOMSG:
1062
+ return "NOMSG";
1063
+ case errno.NOPROTOOPT:
1064
+ return "NOPROTOOPT";
1065
+ case errno.NOSPC:
1066
+ return "NOSPC";
1067
+ case errno.NOSYS:
1068
+ return "NOSYS";
1069
+ case errno.NOTCONN:
1070
+ return "NOTCONN";
1071
+ case errno.NOTDIR:
1072
+ return "NOTDIR";
1073
+ case errno.NOTEMPTY:
1074
+ return "NOTEMPTY";
1075
+ case errno.NOTRECOVERABLE:
1076
+ return "NOTRECOVERABLE";
1077
+ case errno.NOTSOCK:
1078
+ return "NOTSOCK";
1079
+ case errno.NOTSUP:
1080
+ return "NOTSUP";
1081
+ case errno.NOTTY:
1082
+ return "NOTTY";
1083
+ case errno.NXIO:
1084
+ return "NXIO";
1085
+ case errno.OVERFLOW:
1086
+ return "OVERFLOW";
1087
+ case errno.OWNERDEAD:
1088
+ return "OWNERDEAD";
1089
+ case errno.PERM:
1090
+ return "PERM";
1091
+ case errno.PIPE:
1092
+ return "PIPE";
1093
+ case errno.PROTO:
1094
+ return "PROTO";
1095
+ case errno.PROTONOSUPPORT:
1096
+ return "PROTONOSUPPORT";
1097
+ case errno.PROTOTYPE:
1098
+ return "PROTOTYPE";
1099
+ case errno.RANGE:
1100
+ return "RANGE";
1101
+ case errno.ROFS:
1102
+ return "ROFS";
1103
+ case errno.SPIPE:
1104
+ return "SPIPE";
1105
+ case errno.SRCH:
1106
+ return "SRCH";
1107
+ case errno.STALE:
1108
+ return "STALE";
1109
+ case errno.TIMEDOUT:
1110
+ return "TIMEDOUT";
1111
+ case errno.TXTBSY:
1112
+ return "TXTBSY";
1113
+ case errno.XDEV:
1114
+ return "XDEV";
1115
+ case errno.NOTCAPABLE:
1116
+ return "NOTCAPABLE";
1117
+ }
1118
+ return "UNKNOWN";
1119
+ }
1120
+
1121
+
1122
+ @unmanaged abstract class $event {
1123
+ // size=16/32
1124
+ /** User-provided value that got attached to `subscription#userdata`. */
1125
+ userdata: userdata;
1126
+ /** If non-zero, an error that occurred while processing the subscription request. */
1127
+ error: errno;
1128
+ /** The type of the event that occurred. */
1129
+ type: eventtype;
1130
+
1131
+ private __padding0: u16;
1132
+ }
1133
+
1134
+ /** An event that occurred. */
1135
+ @unmanaged export abstract class event extends $event {
1136
+ private __padding1: u64;
1137
+ private __padding2: u64;
1138
+ }
1139
+
1140
+ /** An event that occurred when type is `eventtype.FD_READ` or `eventtype.FD_WRITE`. */
1141
+ @unmanaged export class event_fd_readwrite extends $event {
1142
+ /* The number of bytes available for reading or writing. */
1143
+ nbytes: filesize;
1144
+ /* The state of the file descriptor. */
1145
+ flags: eventrwflags;
1146
+
1147
+ private __padding1: u32;
1148
+ }
1149
+
1150
+ /** The state of the file descriptor subscribed to with `eventtype.FD_READ` or `eventtype.FD_WRITE`. */
1151
+ export namespace eventrwflags {
1152
+ /** The peer of this socket has closed or disconnected. */
1153
+ // @ts-ignore: decorator
1154
+ @inline
1155
+ export const HANGUP: eventrwflags = 1;
1156
+ }
1157
+ export type eventrwflags = u16;
1158
+
1159
+ /** Type of a subscription to an event or its occurrence. */
1160
+ export namespace eventtype {
1161
+ /** The time value of clock has reached the timestamp. */
1162
+ // @ts-ignore: decorator
1163
+ @inline
1164
+ export const CLOCK: eventtype = 0;
1165
+ /** File descriptor has data available for reading. */
1166
+ // @ts-ignore: decorator
1167
+ @inline
1168
+ export const FD_READ: eventtype = 1;
1169
+ /** File descriptor has capacity available for writing */
1170
+ // @ts-ignore: decorator
1171
+ @inline
1172
+ export const FD_WRITE: eventtype = 2;
1173
+ }
1174
+ export type eventtype = u8;
1175
+
1176
+ /** Exit code generated by a process when exiting. */
1177
+ export type exitcode = u32;
1178
+
1179
+ /** A file descriptor number. */
1180
+ export type fd = u32;
1181
+
1182
+ /** File descriptor flags. */
1183
+ export namespace fdflags {
1184
+ /** Append mode: Data written to the file is always appended to the file's end. */
1185
+ // @ts-ignore: decorator
1186
+ @inline
1187
+ export const APPEND: fdflags = 1;
1188
+ /** Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. */
1189
+ // @ts-ignore: decorator
1190
+ @inline
1191
+ export const DSYNC: fdflags = 2;
1192
+ /** Non-blocking mode. */
1193
+ // @ts-ignore: decorator
1194
+ @inline
1195
+ export const NONBLOCK: fdflags = 4;
1196
+ /** Synchronized read I/O operations. */
1197
+ // @ts-ignore: decorator
1198
+ @inline
1199
+ export const RSYNC: fdflags = 8;
1200
+ /** Write according to synchronized I/O file integrity completion. */
1201
+ // @ts-ignore: decorator
1202
+ @inline
1203
+ export const SYNC: fdflags = 16;
1204
+ }
1205
+ export type fdflags = u16;
1206
+
1207
+ /** File descriptor attributes. */
1208
+ @unmanaged export class fdstat {
1209
+ /** File type. */
1210
+ filetype: filetype;
1211
+ /** File descriptor flags. */
1212
+ flags: fdflags;
1213
+ /** Rights that apply to this file descriptor. */
1214
+ rights_base: rights;
1215
+ /** Maximum set of rights that may be installed on new file descriptors that are created through this file descriptor, e.g., through `path_open`. */
1216
+ rights_inheriting: rights;
1217
+ }
1218
+
1219
+ /** Relative offset within a file. */
1220
+ export type filedelta = i64;
1221
+
1222
+ /** Non-negative file size or length of a region within a file. */
1223
+ export type filesize = u64;
1224
+
1225
+ /** File attributes. */
1226
+ @unmanaged export class filestat {
1227
+ /** Device ID of device containing the file. */
1228
+ dev: device;
1229
+ /** File serial number. */
1230
+ ino: inode;
1231
+ /** File type. */
1232
+ filetype: filetype;
1233
+ /** Number of hard links to the file. */
1234
+ nlink: linkcount;
1235
+ /** For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. */
1236
+ size: filesize;
1237
+ /** Last data access timestamp. */
1238
+ atim: timestamp;
1239
+ /** Last data modification timestamp. */
1240
+ mtim: timestamp;
1241
+ /** Last file status change timestamp. */
1242
+ ctim: timestamp;
1243
+ }
1244
+
1245
+ /** The type of a file descriptor or file. */
1246
+ export namespace filetype {
1247
+ /** The type of the file descriptor or file is unknown or is different from any of the other types specified. */
1248
+ // @ts-ignore: decorator
1249
+ @inline
1250
+ export const UNKNOWN: filetype = 0;
1251
+ /** The file descriptor or file refers to a block device inode. */
1252
+ // @ts-ignore: decorator
1253
+ @inline
1254
+ export const BLOCK_DEVICE: filetype = 1;
1255
+ /** The file descriptor or file refers to a character device inode. */
1256
+ // @ts-ignore: decorator
1257
+ @inline
1258
+ export const CHARACTER_DEVICE: filetype = 2;
1259
+ /** The file descriptor or file refers to a directory inode. */
1260
+ // @ts-ignore: decorator
1261
+ @inline
1262
+ export const DIRECTORY: filetype = 3;
1263
+ /** The file descriptor or file refers to a regular file inode. */
1264
+ // @ts-ignore: decorator
1265
+ @inline
1266
+ export const REGULAR_FILE: filetype = 4;
1267
+ /** The file descriptor or file refers to a datagram socket. */
1268
+ // @ts-ignore: decorator
1269
+ @inline
1270
+ export const SOCKET_DGRAM: filetype = 5;
1271
+ /** The file descriptor or file refers to a byte-stream socket. */
1272
+ // @ts-ignore: decorator
1273
+ @inline
1274
+ export const SOCKET_STREAM: filetype = 6;
1275
+ /** The file refers to a symbolic link inode. */
1276
+ // @ts-ignore: decorator
1277
+ @inline
1278
+ export const SYMBOLIC_LINK: filetype = 7;
1279
+ }
1280
+ export type filetype = u8;
1281
+
1282
+ /** Which file time attributes to adjust. */
1283
+ export namespace fstflags {
1284
+ /** Adjust the last data access timestamp to the value stored in `filestat#st_atim`. */
1285
+ // @ts-ignore: decorator
1286
+ @inline
1287
+ export const SET_ATIM: fstflags = 1;
1288
+ /** Adjust the last data access timestamp to the time of clock `clockid.REALTIME`. */
1289
+ // @ts-ignore: decorator
1290
+ @inline
1291
+ export const SET_ATIM_NOW: fstflags = 2;
1292
+ /** Adjust the last data modification timestamp to the value stored in `filestat#st_mtim`. */
1293
+ // @ts-ignore: decorator
1294
+ @inline
1295
+ export const SET_MTIM: fstflags = 4;
1296
+ /** Adjust the last data modification timestamp to the time of clock `clockid.REALTIME`. */
1297
+ // @ts-ignore: decorator
1298
+ @inline
1299
+ export const SET_MTIM_NOW: fstflags = 8;
1300
+ }
1301
+ export type fstflags = u16;
1302
+
1303
+ /** File serial number that is unique within its file system. */
1304
+ export type inode = u64;
1305
+
1306
+ /** A region of memory for scatter/gather reads. */
1307
+ @unmanaged export class iovec {
1308
+ /** The address of the buffer to be filled. */
1309
+ buf: usize;
1310
+ /** The length of the buffer to be filled. */
1311
+ buf_len: usize;
1312
+ }
1313
+
1314
+ /** Number of hard links to an inode. */
1315
+ export type linkcount = u64;
1316
+
1317
+ /** Flags determining the method of how paths are resolved. */
1318
+ export namespace lookupflags {
1319
+ /** As long as the resolved path corresponds to a symbolic link, it is expanded. */
1320
+ // @ts-ignore: decorator
1321
+ @inline
1322
+ export const SYMLINK_FOLLOW: lookupflags = 1;
1323
+ }
1324
+ export type lookupflags = u32;
1325
+
1326
+ /** Open flags. */
1327
+ export namespace oflags {
1328
+ /** Create file if it does not exist. */
1329
+ // @ts-ignore: decorator
1330
+ @inline
1331
+ export const CREAT: oflags = 1;
1332
+ /** Fail if not a directory. */
1333
+ // @ts-ignore: decorator
1334
+ @inline
1335
+ export const DIRECTORY: oflags = 2;
1336
+ /** Fail if file already exists. */
1337
+ // @ts-ignore: decorator
1338
+ @inline
1339
+ export const EXCL: oflags = 4;
1340
+ /** Truncate file to size 0. */
1341
+ // @ts-ignore: decorator
1342
+ @inline
1343
+ export const TRUNC: oflags = 8;
1344
+ }
1345
+ export type oflags = u16;
1346
+
1347
+ /** Identifiers for preopened capabilities. */
1348
+ export namespace preopentype {
1349
+ /** A pre-opened directory. */
1350
+ // @ts-ignore: decorator
1351
+ @inline
1352
+ export const DIR: preopentype = 0;
1353
+ }
1354
+ export type preopentype = u8;
1355
+
1356
+
1357
+ @unmanaged abstract class $prestat {
1358
+ // WASM32: size=1/8, WASM64: size=1/16
1359
+ /* The type of the pre-opened capability. */
1360
+ type: preopentype;
1361
+ }
1362
+
1363
+ /* Information about a pre-opened capability. */
1364
+ @unmanaged export abstract class prestat extends $prestat {
1365
+ private __padding0: usize;
1366
+ }
1367
+
1368
+ /** The contents of a $prestat when type is `preopentype.DIR`. */
1369
+ @unmanaged export class prestat_dir extends $prestat {
1370
+ /** The length of the directory name for use with `fd_prestat_dir_name`. */
1371
+ name_len: usize;
1372
+ }
1373
+
1374
+ /** Flags provided to `sock_recv`. */
1375
+ export namespace riflags {
1376
+ /** Returns the message without removing it from the socket's receive queue. */
1377
+ // @ts-ignore: decorator
1378
+ @inline
1379
+ export const PEEK: riflags = 1;
1380
+ /** On byte-stream sockets, block until the full amount of data can be returned. */
1381
+ // @ts-ignore: decorator
1382
+ @inline
1383
+ export const WAITALL: riflags = 2;
1384
+ }
1385
+ export type riflags = u16;
1386
+
1387
+ /** File descriptor rights, determining which actions may be performed. */
1388
+ export namespace rights {
1389
+ /** The right to invoke `fd_datasync`. */
1390
+ // @ts-ignore: decorator
1391
+ @inline
1392
+ export const FD_DATASYNC: rights = 1;
1393
+ /** The right to invoke `fd_read` and `sock_recv`. */
1394
+ // @ts-ignore: decorator
1395
+ @inline
1396
+ export const FD_READ: rights = 2;
1397
+ /** The right to invoke `fd_seek`. This flag implies `rights.FD_TELL`. */
1398
+ // @ts-ignore: decorator
1399
+ @inline
1400
+ export const FD_SEEK: rights = 4;
1401
+ /** The right to invoke `fd_fdstat_set_flags`. */
1402
+ // @ts-ignore: decorator
1403
+ @inline
1404
+ export const FD_FDSTAT_SET_FLAGS: rights = 8;
1405
+ /** The right to invoke `fd_sync`. */
1406
+ // @ts-ignore: decorator
1407
+ @inline
1408
+ export const FD_SYNC: rights = 16;
1409
+ /** The right to invoke `fd_seek` in such a way that the file offset remains unaltered (i.e., `whence.CUR` with offset zero), or to invoke `fd_tell`). */
1410
+ // @ts-ignore: decorator
1411
+ @inline
1412
+ export const FD_TELL: rights = 32;
1413
+ /** The right to invoke `fd_write` and `sock_send`. If `rights.FD_SEEK` is set, includes the right to invoke `fd_pwrite`. */
1414
+ // @ts-ignore: decorator
1415
+ @inline
1416
+ export const FD_WRITE: rights = 64;
1417
+ /** The right to invoke `fd_advise`. */
1418
+ // @ts-ignore: decorator
1419
+ @inline
1420
+ export const FD_ADVISE: rights = 128;
1421
+ /** The right to invoke `fd_allocate`. */
1422
+ // @ts-ignore: decorator
1423
+ @inline
1424
+ export const FD_ALLOCATE: rights = 256;
1425
+ /** The right to invoke `path_create_directory`. */
1426
+ // @ts-ignore: decorator
1427
+ @inline
1428
+ export const PATH_CREATE_DIRECTORY: rights = 512;
1429
+ /** If `rights.PATH_OPEN` is set, the right to invoke `path_open` with `oflags.CREAT`. */
1430
+ // @ts-ignore: decorator
1431
+ @inline
1432
+ export const PATH_CREATE_FILE: rights = 1024;
1433
+ /** The right to invoke `path_link` with the file descriptor as the source directory. */
1434
+ // @ts-ignore: decorator
1435
+ @inline
1436
+ export const PATH_LINK_SOURCE: rights = 2048;
1437
+ /** The right to invoke `path_link` with the file descriptor as the target directory. */
1438
+ // @ts-ignore: decorator
1439
+ @inline
1440
+ export const PATH_LINK_TARGET: rights = 4096;
1441
+ /** The right to invoke `path_open`. */
1442
+ // @ts-ignore: decorator
1443
+ @inline
1444
+ export const PATH_OPEN: rights = 8192;
1445
+ /** The right to invoke `fd_readdir`. */
1446
+ // @ts-ignore: decorator
1447
+ @inline
1448
+ export const FD_READDIR: rights = 16384;
1449
+ /** The right to invoke `path_readlink`. */
1450
+ // @ts-ignore: decorator
1451
+ @inline
1452
+ export const PATH_READLINK: rights = 32768;
1453
+ /** The right to invoke `path_rename` with the file descriptor as the source directory. */
1454
+ // @ts-ignore: decorator
1455
+ @inline
1456
+ export const PATH_RENAME_SOURCE: rights = 65536;
1457
+ /** The right to invoke `path_rename` with the file descriptor as the target directory. */
1458
+ // @ts-ignore: decorator
1459
+ @inline
1460
+ export const PATH_RENAME_TARGET: rights = 131072;
1461
+ /** The right to invoke `path_filestat_get`. */
1462
+ // @ts-ignore: decorator
1463
+ @inline
1464
+ export const PATH_FILESTAT_GET: rights = 262144;
1465
+ /** The right to change a file's size (there is no `path_filestat_set_size`). If `rights.PATH_OPEN` is set, includes the right to invoke `path_open` with `oflags.TRUNC`. */
1466
+ // @ts-ignore: decorator
1467
+ @inline
1468
+ export const PATH_FILESTAT_SET_SIZE: rights = 524288;
1469
+ /** The right to invoke `path_filestat_set_times`. */
1470
+ // @ts-ignore: decorator
1471
+ @inline
1472
+ export const PATH_FILESTAT_SET_TIMES: rights = 1048576;
1473
+ /** The right to invoke `fd_filestat_get`. */
1474
+ // @ts-ignore: decorator
1475
+ @inline
1476
+ export const FD_FILESTAT_GET: rights = 2097152;
1477
+ /** The right to invoke `fd_filestat_set_size`. */
1478
+ // @ts-ignore: decorator
1479
+ @inline
1480
+ export const FD_FILESTAT_SET_SIZE: rights = 4194304;
1481
+ /** The right to invoke `fd_filestat_set_times`. */
1482
+ // @ts-ignore: decorator
1483
+ @inline
1484
+ export const FD_FILESTAT_SET_TIMES: rights = 8388608;
1485
+ /** The right to invoke `path_symlink`. */
1486
+ // @ts-ignore: decorator
1487
+ @inline
1488
+ export const RIGHT_PATH_SYMLINK: rights = 16777216;
1489
+ /** The right to invoke `path_remove_directory`. */
1490
+ // @ts-ignore: decorator
1491
+ @inline
1492
+ export const PATH_REMOVE_DIRECTORY: rights = 33554432;
1493
+ /** The right to invoke `path_unlink_file`. */
1494
+ // @ts-ignore: decorator
1495
+ @inline
1496
+ export const PATH_UNLINK_FILE: rights = 67108864;
1497
+ /** If `rights.FD_READ` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype.FD_READ`. If `rights.FD_WRITE` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype.FD_WRITE`. */
1498
+ // @ts-ignore: decorator
1499
+ @inline
1500
+ export const POLL_FD_READWRITE: rights = 134217728;
1501
+ /** The right to invoke `sock_shutdown`. */
1502
+ // @ts-ignore: decorator
1503
+ @inline
1504
+ export const SOCK_SHUTDOWN: rights = 268435456;
1505
+ }
1506
+ export type rights = u64;
1507
+
1508
+ /** Flags returned by `sock_recv`. */
1509
+ export namespace roflags {
1510
+ /** Message data has been truncated. */
1511
+ // @ts-ignore: decorator
1512
+ @inline
1513
+ export const DATA_TRUNCATED: roflags = 1;
1514
+ }
1515
+ export type roflags = u16;
1516
+
1517
+ /** Which channels on a socket to shut down. */
1518
+ export namespace sdflags {
1519
+ /** Disables further receive operations. */
1520
+ // @ts-ignore: decorator
1521
+ @inline
1522
+ export const RD: sdflags = 1;
1523
+ /** Disables further send operations. */
1524
+ // @ts-ignore: decorator
1525
+ @inline
1526
+ export const WR: sdflags = 2;
1527
+ }
1528
+ export type sdflags = u8;
1529
+
1530
+ /** Flags provided to `sock_send`. */
1531
+ export namespace siflags {
1532
+ // As there are currently no flags defined, it must be set to zero.
1533
+ }
1534
+ export type siflags = u16;
1535
+
1536
+ /** Signal condition. */
1537
+ export namespace signal {
1538
+ /** Hangup. */
1539
+ // @ts-ignore: decorator
1540
+ @inline
1541
+ export const HUP: signal = 1;
1542
+ /** Terminate interrupt signal. */
1543
+ // @ts-ignore: decorator
1544
+ @inline
1545
+ export const INT: signal = 2;
1546
+ /** Terminal quit signal. */
1547
+ // @ts-ignore: decorator
1548
+ @inline
1549
+ export const QUIT: signal = 3;
1550
+ /** Illegal instruction. */
1551
+ // @ts-ignore: decorator
1552
+ @inline
1553
+ export const ILL: signal = 4;
1554
+ /** Trace/breakpoint trap. */
1555
+ // @ts-ignore: decorator
1556
+ @inline
1557
+ export const TRAP: signal = 5;
1558
+ /** Process abort signal. */
1559
+ // @ts-ignore: decorator
1560
+ @inline
1561
+ export const ABRT: signal = 6;
1562
+ /** Access to an undefined portion of a memory object. */
1563
+ // @ts-ignore: decorator
1564
+ @inline
1565
+ export const BUS: signal = 7;
1566
+ /** Erroneous arithmetic operation. */
1567
+ // @ts-ignore: decorator
1568
+ @inline
1569
+ export const FPE: signal = 8;
1570
+ /** Kill. */
1571
+ // @ts-ignore: decorator
1572
+ @inline
1573
+ export const KILL: signal = 9;
1574
+ /** User-defined signal 1. */
1575
+ // @ts-ignore: decorator
1576
+ @inline
1577
+ export const USR1: signal = 10;
1578
+ /** Invalid memory reference. */
1579
+ // @ts-ignore: decorator
1580
+ @inline
1581
+ export const SEGV: signal = 11;
1582
+ /** User-defined signal 2. */
1583
+ // @ts-ignore: decorator
1584
+ @inline
1585
+ export const USR2: signal = 12;
1586
+ /** Write on a pipe with no one to read it. */
1587
+ // @ts-ignore: decorator
1588
+ @inline
1589
+ export const PIPE: signal = 13;
1590
+ /** Alarm clock. */
1591
+ // @ts-ignore: decorator
1592
+ @inline
1593
+ export const ALRM: signal = 14;
1594
+ /** Termination signal. */
1595
+ // @ts-ignore: decorator
1596
+ @inline
1597
+ export const TERM: signal = 15;
1598
+ /** Child process terminated, stopped, or continued. */
1599
+ // @ts-ignore: decorator
1600
+ @inline
1601
+ export const CHLD: signal = 16;
1602
+ /** Continue executing, if stopped. */
1603
+ // @ts-ignore: decorator
1604
+ @inline
1605
+ export const CONT: signal = 17;
1606
+ /** Stop executing. */
1607
+ // @ts-ignore: decorator
1608
+ @inline
1609
+ export const STOP: signal = 18;
1610
+ /** Terminal stop signal. */
1611
+ // @ts-ignore: decorator
1612
+ @inline
1613
+ export const TSTP: signal = 19;
1614
+ /** Background process attempting read. */
1615
+ // @ts-ignore: decorator
1616
+ @inline
1617
+ export const TTIN: signal = 20;
1618
+ /** Background process attempting write. */
1619
+ // @ts-ignore: decorator
1620
+ @inline
1621
+ export const TTOU: signal = 21;
1622
+ /** High bandwidth data is available at a socket. */
1623
+ // @ts-ignore: decorator
1624
+ @inline
1625
+ export const URG: signal = 22;
1626
+ /** CPU time limit exceeded. */
1627
+ // @ts-ignore: decorator
1628
+ @inline
1629
+ export const XCPU: signal = 23;
1630
+ /** File size limit exceeded. */
1631
+ // @ts-ignore: decorator
1632
+ @inline
1633
+ export const XFSZ: signal = 24;
1634
+ /** Virtual timer expired. */
1635
+ // @ts-ignore: decorator
1636
+ @inline
1637
+ export const VTALRM: signal = 25;
1638
+ // @ts-ignore: decorator
1639
+ @inline
1640
+ export const PROF: signal = 26;
1641
+ // @ts-ignore: decorator
1642
+ @inline
1643
+ export const WINCH: signal = 27;
1644
+ // @ts-ignore: decorator
1645
+ @inline
1646
+ export const POLL: signal = 28;
1647
+ // @ts-ignore: decorator
1648
+ @inline
1649
+ export const PWR: signal = 29;
1650
+ /** Bad system call. */
1651
+ // @ts-ignore: decorator
1652
+ @inline
1653
+ export const SYS: signal = 30;
1654
+ }
1655
+ export type signal = u8;
1656
+
1657
+ /** Flags determining how to interpret the timestamp provided in `subscription_t::u.clock.timeout. */
1658
+ export namespace subclockflags {
1659
+ /** If set, treat the timestamp provided in `clocksubscription` as an absolute timestamp. */
1660
+ // @ts-ignore: decorator
1661
+ @inline
1662
+ export const ABSTIME: subclockflags = 1;
1663
+ }
1664
+ export type subclockflags = u16;
1665
+
1666
+
1667
+ @unmanaged abstract class $subscription {
1668
+ // size=16/48
1669
+ /** User-provided value that is attached to the subscription. */
1670
+ userdata: userdata;
1671
+ /** The type of the event to which to subscribe. */
1672
+ type: eventtype;
1673
+
1674
+ private __padding0: u32;
1675
+ }
1676
+
1677
+ /** Subscription to an event. */
1678
+ @unmanaged export abstract class subscription extends $subscription {
1679
+ private __padding1: u64;
1680
+ private __padding2: u64;
1681
+ private __padding3: u64;
1682
+ private __padding4: u64;
1683
+ }
1684
+
1685
+ /* Subscription to an event of type `eventtype.CLOCK`.**/
1686
+ @unmanaged export class subscription_clock extends $subscription {
1687
+ /** The clock against which to compare the timestamp. */
1688
+ clock_id: clockid;
1689
+ /** The absolute or relative timestamp. */
1690
+ timeout: timestamp;
1691
+ /** The amount of time that the implementation may wait additionally to coalesce with other events. */
1692
+ precision: timestamp;
1693
+ /** Flags specifying whether the timeout is absolute or relative. */
1694
+ flags: subclockflags;
1695
+
1696
+ private __padding1: u32;
1697
+ }
1698
+
1699
+ /* Subscription to an event of type `eventtype.FD_READ` or `eventtype.FD_WRITE`.**/
1700
+ @unmanaged export class subscription_fd_readwrite extends $subscription {
1701
+ /** The file descriptor on which to wait for it to become ready for reading or writing. */
1702
+ file_descriptor: fd;
1703
+
1704
+ private __padding1: u64;
1705
+ private __padding2: u64;
1706
+ private __padding3: u64;
1707
+ }
1708
+
1709
+ /** Timestamp in nanoseconds. */
1710
+ export type timestamp = u64;
1711
+
1712
+ /** User-provided value that may be attached to objects that is retained when extracted from the implementation. */
1713
+ export type userdata = u64;
1714
+
1715
+ /** The position relative to which to set the offset of the file descriptor. */
1716
+ export namespace whence {
1717
+ /** Seek relative to start-of-file. */
1718
+ // @ts-ignore: decorator
1719
+ @inline
1720
+ export const SET: whence = 0;
1721
+ /** Seek relative to current position. */
1722
+ // @ts-ignore: decorator
1723
+ @inline
1724
+ export const CUR: whence = 1;
1725
+ /** Seek relative to end-of-file. */
1726
+ // @ts-ignore: decorator
1727
+ @inline
1728
+ export const END: whence = 2;
1729
+ }
1730
+
1731
+ export type whence = u8;