@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.
@@ -2185,6 +2185,7 @@ function liveRoot(Fs, bridge) {
2185
2185
  guardRenames(Fs);
2186
2186
  guardKeptNodes(Fs, plugin.handled);
2187
2187
  guardStaleNodes(Fs, plugin);
2188
+ guardVanished(Fs);
2188
2189
  guardStatfs(Fs);
2189
2190
  const memfs = root.memfs ?? root.node_ops;
2190
2191
  const live = plugin.node_ops;
@@ -2292,6 +2293,44 @@ function guardStaleNodes(Fs, plugin) {
2292
2293
  return fresh;
2293
2294
  };
2294
2295
  }
2296
+ function guardVanished(Fs) {
2297
+ const forget = Fs.hashRemoveNode?.bind(Fs);
2298
+ if (!forget || !Fs.lookupPath || Fs.sliccVanished) return;
2299
+ Fs.sliccVanished = true;
2300
+ const drop = forget;
2301
+ const lookupPath = Fs.lookupPath.bind(Fs);
2302
+ const ops = Fs;
2303
+ const cached = (path, follow2) => {
2304
+ try {
2305
+ const node = lookupPath(path, { follow: follow2 }).node;
2306
+ return node.live && node.live.openCount === 0 && !node.live.dirty ? node : void 0;
2307
+ } catch {
2308
+ return void 0;
2309
+ }
2310
+ };
2311
+ let open;
2312
+ for (const [name2, follows] of RESOLVING) {
2313
+ const op = ops[name2]?.bind(Fs);
2314
+ if (name2 === "open") open = op;
2315
+ if (op) ops[name2] = vanishing(op, follows);
2316
+ }
2317
+ function vanishing(op, follows) {
2318
+ return (...args) => {
2319
+ try {
2320
+ return op(...args);
2321
+ } catch (err) {
2322
+ const path = args[0];
2323
+ const code2 = err.errno;
2324
+ const taken = code2 === wasiErrno("EEXIST") && op === open;
2325
+ if (code2 !== wasiErrno("ENOENT") && !taken || typeof path !== "string") throw err;
2326
+ const node = cached(path, follows(args));
2327
+ if (!node) throw err;
2328
+ drop(node);
2329
+ return op(...args);
2330
+ }
2331
+ };
2332
+ }
2333
+ }
2295
2334
  function guardRenames(Fs) {
2296
2335
  const rename = Fs.rename?.bind(Fs);
2297
2336
  if (!rename || Fs.sliccRename) return;
@@ -2405,7 +2444,7 @@ function readingLinks(Fs) {
2405
2444
  }
2406
2445
  };
2407
2446
  }
2408
- var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
2447
+ var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening, O_NOFOLLOW, RESOLVING;
2409
2448
  var init_live_vfs_fs = __esm({
2410
2449
  "src/realm/live-vfs-fs.ts"() {
2411
2450
  "use strict";
@@ -2433,6 +2472,16 @@ var init_live_vfs_fs = __esm({
2433
2472
  O_PATH = 2097152;
2434
2473
  stale = (s) => !!s.orphan && !s.kept;
2435
2474
  opening = /* @__PURE__ */ new WeakMap();
2475
+ O_NOFOLLOW = 131072;
2476
+ RESOLVING = [
2477
+ ["open", (args) => (args[1] & O_NOFOLLOW) === 0],
2478
+ ["stat", (args) => !args[1]],
2479
+ ["lstat", () => false],
2480
+ ["unlink", () => false],
2481
+ ["rename", () => false],
2482
+ ["readlink", () => false],
2483
+ ["truncate", () => true]
2484
+ ];
2436
2485
  }
2437
2486
  });
2438
2487
 
@@ -2553,7 +2602,7 @@ var KERNEL_VERSION, OS_RELEASE;
2553
2602
  var init_version = __esm({
2554
2603
  "src/version.ts"() {
2555
2604
  "use strict";
2556
- KERNEL_VERSION = true ? "1.122.1" : "0.0.0-dev";
2605
+ KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
2557
2606
  OS_RELEASE = "6.0.0-slicc";
2558
2607
  }
2559
2608
  });
@@ -11049,7 +11098,7 @@ var init_wasi_procfs = __esm({
11049
11098
  });
11050
11099
 
11051
11100
  // src/process/wasi/wasi-signals.ts
11052
- var DELIVERED_MASK, KERNEL_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, SA_NOCLDWAIT, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
11101
+ var DELIVERED_MASK, KERNEL_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, SA_NODEFER, SA_NOCLDWAIT, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
11053
11102
  var init_wasi_signals = __esm({
11054
11103
  "src/process/wasi/wasi-signals.ts"() {
11055
11104
  "use strict";
@@ -11060,6 +11109,7 @@ var init_wasi_signals = __esm({
11060
11109
  KERNEL_DEFAULTS = [SIG.TSTP, SIG.TTIN, SIG.TTOU, SIG.CHLD, SIG.CONT, SIG.URG, SIG.WINCH].map(sigbit).reduce((m, bit) => m | bit, 0);
11061
11110
  LIBC_DEFAULT_EXIT = 127;
11062
11111
  SA_RESTART = 268435456;
11112
+ SA_NODEFER = 1073741824;
11063
11113
  SA_NOCLDWAIT = 2;
11064
11114
  DISPOSITION_IGNORE = 1;
11065
11115
  DISPOSITION_HANDLER = 2;
@@ -11076,6 +11126,9 @@ var init_wasi_signals = __esm({
11076
11126
  handlers = 0;
11077
11127
  ignoring = 0;
11078
11128
  restarting = 0;
11129
+ nodefer = 0;
11130
+ running = 0;
11131
+ deferred = 0;
11079
11132
  defaults = 0;
11080
11133
  nocldwait = false;
11081
11134
  fallBack;
@@ -11102,6 +11155,7 @@ var init_wasi_signals = __esm({
11102
11155
  this.handlers = withBit(this.handlers, bit, disposition === DISPOSITION_HANDLER);
11103
11156
  this.ignoring = withBit(this.ignoring, bit, disposition === DISPOSITION_IGNORE);
11104
11157
  this.restarting = withBit(this.restarting, bit, (flags & SA_RESTART) !== 0);
11158
+ this.nodefer = withBit(this.nodefer, bit, (flags & SA_NODEFER) !== 0);
11105
11159
  this.defaults = withBit(this.defaults, bit, disposition === 0);
11106
11160
  if (sig === SIG.CHLD) this.nocldwait = (flags & SA_NOCLDWAIT) !== 0;
11107
11161
  return E.SUCCESS;
@@ -11144,6 +11198,22 @@ var init_wasi_signals = __esm({
11144
11198
  if ((this.ignoring & sigbit(sig)) === 0) this.defaultAction(sig);
11145
11199
  return;
11146
11200
  }
11201
+ const bit = sigbit(sig);
11202
+ if ((this.running & bit) !== 0 && (this.nodefer & bit) === 0) {
11203
+ this.deferred |= bit;
11204
+ return;
11205
+ }
11206
+ this.running |= bit;
11207
+ try {
11208
+ this.run(handler, sig);
11209
+ } finally {
11210
+ this.running &= ~bit;
11211
+ }
11212
+ if ((this.deferred & bit) === 0) return;
11213
+ this.deferred &= ~bit;
11214
+ this.raise(sig);
11215
+ }
11216
+ run(handler, sig) {
11147
11217
  const outer = { sig: this.delivering, defaulted: this.defaulted, libc: this.libcDefault };
11148
11218
  this.delivering = sig;
11149
11219
  this.defaulted = false;