@ai-ecoverse/slicc-kernel 1.107.0 → 1.108.0
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.
- package/README.md +7 -1
- package/dist/kernel-worker.js +27 -5
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +199 -154
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +27 -5
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +199 -154
- package/dist/process-worker.js.map +4 -4
- package/dist/types/kernel/children.d.ts +3 -0
- package/dist/types/kernel/process.d.ts +6 -0
- package/dist/types/process/process-signals.d.ts +8 -6
- package/dist/types/process/wasi/wasi-host.d.ts +1 -1
- package/dist/types/process/wasi/wasi-signals.d.ts +4 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -311,7 +311,7 @@ On top of preview1 a WASI program gets:
|
|
|
311
311
|
- `MAP_SHARED` mappings aren't shared between processes, so unnamed semaphores (`sem_init` with `pshared`) work only between a process's threads, and `multiprocessing.shared_memory` doesn't work.
|
|
312
312
|
- **Foreign calls** (libffi's WASIX backend, so Python's `ctypes`): `call_dynamic` calls a function through the program's indirect function table (a static module's exported `__indirect_function_table`, or the dynamic linker's), its arguments and results packed in memory one after another (`i32`/`f32` 4 bytes, `i64`/`f64` 8). With `strict` set, the buffers must fit the function exactly (else `EINVAL`, before the function is called); without it, missing arguments are zero (one cut short keeps the bytes given, with zeros above them) and results that do not fit are left out. A trap or exception of the callee goes through to the caller. JS cannot ask a function for its type, so the kernel reads the types from the module files (the program's and each side module's, once, when a program first calls through `call_dynamic`): a table slot that is empty, past the end, holds a function of no module the kernel knows of, or takes or returns a `v128`, gives `EINVAL`. For closures (callbacks such as `CFUNCTYPE`), a dynamically linked program gets table slots from `closure_allocate`, and `closure_free` gives them back for reuse and empties the slot in every thread; a static program gets `ENOTSUP`. `closure_prepare` puts a trampoline with the requested signature (any of `i32`, `i64`, `f32`, `f64`, `v128`) into such a slot, in every thread: each call stores its arguments below the stack pointer and calls the backing function as `backing(values, results, user_data)`, then returns what it wrote to `results`. The trampolines are small wasm modules made and compiled at run time, once per signature in each thread (an instance per closure), so a page whose Content Security Policy forbids compiling WebAssembly (no `'wasm-unsafe-eval'`) cannot run them; it cannot run the program either. A `fork` or a `longjmp` (both through Asyncify) inside a function reached through `call_dynamic` cannot unwind through it.
|
|
313
313
|
- **Job control:** `^Z`, `SIGTSTP`, `SIGTTIN` and `SIGTTOU` stop a WASIX program at once, unless it has a handler for them. A stopped program that is busy computing is stopped for job control (`jobs` shows it, `fg`, `bg` and `SIGCONT` work), but its worker keeps a core busy until its next system call, since a worker's running code cannot be frozen from outside. Agents should `kill` such a job rather than leave it stopped. An Emscripten program stops at its next kernel call as well, and at its next write, read or sleep that its glue answers without the kernel (a write to its own `/dev/null`, as in `yes > /dev/null`), so a stopped one keeps no core busy unless it computes without any of these calls. A stopped program doesn't move on while stopped: a `sleep` (or a blocked read) that would end meanwhile ends after `SIGCONT`. A call that the stop interrupted runs again after `SIGCONT`, as on Linux. One with a timeout (`select`, `poll`, `ppoll`, `pselect`, `nanosleep`, a timed semaphore wait) waits only for the time that's left, counted from when the kernel first got the call, so it still ends at its deadline. `epoll_wait` and `epoll_pwait` aren't run again: they fail with `EINTR`, even without a handler (signal(7)). A signal for such a program is also delivered at those glue-answered calls, so a handler runs in a loop that only writes to `/dev/null`. For the same reason, a signal with a handler or a terminating default (`^C`, `SIGTERM`) reaches a program that is busy computing only at its next system call, so a CPU-bound loop may not end on `^C`; `kill -9` always ends it. A pending signal is delivered at the program's next WASI or WASIX call, including the calls its worker answers without the kernel (`random_get`, `args_get`, …), except the exempt ones: `clock_time_get` (a tight loop of it measured up to 30% slower), `proc_exit`, `proc_exit2`, `thread_exit`, `thread_spawn_v2` and `wasi.thread-spawn` (wasi-threads), the calls that install handlers (`callback_signal`, `slicc.sigaction_set`), and calls made while Asyncify unwinds or rewinds the stack for `fork` or `longjmp`. A signal that arrives while a thread computes is thus delivered at its next call; when that call is a wait (`poll_oneoff` with a timeout or a descriptor, so `nanosleep` and `poll`/`select` too, `sigmask_poll`, or a futex wait), the handler has run during the call, so the wait ends at once: `EINTR` for a libc of -22 or later (an older one sees its clocks fire, as for any interruption), and a futex wait returns woken. A thread blocked in the kernel or waiting on a lock (`pthread_cond_wait`, a futex) is woken by a signal for it (a futex wait checks for signals every 50 ms, so each waiting thread wakes briefly that often), and `pthread_kill` runs the handler on the thread it names. A sleep, or a clock in `poll_oneoff`, never ends before the time asked (it can end later, never earlier). A signal that ends a sleep or a `poll`/`select` with a timeout makes the call fail with `EINTR` in a program whose libc says it is wasix-sysroot 2025.9.30-22 or later (its `slicc.libc` custom section). Older libcs turn that answer into `ENOTSUP` from `nanosleep` (up to -18), so for a program without the section the wait ends as if it had timed out, unless it imports `fd_fdflags_set` (then `EINTR`, as before).
|
|
314
|
-
- **Blocked signals** (`sigprocmask`, `pthread_sigmask`, `sigpending`): a program whose libc imports `slicc.sigmask_set(how, set_lo, set_hi, old_ptr)` and `slicc.sigpending_get(ptr)` (wasix-sysroot 2025.9.30-28 and later) has a blocked mask per thread. `how` is musl's `SIG_BLOCK` 0, `SIG_UNBLOCK` 1 or `SIG_SETMASK` 2, the set is the 64-bit `sigset_t` (bit `sig - 1`), and the old mask is written as a u64 at `old_ptr`; any other `how` is `EINVAL`. `SIGKILL` and `SIGSTOP` cannot be blocked. A blocked signal is not delivered, does not interrupt a sleep or a blocked call, and its default action (terminate or stop) waits: it stays pending, `sigpending` shows it (the thread's pending signals and the process's), and it is delivered when it is unblocked, before `sigmask_set` returns. A signal ignored with `SIG_IGN` is discarded even while blocked. A forked child (with the mask of the thread that forked), the program an `exec` starts and a spawned child keep the mask, all 64 bits of it, and so does a new thread; `/proc/<pid>/status` shows the main thread's as `SigBlk`. The mask is kept in a word of the worker's shared header, so changing it costs no kernel call. A program without the import (an older libc) has no mask and gets every signal at once, as before, and one it starts by `exec` with a mask set starts with none. A signal for the whole process goes to the main thread, unless the main thread blocks it and another thread does not. Then, as on Linux, it goes to that thread: its handler runs there, or with no handler its default action ends (or stops) the whole process at once. So the "signal thread" pattern works: block in main, unblock in a worker (#520). It waits on the main thread only when every thread blocks it. A signal sent to one thread (`pthread_kill`) that it blocks waits for that thread, and if it has no handler, the thread's unblock ends the whole process by the signal, whatever the other threads block. `slicc.sigmask_poll(set_lo, set_hi, in_ptr, out_ptr, nsubscriptions, nevents_ptr)` is `pselect`, `ppoll` and `sigsuspend`: it swaps the thread's mask to the given set for the call and puts the old one back before it returns. It delivers a pending signal the new mask unblocks, without polling, or polls as `poll_oneoff` does, under the new mask, so a signal it unblocks interrupts the wait with no window between the swap and the wait; with no subscriptions it waits until a signal is delivered. An interrupted call returns `EINTR` with no events, after the handler has run. `slicc.sigmask_epoll_wait(set_lo, set_hi, epfd, events_ptr, maxevents, timeout_ns, nevents_ptr)` is `epoll_pwait` (#771). It swaps the thread's mask to the given set in the same way. A pending signal the new mask unblocks runs its handler and makes the call return `EINTR` with no events, without waiting. Otherwise the call waits exactly as `wasix_32v1.epoll_wait` with the same arguments does (the same event layout and errors; a `timeout_ns` of all bits set is forever, 0 doesn't wait), under the new mask, so a signal it unblocks ends the wait with `EINTR` after the handler. The old mask is back before the call returns, on every path, and `*nevents_ptr` is always written. A kernel without it answers `ENOSYS`, and the libc keeps its non-atomic swap around `epoll_wait`. For both masked waits, a signal that came while the program computed and was delivered as the call began (its handler ran under the old mask, as on Linux, where it would have run before the call) ends the call with `EINTR` only if the new mask leaves it unblocked; when the new mask blocks every signal delivered then, the call waits as if none had come (#799). `slicc.sigwait(set_lo, set_hi, timeout_ns, sig_ptr)` is `sigwait`, `sigwaitinfo` and `sigtimedwait` (#520). If a signal of the set is pending for the thread, or else for the process, it takes it: the lowest-numbered first, with no handler run. It writes the number as a `u32` at `sig_ptr` and returns 0. Otherwise it waits until one is pending. `timeout_ns` of all bits set is forever and 0 doesn't wait; when the time runs out it answers `EAGAIN` (`*sig_ptr = 0`). A signal outside the set that the thread has unblocked and handles runs its handler and ends the call with `EINTR` (also one that came while the program computed and was delivered as the call began, as for the other waits), and so does a job-control stop, once continued. While a thread waits, the kernel counts it as able to take the signals of its set: a process-directed signal that every thread blocks goes to it (the main thread first, if it is the one waiting), so the signal-thread pattern works with `sigwait` too. Only kernel signals 1 to 31 can be waited for. A kernel without it answers `ENOSYS`.
|
|
314
|
+
- **Blocked signals** (`sigprocmask`, `pthread_sigmask`, `sigpending`): a program whose libc imports `slicc.sigmask_set(how, set_lo, set_hi, old_ptr)` and `slicc.sigpending_get(ptr)` (wasix-sysroot 2025.9.30-28 and later) has a blocked mask per thread. `how` is musl's `SIG_BLOCK` 0, `SIG_UNBLOCK` 1 or `SIG_SETMASK` 2, the set is the 64-bit `sigset_t` (bit `sig - 1`), and the old mask is written as a u64 at `old_ptr`; any other `how` is `EINVAL`. `SIGKILL` and `SIGSTOP` cannot be blocked. A blocked signal is not delivered, does not interrupt a sleep or a blocked call, and its default action (terminate or stop) waits: it stays pending, `sigpending` shows it (the thread's pending signals and the process's), and it is delivered when it is unblocked, before `sigmask_set` returns. A signal ignored with `SIG_IGN` is discarded even while blocked. A forked child (with the mask of the thread that forked), the program an `exec` starts and a spawned child keep the mask, all 64 bits of it, and so does a new thread; `/proc/<pid>/status` shows the main thread's as `SigBlk`. The mask is kept in a word of the worker's shared header, so changing it costs no kernel call. A program without the import (an older libc) has no mask and gets every signal at once, as before, and one it starts by `exec` with a mask set starts with none. A signal for the whole process goes to the main thread, unless the main thread blocks it and another thread does not. Then, as on Linux, it goes to that thread: its handler runs there, or with no handler its default action ends (or stops) the whole process at once. So the "signal thread" pattern works: block in main, unblock in a worker (#520). It waits on the main thread only when every thread blocks it. A signal sent to one thread (`pthread_kill`) that it blocks waits for that thread, and if it has no handler, the thread's unblock ends the whole process by the signal, whatever the other threads block. `slicc.sigmask_poll(set_lo, set_hi, in_ptr, out_ptr, nsubscriptions, nevents_ptr)` is `pselect`, `ppoll` and `sigsuspend`: it swaps the thread's mask to the given set for the call and puts the old one back before it returns. It delivers a pending signal the new mask unblocks, without polling, or polls as `poll_oneoff` does, under the new mask, so a signal it unblocks interrupts the wait with no window between the swap and the wait; with no subscriptions it waits until a signal is delivered. An interrupted call returns `EINTR` with no events, after the handler has run. `slicc.sigmask_epoll_wait(set_lo, set_hi, epfd, events_ptr, maxevents, timeout_ns, nevents_ptr)` is `epoll_pwait` (#771). It swaps the thread's mask to the given set in the same way. A pending signal the new mask unblocks runs its handler and makes the call return `EINTR` with no events, without waiting. Otherwise the call waits exactly as `wasix_32v1.epoll_wait` with the same arguments does (the same event layout and errors; a `timeout_ns` of all bits set is forever, 0 doesn't wait), under the new mask, so a signal it unblocks ends the wait with `EINTR` after the handler. The old mask is back before the call returns, on every path, and `*nevents_ptr` is always written. A kernel without it answers `ENOSYS`, and the libc keeps its non-atomic swap around `epoll_wait`. For both masked waits, a signal that came while the program computed and was delivered as the call began (its handler ran under the old mask, as on Linux, where it would have run before the call) ends the call with `EINTR` only if the new mask leaves it unblocked; when the new mask blocks every signal delivered then, the call waits as if none had come (#799). `slicc.sigwait(set_lo, set_hi, timeout_ns, sig_ptr)` is `sigwait`, `sigwaitinfo` and `sigtimedwait` (#520). If a signal of the set is pending for the thread, or else for the process, it takes it: the lowest-numbered first, with no handler run. It writes the number as a `u32` at `sig_ptr` and returns 0. Otherwise it waits until one is pending. `timeout_ns` of all bits set is forever and 0 doesn't wait; when the time runs out it answers `EAGAIN` (`*sig_ptr = 0`). A signal outside the set that the thread has unblocked and handles runs its handler and ends the call with `EINTR` (also one that came while the program computed and was delivered as the call began, as for the other waits), and so does a job-control stop, once continued. While a thread waits, the kernel counts it as able to take the signals of its set: a process-directed signal that every thread blocks goes to it (the main thread first, if it is the one waiting), so the signal-thread pattern works with `sigwait` too. Only kernel signals 1 to 31 can be waited for. A kernel without it answers `ENOSYS`. `slicc.sigaction_inherited(ign_ptr)` (#820) writes, as a little-endian `u64` at `ign_ptr`, the signals the program arrived with set to `SIG_IGN`, inherited across `exec` or spawn (bit `sig - 1`; never `SIGKILL` or `SIGSTOP`; kernel signals are 1 to 31, so the high word is 0), and returns 0. A libc calls it once before constructors and `main` and seeds its `sigaction` table with `SIG_IGN` for each bit, so `sigaction(sig, NULL, &old)` reads an inherited ignore back (wasix-sysroot 2025.9.30-32 and later); a kernel without it answers `ENOSYS`, and the libc keeps its defaults. Handlers are never inherited. **SIGCHLD:** with `SIGCHLD` set to `SIG_IGN` (by the program, or inherited), or with `SA_NOCLDWAIT` in the flags `slicc.sigaction_set` gets for `SIGCHLD`, an exited child is reaped at once and never stays a zombie: `waitpid` for it is `ECHILD`, and `wait` blocks until every child has exited, then fails with `ECHILD`, as on Linux. `SIGCHLD` is still sent. An explicit `SIG_DFL` turns it back off. A child that a process waits on for `exec`, or that `kernel.run` and the run calls collect, is never reaped that way.
|
|
315
315
|
- **Pipes** have no file type for WASI and WASIX programs' `fstat` (`st_mode` type 0), because WASI has no FIFO file type. A socket type, as kernels 1.47.3 to 1.48.1 gave them, made Ruby treat a `popen` pipe as a socket (`close_write` then never ends the child's input). The kernel's `slicc_fs.fd_mode` answers `S_IFIFO | 0600` (Linux numbering) for a pipe, and wasix-sysroot 2025.9.30-21 and later take the type from it, so programs built on it see a FIFO (`S_ISFIFO`); older libcs keep only the permission bits. Until then Python's asyncio refuses a pipe for a subprocess (`Pipe transport is only for pipes, sockets and character devices`). They are read and written as pipes; socket calls on them fail with `ENOTSOCK`, and `isatty()` is false. Emscripten programs, bash included, see a FIFO. The same holds for any kernel descriptor that is neither seekable nor a terminal or device, such as captured output.
|
|
316
316
|
- **Sockets**: the WASIX socket calls (`sock_open`, `sock_pair` for an `AF_UNIX` stream pair, `bind`, `listen`, `connect`, `accept`, options, local and peer names) are the kernel's loopback sockets, and preview1's `sock_recv` / `sock_send` / `sock_shutdown` work on them and on inherited ones. Writing to a socket whose peer is gone fails with `EPIPE`, through `fd_write` as through `sock_send`, as if `MSG_NOSIGNAL` were set. A write to a pipe, FIFO or terminal whose reader is gone follows the program's `SIGPIPE` disposition, as the kernel knows it (#810): at the default it ends the program with status 141; ignored (also an ignore inherited across `exec` and spawn, as bash's `trap '' PIPE` passes on), the write fails with `EPIPE`; with a handler, the handler runs and then the write fails with `EPIPE`; blocked, `SIGPIPE` stays pending and the write fails with `EPIPE`. An Emscripten program's write to a pipe, and its `send` without `MSG_NOSIGNAL`, follow the same rules, except that the kernel doesn't see an Emscripten program's signal mask, so a blocked `SIGPIPE` there still ends it. A WASI program asking `sigaction` about an inherited ignore still sees the default, since its libc keeps its own table. HTTP and HTTPS leave through the realm proxy that `https_proxy` names, as for any other program; `resolve` answers `/etc/hosts` names and literal addresses, and the [uplink](#uplink)'s names. `sock_open(SOCK_DGRAM)` on `AF_INET`/`AF_INET6` gives a [datagram socket](#datagram-sockets-udp); `sock_send_to` and `sock_recv_from` carry its addresses, and `RECV_DATA_TRUNCATED` is set in `ro_flags` when a datagram did not fit.
|
|
317
317
|
- **Diagnostics**: a trap ends the program with 134 and its message on stderr; with `SLICC_WASM_BACKTRACE=1` the wasm frames follow, named from the module's name section, or from a sidecar for a module shipped without one (`<module>.names` beside it, or the same path in a `<package>-names` package). `SLICC_WASI_STATS=1` makes a program print its calls, counted and timed, as it ends.
|
|
@@ -1000,6 +1000,12 @@ A WASIX C program for `test/integration/sigpipe.test.mjs` (#810). `pipetest MODE
|
|
|
1000
1000
|
|
|
1001
1001
|
**Build:** `WASIX_SYSROOT_29=/path/to/wasix-sysroot ./build.sh`, with `wasixcc` 0.4.7 on `PATH`. `bin/pipetest.wasm` is 54,301 bytes, sha256 `c97961442fd1b2551942fc026b8d316d0419d1e6d71c533772e6b7f8b2c65b24`.
|
|
1002
1002
|
|
|
1003
|
+
### `reaptest`
|
|
1004
|
+
|
|
1005
|
+
A WASIX C program for `test/integration/sigchld-reap.test.mjs` (#820). `reaptest MODE` forks a child that exits with 3 at once and checks after 300 ms whether `waitpid(WNOHANG)` still finds it, then forks two that exit after 100 and 250 ms and reports what `wait` returns and when. `MODE` is `ign` (`SIGCHLD` `SIG_IGN`), `nocldwait` (`SIG_DFL` with `SA_NOCLDWAIT`), `reset` (`SIG_IGN`, then `SIG_DFL`), `dfl`, or `inherited`, which first prints what `slicc.sigaction_inherited` reports for `SIGPIPE`, `SIGCHLD` and `SIGTERM`.
|
|
1006
|
+
|
|
1007
|
+
**Build:** `WASIX_SYSROOT_29=/path/to/wasix-sysroot ./build.sh`, with `wasixcc` 0.4.7 (legacy exceptions) and binaryen's `wasm-opt` (`--asyncify` for `proc_fork`) on `PATH`. `bin/reaptest.wasm` is 46837 bytes, sha256 `8e2718273edef94cb3882ee63ce6a9e53f03ba83ef2b2dd9759422d47fae89c7`.
|
|
1008
|
+
|
|
1003
1009
|
### `epolltest`
|
|
1004
1010
|
|
|
1005
1011
|
A C program built with wasixcc against `@ai-ecoverse/wasix-sysroot` 2025.9.30-29, the fixture for the epoll and eventfd rows of `test/integration/epoll.test.mjs` (#674) that tokio can't show:
|
package/dist/kernel-worker.js
CHANGED
|
@@ -7985,7 +7985,7 @@ function satisfies(version, range2) {
|
|
|
7985
7985
|
}
|
|
7986
7986
|
|
|
7987
7987
|
// src/version.ts
|
|
7988
|
-
var KERNEL_VERSION = true ? "1.
|
|
7988
|
+
var KERNEL_VERSION = true ? "1.108.0" : "0.0.0-dev";
|
|
7989
7989
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7990
7990
|
function procVersion() {
|
|
7991
7991
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -10032,6 +10032,8 @@ var ChildTable = class {
|
|
|
10032
10032
|
leftovers = /* @__PURE__ */ new Map();
|
|
10033
10033
|
onChildState;
|
|
10034
10034
|
onReap;
|
|
10035
|
+
autoReap;
|
|
10036
|
+
kept = /* @__PURE__ */ new Set();
|
|
10035
10037
|
stateChanged = [];
|
|
10036
10038
|
watchers = /* @__PURE__ */ new Map();
|
|
10037
10039
|
parentFds;
|
|
@@ -10085,6 +10087,7 @@ var ChildTable = class {
|
|
|
10085
10087
|
void handle.exited.then((code) => {
|
|
10086
10088
|
child.code = code;
|
|
10087
10089
|
this.watchers.delete(handle.pid);
|
|
10090
|
+
if (!this.kept.delete(handle.pid) && this.autoReap?.()) this.reap(handle.pid, code);
|
|
10088
10091
|
this.onChildState?.();
|
|
10089
10092
|
});
|
|
10090
10093
|
handle.onState?.((state, sig) => {
|
|
@@ -10179,6 +10182,9 @@ var ChildTable = class {
|
|
|
10179
10182
|
if (child && child.captured.size > 0) this.leftovers.set(pid, child.captured);
|
|
10180
10183
|
return [pid, waitStatus(code, child?.termsig?.())];
|
|
10181
10184
|
}
|
|
10185
|
+
keep(pid) {
|
|
10186
|
+
this.kept.add(pid);
|
|
10187
|
+
}
|
|
10182
10188
|
pids() {
|
|
10183
10189
|
return [...this.children.keys()];
|
|
10184
10190
|
}
|
|
@@ -15611,6 +15617,7 @@ async function runChild(req, deps) {
|
|
|
15611
15617
|
},
|
|
15612
15618
|
stdio
|
|
15613
15619
|
);
|
|
15620
|
+
deps.children.keep(pid);
|
|
15614
15621
|
} catch (e) {
|
|
15615
15622
|
if (!(e instanceof SpawnError)) throw e;
|
|
15616
15623
|
const outcome2 = { pid: 0, status: null, error: { code: e.code }, out: 0, err: 0 };
|
|
@@ -16948,6 +16955,7 @@ var SYSCALL_OPS = /* @__PURE__ */ new Set([
|
|
|
16948
16955
|
"tty-pgrp-get",
|
|
16949
16956
|
"tty-pgrp-set",
|
|
16950
16957
|
"sig-mask",
|
|
16958
|
+
"sig-inherited",
|
|
16951
16959
|
"sig-waiting",
|
|
16952
16960
|
"sig-pause",
|
|
16953
16961
|
...SOCKET_OPS,
|
|
@@ -16999,6 +17007,7 @@ var WasmProcess = class {
|
|
|
16999
17007
|
caught = 0;
|
|
17000
17008
|
ignored = 0;
|
|
17001
17009
|
inherited = 0;
|
|
17010
|
+
nocldwait = false;
|
|
17002
17011
|
interrupt = new AbortController();
|
|
17003
17012
|
gone = new AbortController();
|
|
17004
17013
|
dying = false;
|
|
@@ -17030,6 +17039,7 @@ var WasmProcess = class {
|
|
|
17030
17039
|
this.nodes = options.nodes ?? new VfsNodes(options.fs);
|
|
17031
17040
|
if (!options.nodes) options.openFiles?.add(this.nodes);
|
|
17032
17041
|
this.children.onChildState = () => this.signal(SIG.CHLD);
|
|
17042
|
+
this.children.autoReap = () => this.reapsChildren();
|
|
17033
17043
|
this.seedDl(options.dl);
|
|
17034
17044
|
this.children.onReap = (pid2) => {
|
|
17035
17045
|
this.deathSignals.delete(pid2);
|
|
@@ -17147,6 +17157,7 @@ var WasmProcess = class {
|
|
|
17147
17157
|
}
|
|
17148
17158
|
adoptExec(pid) {
|
|
17149
17159
|
this.execChild = pid;
|
|
17160
|
+
this.children.keep(pid);
|
|
17150
17161
|
this.children.watch(pid, (state, sig) => state === "stopped" ? this.stop(sig) : this.cont());
|
|
17151
17162
|
}
|
|
17152
17163
|
onState(listener) {
|
|
@@ -18093,10 +18104,8 @@ var WasmProcess = class {
|
|
|
18093
18104
|
this.setSigwaiter(req.tid, req.set);
|
|
18094
18105
|
return { ok: true, kind: "void" };
|
|
18095
18106
|
case "sig-mask":
|
|
18096
|
-
|
|
18097
|
-
this.
|
|
18098
|
-
this.inherited &= ~(req.defaults ?? 0);
|
|
18099
|
-
return { ok: true, kind: "void" };
|
|
18107
|
+
case "sig-inherited":
|
|
18108
|
+
return this.signalSyscall(req);
|
|
18100
18109
|
case "sig-pause":
|
|
18101
18110
|
return this.pause(cancelled);
|
|
18102
18111
|
case "thread-kill":
|
|
@@ -18108,6 +18117,19 @@ var WasmProcess = class {
|
|
|
18108
18117
|
return { ok: true, kind: "json", json: await this.sudo(req, cancelled) };
|
|
18109
18118
|
}
|
|
18110
18119
|
}
|
|
18120
|
+
signalSyscall(req) {
|
|
18121
|
+
if (req.op === "sig-inherited") {
|
|
18122
|
+
return { ok: true, kind: "json", json: this.inherited & ~this.caught };
|
|
18123
|
+
}
|
|
18124
|
+
this.caught = req.caught;
|
|
18125
|
+
this.ignored = req.ignored;
|
|
18126
|
+
this.inherited &= ~(req.defaults ?? 0);
|
|
18127
|
+
this.nocldwait = req.nocldwait === true;
|
|
18128
|
+
return { ok: true, kind: "void" };
|
|
18129
|
+
}
|
|
18130
|
+
reapsChildren() {
|
|
18131
|
+
return this.nocldwait || this.ignores(sigbit(SIG.CHLD));
|
|
18132
|
+
}
|
|
18111
18133
|
async sudo(req, cancelled) {
|
|
18112
18134
|
const { sudo } = this.options;
|
|
18113
18135
|
if (!sudo) throw new KernelError("ENOSYS");
|