@ai-ecoverse/slicc-kernel 1.93.1 → 1.93.2

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
@@ -10500,7 +10500,7 @@ function mountTable(mounts = []) {
10500
10500
  }
10501
10501
 
10502
10502
  // src/version.ts
10503
- var KERNEL_VERSION = true ? "1.93.1" : "0.0.0-dev";
10503
+ var KERNEL_VERSION = true ? "1.93.2" : "0.0.0-dev";
10504
10504
  var OS_RELEASE = "6.0.0-slicc";
10505
10505
  function procVersion() {
10506
10506
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14073,6 +14073,7 @@ var WasmProcess = class {
14073
14073
  this.nodes = options.nodes ?? new VfsNodes(options.fs);
14074
14074
  if (!options.nodes) options.openFiles?.add(this.nodes);
14075
14075
  this.children.onChildState = () => this.signal(SIG.CHLD);
14076
+ this.seedDl(options.dl);
14076
14077
  this.children.onReap = (pid2) => {
14077
14078
  this.deathSignals.delete(pid2);
14078
14079
  options.onReap?.(pid2);
@@ -14907,7 +14908,7 @@ var WasmProcess = class {
14907
14908
  switch (req.op) {
14908
14909
  case "proc-fork":
14909
14910
  this.refuseIfPending(req.restart);
14910
- return { ok: true, kind: "json", json: await this.children.fork(req.state) };
14911
+ return { ok: true, kind: "json", json: await this.children.fork(this.withDl(req.state)) };
14911
14912
  case "proc-spawn":
14912
14913
  this.refuseIfPending(req.restart);
14913
14914
  return { ok: true, kind: "json", json: await this.spawn(req) };
@@ -15050,6 +15051,20 @@ var WasmProcess = class {
15050
15051
  free: [],
15051
15052
  live: /* @__PURE__ */ new Set()
15052
15053
  };
15054
+ withDl(state) {
15055
+ if (this.dlLog.length === 0) return state;
15056
+ const { next: next2, handle, free, live } = this.closures;
15057
+ const dl = { log: [...this.dlLog], next: next2, handle, free: [...free], live: [...live] };
15058
+ return { ...state, dl };
15059
+ }
15060
+ seedDl(dl) {
15061
+ if (!dl) return;
15062
+ this.dlLog.push(...dl.log);
15063
+ this.closures.next = dl.next;
15064
+ this.closures.handle = dl.handle;
15065
+ this.closures.free.push(...dl.free);
15066
+ for (const index of dl.live) this.closures.live.add(index);
15067
+ }
15053
15068
  allocateClosure(floor) {
15054
15069
  const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
15055
15070
  this.closures.next = Math.max(this.closures.next, index + 1);
@@ -15359,6 +15374,7 @@ function processOptions(opts, header4, hooks, created3) {
15359
15374
  ...opts.settling ? { settling: opts.settling } : {},
15360
15375
  spawner: opts.spawner,
15361
15376
  forker: opts.forker,
15377
+ ...opts.fork?.dl ? { dl: opts.fork.dl } : {},
15362
15378
  fs: opts.fs,
15363
15379
  kill: opts.kill,
15364
15380
  ...opts.writesBack ? { writesBack: opts.writesBack } : {},
@@ -19368,8 +19384,17 @@ var Launcher = class {
19368
19384
  }
19369
19385
  if (interpreter(head) !== "node") return void 0;
19370
19386
  const wasm = modulePath(glue);
19371
- if (!await this.base.exists(wasm)) return void 0;
19372
- return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19387
+ if (await this.base.exists(wasm)) {
19388
+ return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19389
+ }
19390
+ const owner = await this.glueOwner(glue, baseName(file), scope);
19391
+ return owner && { ...targetOf(owner), ...asked };
19392
+ }
19393
+ async glueOwner(glue, name2, scope) {
19394
+ const owners = [...(await this.commands(scope)).values()].filter(
19395
+ (c) => c.abi === "emscripten" && !c.script && c.glue === glue
19396
+ );
19397
+ return owners.find((c) => c.name === name2) ?? owners[0];
19373
19398
  }
19374
19399
  async head(path) {
19375
19400
  try {