@ai-ecoverse/slicc-kernel 1.120.2 → 1.121.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 CHANGED
@@ -324,7 +324,7 @@ On top of preview1 a WASI program gets:
324
324
  - a standard signal doesn't queue, so the first pending instance's sender is kept until the signal is taken.
325
325
  A kernel without the imports answers `ENOSYS`, and the libc reports `SI_USER` with pid and uid 0, as before. **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.
326
326
  - **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.
327
- - **Sockets**: the WASIX socket calls (`sock_open`, `sock_pair` for an `AF_UNIX` stream or datagram 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 on the thread that wrote and then the write fails with `EPIPE` (#820); 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.
327
+ - **Sockets**: the WASIX socket calls (`sock_open`, `sock_pair` for an `AF_UNIX` stream or datagram 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 on the thread that wrote and then the write fails with `EPIPE` (#820); 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 WASIX program's libc reads an inherited ignore back through `slicc.sigaction_inherited` (wasix-sysroot -32 and later; see below). An Emscripten program's shim reads it from `Module.sliccKernel.sigInherited()` (#965, homescoop#973). That's a mask with bit n set for signal n (not bit n-1, as the WASIX import has it) holding only inherited `SIG_IGN`s, never `SIGKILL` or `SIGSTOP`. The shim seeds its `sigaction` table from it in a constructor that runs before any user constructor. The kernel puts the function on `Module.sliccKernel` before the glue runs constructors, ahead of the rest of `sliccKernel`. On a kernel without the function it is undefined, and the shim keeps the defaults. 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.
328
328
  - **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.
329
329
 
330
330
  ### Program imports
@@ -1158,6 +1158,12 @@ A threaded WASIX C program for `test/integration/thread-signal.test.mjs` (#520).
1158
1158
 
1159
1159
  **Build:** `WASIX_SYSROOT_28=/path/to/wasix-sysroot ./build.sh`, with `wasixcc` 0.4.7 (`-pthread`) and binaryen's `wasm-opt` on `PATH`. `bin/sigthread.wasm` is 44,788 bytes, sha256 `5781fa39d0a0032cd9b214b71de1f15f589b40e4cecd6862362048dd27f0db56`.
1160
1160
 
1161
+ ### `esiginherit`
1162
+
1163
+ An Emscripten C program for `test/integration/esiginherit.test.mjs` (#965), linked with homescoop's `cli` shim profile, whose `slicc_signals.c` seeds inherited `SIG_IGN`s in a `constructor(101)` from `Module.sliccKernel.sigInherited()` (homescoop#973). It prints what its own `sigaction(sig, NULL, &old)` reports for `SIGPIPE`, `SIGHUP` and `SIGINT`.
1164
+
1165
+ **Build:** `HOMESCOOP_ROOT=/path/to/homescoop ./build.sh`, with emsdk 4.0.23 (homescoop's `scripts/install-emsdk.sh`). It was built at homescoop `bb/973-947-shims` f08e0777. `bin/esiginherit` is 56,870 bytes, sha256 `17ea93489e6a82c669dceab63e270e790bf1c3836a872f4faa928489c8bf3a48`; `bin/esiginherit.wasm` is 8,422 bytes, sha256 `c635388da3f0323dfae558bab83cda64308d15fb78509ae77ca1d4bcac425cda`.
1166
+
1161
1167
  ### `inherittest`
1162
1168
 
1163
1169
  A WASIX C program for `test/integration/sig-inherited.test.mjs` (#820), built on wasix-sysroot 2025.9.30-33, whose libc seeds its `sigaction` table from `slicc.sigaction_inherited`. It prints what its own `sigaction(sig, NULL, &old)` reports for `SIGPIPE`, `SIGHUP` and `SIGINT` (`ignored`, `default` or `caught`), then sets `SIGPIPE` back to `SIG_DFL` and reports it again.
@@ -6405,7 +6405,7 @@ function satisfies(version, range2) {
6405
6405
  }
6406
6406
 
6407
6407
  // src/version.ts
6408
- var KERNEL_VERSION = true ? "1.120.2" : "0.0.0-dev";
6408
+ var KERNEL_VERSION = true ? "1.121.0" : "0.0.0-dev";
6409
6409
  var OS_RELEASE = "6.0.0-slicc";
6410
6410
  function procVersion() {
6411
6411
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -5431,7 +5431,7 @@ var KERNEL_VERSION, OS_RELEASE;
5431
5431
  var init_version = __esm({
5432
5432
  "src/version.ts"() {
5433
5433
  "use strict";
5434
- KERNEL_VERSION = true ? "1.120.2" : "0.0.0-dev";
5434
+ KERNEL_VERSION = true ? "1.121.0" : "0.0.0-dev";
5435
5435
  OS_RELEASE = "6.0.0-slicc";
5436
5436
  }
5437
5437
  });
@@ -12871,6 +12871,14 @@ var init_process_fork = __esm({
12871
12871
  });
12872
12872
 
12873
12873
  // src/process/process-children.ts
12874
+ function inheritedOf(r) {
12875
+ return r.ok && r.kind === "json" ? r.json & ~UNSEEDED : 0;
12876
+ }
12877
+ function inheritedSignals(transport) {
12878
+ return inheritedOf(
12879
+ transport.call({ op: "sig-inherited" }, Number.POSITIVE_INFINITY, "sig-inherited")
12880
+ );
12881
+ }
12874
12882
  function status(r) {
12875
12883
  return r.ok ? 0 : -wasiErrno(r.errno);
12876
12884
  }
@@ -13089,9 +13097,8 @@ function createProcessKernel(deps) {
13089
13097
  execCaptures.delete(pid);
13090
13098
  return status2;
13091
13099
  },
13092
- pause() {
13093
- return status(call2({ op: "sig-pause" }, "pause"));
13094
- },
13100
+ pause: () => status(call2({ op: "sig-pause" }, "pause")),
13101
+ sigInherited: () => inheritedOf(call2({ op: "sig-inherited" }, "sig-inherited")),
13095
13102
  mount(source, target, type, flags, data) {
13096
13103
  const req = { op: "mount", source, target: at(target), type, flags, data };
13097
13104
  return status(call2(req, `mount ${target}`));
@@ -13140,7 +13147,7 @@ function createProcessKernel(deps) {
13140
13147
  }
13141
13148
  };
13142
13149
  }
13143
- var S_IFMT3, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
13150
+ var S_IFMT3, UNSEEDED, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
13144
13151
  var init_process_children = __esm({
13145
13152
  "src/process/process-children.ts"() {
13146
13153
  "use strict";
@@ -13149,6 +13156,7 @@ var init_process_children = __esm({
13149
13156
  init_process_locks();
13150
13157
  init_wasi_errno();
13151
13158
  S_IFMT3 = 61440;
13159
+ UNSEEDED = sigbit(SIG.KILL) | sigbit(SIG.STOP) | 1;
13152
13160
  S_IFDIR2 = 16384;
13153
13161
  POLLIN2 = 1;
13154
13162
  POLLOUT2 = 4;
@@ -13843,6 +13851,7 @@ async function runWasmProcess(init, port3, deps = {}) {
13843
13851
  sliccPid: id.pid,
13844
13852
  sliccPpid: id.ppid,
13845
13853
  sliccEnv: init.env,
13854
+ sliccKernel: { sigInherited: () => inheritedSignals(transport) },
13846
13855
  print: say(1),
13847
13856
  printErr: say(2),
13848
13857
  instantiateWasm(imports, done) {