diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-01-25 17:35:10 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-01-25 17:35:10 +0000 |
| commit | 7d76b7679d0b70b0e38ff08aeeeb78acde14aac3 (patch) | |
| tree | 834d177f97c549e46fbea63524fa29015160ce1f /runtime/src/shed/namespaces/Std/Process.c | |
| parent | 63c7aed6104192418ca8f44a1f8c039b5360ad99 (diff) | |
Use generated C headers in runtime
Diffstat (limited to 'runtime/src/shed/namespaces/Std/Process.c')
| -rw-r--r-- | runtime/src/shed/namespaces/Std/Process.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/runtime/src/shed/namespaces/Std/Process.c b/runtime/src/shed/namespaces/Std/Process.c new file mode 100644 index 00000000..88fa9b6d --- /dev/null +++ b/runtime/src/shed/namespaces/Std/Process.c @@ -0,0 +1,34 @@ +#include "../../std/unistd.h" + +#include "../../shed.h" +#include "./Process.h" + +#ifdef __wasm__ + +void wasi_proc_exit(uint32_t exitcode) + __attribute__(( + __import_module__("wasi_snapshot_preview1"), + __import_name__("proc_exit"), + )); + +ShedObject shed__runtime__namespace__Std__Process__exit( + ShedClosurePointer closurePointer, + ShedObject exitCode +) { + wasi_proc_exit(shed__runtime__int_value(exitCode)); + return shed_unit; +} + +#else + +#include <stdlib.h> + +ShedObject shed__runtime__namespace__Std__Process__exit( + ShedClosurePointer closurePointer, + ShedObject exitCode +) { + exit(shed__runtime__int_value(exitCode)); + return shed_unit; +} + +#endif |
