@ai-ecoverse/slicc-kernel 1.107.1 → 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/dist/node.js CHANGED
@@ -6435,7 +6435,7 @@ function satisfies(version, range2) {
6435
6435
  }
6436
6436
 
6437
6437
  // src/version.ts
6438
- var KERNEL_VERSION = true ? "1.107.1" : "0.0.0-dev";
6438
+ var KERNEL_VERSION = true ? "1.108.0" : "0.0.0-dev";
6439
6439
  var OS_RELEASE = "6.0.0-slicc";
6440
6440
  function procVersion() {
6441
6441
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8828,6 +8828,8 @@ var ChildTable = class {
8828
8828
  leftovers = /* @__PURE__ */ new Map();
8829
8829
  onChildState;
8830
8830
  onReap;
8831
+ autoReap;
8832
+ kept = /* @__PURE__ */ new Set();
8831
8833
  stateChanged = [];
8832
8834
  watchers = /* @__PURE__ */ new Map();
8833
8835
  parentFds;
@@ -8881,6 +8883,7 @@ var ChildTable = class {
8881
8883
  void handle.exited.then((code) => {
8882
8884
  child.code = code;
8883
8885
  this.watchers.delete(handle.pid);
8886
+ if (!this.kept.delete(handle.pid) && this.autoReap?.()) this.reap(handle.pid, code);
8884
8887
  this.onChildState?.();
8885
8888
  });
8886
8889
  handle.onState?.((state, sig) => {
@@ -8975,6 +8978,9 @@ var ChildTable = class {
8975
8978
  if (child && child.captured.size > 0) this.leftovers.set(pid, child.captured);
8976
8979
  return [pid, waitStatus(code, child?.termsig?.())];
8977
8980
  }
8981
+ keep(pid) {
8982
+ this.kept.add(pid);
8983
+ }
8978
8984
  pids() {
8979
8985
  return [...this.children.keys()];
8980
8986
  }
@@ -15256,6 +15262,7 @@ async function runChild(req, deps) {
15256
15262
  },
15257
15263
  stdio
15258
15264
  );
15265
+ deps.children.keep(pid);
15259
15266
  } catch (e) {
15260
15267
  if (!(e instanceof SpawnError)) throw e;
15261
15268
  const outcome2 = { pid: 0, status: null, error: { code: e.code }, out: 0, err: 0 };
@@ -16593,6 +16600,7 @@ var SYSCALL_OPS = /* @__PURE__ */ new Set([
16593
16600
  "tty-pgrp-get",
16594
16601
  "tty-pgrp-set",
16595
16602
  "sig-mask",
16603
+ "sig-inherited",
16596
16604
  "sig-waiting",
16597
16605
  "sig-pause",
16598
16606
  ...SOCKET_OPS,
@@ -16644,6 +16652,7 @@ var WasmProcess = class {
16644
16652
  caught = 0;
16645
16653
  ignored = 0;
16646
16654
  inherited = 0;
16655
+ nocldwait = false;
16647
16656
  interrupt = new AbortController();
16648
16657
  gone = new AbortController();
16649
16658
  dying = false;
@@ -16675,6 +16684,7 @@ var WasmProcess = class {
16675
16684
  this.nodes = options.nodes ?? new VfsNodes(options.fs);
16676
16685
  if (!options.nodes) options.openFiles?.add(this.nodes);
16677
16686
  this.children.onChildState = () => this.signal(SIG.CHLD);
16687
+ this.children.autoReap = () => this.reapsChildren();
16678
16688
  this.seedDl(options.dl);
16679
16689
  this.children.onReap = (pid2) => {
16680
16690
  this.deathSignals.delete(pid2);
@@ -16792,6 +16802,7 @@ var WasmProcess = class {
16792
16802
  }
16793
16803
  adoptExec(pid) {
16794
16804
  this.execChild = pid;
16805
+ this.children.keep(pid);
16795
16806
  this.children.watch(pid, (state, sig) => state === "stopped" ? this.stop(sig) : this.cont());
16796
16807
  }
16797
16808
  onState(listener) {
@@ -17738,10 +17749,8 @@ var WasmProcess = class {
17738
17749
  this.setSigwaiter(req.tid, req.set);
17739
17750
  return { ok: true, kind: "void" };
17740
17751
  case "sig-mask":
17741
- this.caught = req.caught;
17742
- this.ignored = req.ignored;
17743
- this.inherited &= ~(req.defaults ?? 0);
17744
- return { ok: true, kind: "void" };
17752
+ case "sig-inherited":
17753
+ return this.signalSyscall(req);
17745
17754
  case "sig-pause":
17746
17755
  return this.pause(cancelled);
17747
17756
  case "thread-kill":
@@ -17753,6 +17762,19 @@ var WasmProcess = class {
17753
17762
  return { ok: true, kind: "json", json: await this.sudo(req, cancelled) };
17754
17763
  }
17755
17764
  }
17765
+ signalSyscall(req) {
17766
+ if (req.op === "sig-inherited") {
17767
+ return { ok: true, kind: "json", json: this.inherited & ~this.caught };
17768
+ }
17769
+ this.caught = req.caught;
17770
+ this.ignored = req.ignored;
17771
+ this.inherited &= ~(req.defaults ?? 0);
17772
+ this.nocldwait = req.nocldwait === true;
17773
+ return { ok: true, kind: "void" };
17774
+ }
17775
+ reapsChildren() {
17776
+ return this.nocldwait || this.ignores(sigbit(SIG.CHLD));
17777
+ }
17756
17778
  async sudo(req, cancelled) {
17757
17779
  const { sudo } = this.options;
17758
17780
  if (!sudo) throw new KernelError("ENOSYS");