@ai-ecoverse/slicc-kernel 1.122.1 → 1.122.3

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.
@@ -5432,7 +5432,7 @@ var KERNEL_VERSION, OS_RELEASE;
5432
5432
  var init_version = __esm({
5433
5433
  "src/version.ts"() {
5434
5434
  "use strict";
5435
- KERNEL_VERSION = true ? "1.122.1" : "0.0.0-dev";
5435
+ KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
5436
5436
  OS_RELEASE = "6.0.0-slicc";
5437
5437
  }
5438
5438
  });
@@ -8336,6 +8336,7 @@ function liveRoot(Fs, bridge) {
8336
8336
  guardRenames(Fs);
8337
8337
  guardKeptNodes(Fs, plugin.handled);
8338
8338
  guardStaleNodes(Fs, plugin);
8339
+ guardVanished(Fs);
8339
8340
  guardStatfs(Fs);
8340
8341
  const memfs = root.memfs ?? root.node_ops;
8341
8342
  const live = plugin.node_ops;
@@ -8443,6 +8444,44 @@ function guardStaleNodes(Fs, plugin) {
8443
8444
  return fresh;
8444
8445
  };
8445
8446
  }
8447
+ function guardVanished(Fs) {
8448
+ const forget = Fs.hashRemoveNode?.bind(Fs);
8449
+ if (!forget || !Fs.lookupPath || Fs.sliccVanished) return;
8450
+ Fs.sliccVanished = true;
8451
+ const drop = forget;
8452
+ const lookupPath = Fs.lookupPath.bind(Fs);
8453
+ const ops = Fs;
8454
+ const cached = (path, follow2) => {
8455
+ try {
8456
+ const node = lookupPath(path, { follow: follow2 }).node;
8457
+ return node.live && node.live.openCount === 0 && !node.live.dirty ? node : void 0;
8458
+ } catch {
8459
+ return void 0;
8460
+ }
8461
+ };
8462
+ let open;
8463
+ for (const [name2, follows] of RESOLVING) {
8464
+ const op = ops[name2]?.bind(Fs);
8465
+ if (name2 === "open") open = op;
8466
+ if (op) ops[name2] = vanishing(op, follows);
8467
+ }
8468
+ function vanishing(op, follows) {
8469
+ return (...args) => {
8470
+ try {
8471
+ return op(...args);
8472
+ } catch (err) {
8473
+ const path = args[0];
8474
+ const code2 = err.errno;
8475
+ const taken = code2 === wasiErrno("EEXIST") && op === open;
8476
+ if (code2 !== wasiErrno("ENOENT") && !taken || typeof path !== "string") throw err;
8477
+ const node = cached(path, follows(args));
8478
+ if (!node) throw err;
8479
+ drop(node);
8480
+ return op(...args);
8481
+ }
8482
+ };
8483
+ }
8484
+ }
8446
8485
  function guardRenames(Fs) {
8447
8486
  const rename = Fs.rename?.bind(Fs);
8448
8487
  if (!rename || Fs.sliccRename) return;
@@ -8556,7 +8595,7 @@ function readingLinks(Fs) {
8556
8595
  }
8557
8596
  };
8558
8597
  }
8559
- var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFIFO2, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
8598
+ var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFIFO2, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING;
8560
8599
  var init_live_vfs_fs = __esm({
8561
8600
  "src/realm/live-vfs-fs.ts"() {
8562
8601
  "use strict";
@@ -8584,6 +8623,16 @@ var init_live_vfs_fs = __esm({
8584
8623
  O_PATH = 2097152;
8585
8624
  stale = (s) => !!s.orphan && !s.kept;
8586
8625
  opening = /* @__PURE__ */ new WeakMap();
8626
+ O_NOFOLLOW = 131072;
8627
+ RESOLVING = [
8628
+ ["open", (args) => (args[1] & O_NOFOLLOW) === 0],
8629
+ ["stat", (args) => !args[1]],
8630
+ ["lstat", () => false],
8631
+ ["unlink", () => false],
8632
+ ["rename", () => false],
8633
+ ["readlink", () => false],
8634
+ ["truncate", () => true]
8635
+ ];
8587
8636
  }
8588
8637
  });
8589
8638
 
@@ -14272,7 +14321,7 @@ var init_wasi_module = __esm({
14272
14321
  });
14273
14322
 
14274
14323
  // src/process/wasi/wasi-signals.ts
14275
- var DELIVERED_MASK, KERNEL_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, SA_NOCLDWAIT, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
14324
+ var DELIVERED_MASK, KERNEL_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, SA_NODEFER, SA_NOCLDWAIT, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
14276
14325
  var init_wasi_signals = __esm({
14277
14326
  "src/process/wasi/wasi-signals.ts"() {
14278
14327
  "use strict";
@@ -14283,6 +14332,7 @@ var init_wasi_signals = __esm({
14283
14332
  KERNEL_DEFAULTS = [SIG.TSTP, SIG.TTIN, SIG.TTOU, SIG.CHLD, SIG.CONT, SIG.URG, SIG.WINCH].map(sigbit).reduce((m, bit) => m | bit, 0);
14284
14333
  LIBC_DEFAULT_EXIT = 127;
14285
14334
  SA_RESTART = 268435456;
14335
+ SA_NODEFER = 1073741824;
14286
14336
  SA_NOCLDWAIT = 2;
14287
14337
  DISPOSITION_IGNORE = 1;
14288
14338
  DISPOSITION_HANDLER = 2;
@@ -14299,6 +14349,9 @@ var init_wasi_signals = __esm({
14299
14349
  handlers = 0;
14300
14350
  ignoring = 0;
14301
14351
  restarting = 0;
14352
+ nodefer = 0;
14353
+ running = 0;
14354
+ deferred = 0;
14302
14355
  defaults = 0;
14303
14356
  nocldwait = false;
14304
14357
  fallBack;
@@ -14325,6 +14378,7 @@ var init_wasi_signals = __esm({
14325
14378
  this.handlers = withBit(this.handlers, bit, disposition === DISPOSITION_HANDLER);
14326
14379
  this.ignoring = withBit(this.ignoring, bit, disposition === DISPOSITION_IGNORE);
14327
14380
  this.restarting = withBit(this.restarting, bit, (flags & SA_RESTART) !== 0);
14381
+ this.nodefer = withBit(this.nodefer, bit, (flags & SA_NODEFER) !== 0);
14328
14382
  this.defaults = withBit(this.defaults, bit, disposition === 0);
14329
14383
  if (sig === SIG.CHLD) this.nocldwait = (flags & SA_NOCLDWAIT) !== 0;
14330
14384
  return E.SUCCESS;
@@ -14367,6 +14421,22 @@ var init_wasi_signals = __esm({
14367
14421
  if ((this.ignoring & sigbit(sig)) === 0) this.defaultAction(sig);
14368
14422
  return;
14369
14423
  }
14424
+ const bit = sigbit(sig);
14425
+ if ((this.running & bit) !== 0 && (this.nodefer & bit) === 0) {
14426
+ this.deferred |= bit;
14427
+ return;
14428
+ }
14429
+ this.running |= bit;
14430
+ try {
14431
+ this.run(handler, sig);
14432
+ } finally {
14433
+ this.running &= ~bit;
14434
+ }
14435
+ if ((this.deferred & bit) === 0) return;
14436
+ this.deferred &= ~bit;
14437
+ this.raise(sig);
14438
+ }
14439
+ run(handler, sig) {
14370
14440
  const outer = { sig: this.delivering, defaulted: this.defaulted, libc: this.libcDefault };
14371
14441
  this.delivering = sig;
14372
14442
  this.defaulted = false;