diff options
Diffstat (limited to 'runtime/src/shed/namespaces/Std')
| -rw-r--r-- | runtime/src/shed/namespaces/Std/Process.c | 34 | ||||
| -rw-r--r-- | runtime/src/shed/namespaces/Std/Process.h | 8 |
2 files changed, 42 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 diff --git a/runtime/src/shed/namespaces/Std/Process.h b/runtime/src/shed/namespaces/Std/Process.h new file mode 100644 index 00000000..23c7f5b1 --- /dev/null +++ b/runtime/src/shed/namespaces/Std/Process.h @@ -0,0 +1,8 @@ +#ifndef SHED_NAMESPACES__Std__Process__H +#define SHED_NAMESPACES__Std__Process__H + +#include "shed/shed.h" + +ShedObject shed__runtime__namespace__Std__Process__exit(ShedClosurePointer closurePointer, ShedObject exitCode); + +#endif |
