@ai-ecoverse/slicc-kernel 1.152.1 → 1.152.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.
@@ -7213,7 +7213,7 @@ var KERNEL_VERSION, OS_RELEASE;
7213
7213
  var init_version = __esm({
7214
7214
  "src/version.ts"() {
7215
7215
  "use strict";
7216
- KERNEL_VERSION = true ? "1.152.1" : "0.0.0-dev";
7216
+ KERNEL_VERSION = true ? "1.152.2" : "0.0.0-dev";
7217
7217
  OS_RELEASE = "6.0.0-slicc";
7218
7218
  }
7219
7219
  });
package/dist/node.js CHANGED
@@ -3365,7 +3365,7 @@ function satisfies(version, range2) {
3365
3365
  }
3366
3366
 
3367
3367
  // src/version.ts
3368
- var KERNEL_VERSION = true ? "1.152.1" : "0.0.0-dev";
3368
+ var KERNEL_VERSION = true ? "1.152.2" : "0.0.0-dev";
3369
3369
  var OS_RELEASE = "6.0.0-slicc";
3370
3370
  function procVersion() {
3371
3371
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -4242,6 +4242,7 @@ var PathMarks = class {
4242
4242
  floor = 0;
4243
4243
  touched = /* @__PURE__ */ new Map();
4244
4244
  flying = /* @__PURE__ */ new Map();
4245
+ waiting = /* @__PURE__ */ new Set();
4245
4246
  generation() {
4246
4247
  return this.gen;
4247
4248
  }
@@ -4274,10 +4275,22 @@ var PathMarks = class {
4274
4275
  const n = (this.flying.get(p) ?? 1) - 1;
4275
4276
  if (n > 0) this.flying.set(p, n);
4276
4277
  else this.flying.delete(p);
4278
+ for (const wake of [...this.waiting]) wake();
4277
4279
  this.touch(p);
4278
4280
  }
4279
4281
  }
4280
4282
  }
4283
+ async landed(path) {
4284
+ if (!this.inFlight(path)) return;
4285
+ await new Promise((resolve2) => {
4286
+ const wake = () => {
4287
+ if (this.inFlight(path)) return;
4288
+ this.waiting.delete(wake);
4289
+ resolve2();
4290
+ };
4291
+ this.waiting.add(wake);
4292
+ });
4293
+ }
4281
4294
  inFlight(path) {
4282
4295
  for (let p = path; this.flying.size > 0; p = parentOf2(p)) {
4283
4296
  if (this.flying.has(p)) return true;
@@ -4468,6 +4481,9 @@ var UnlinkedKeeper = class {
4468
4481
  changedSince(path, gen) {
4469
4482
  return this.marks.changedSince(path, gen);
4470
4483
  }
4484
+ landed(path) {
4485
+ return this.marks.landed(path);
4486
+ }
4471
4487
  inFlight(path) {
4472
4488
  return this.marks.inFlight(path);
4473
4489
  }
@@ -8190,6 +8206,9 @@ var HeldPaths = class extends Map {
8190
8206
  trust(handle, doubt) {
8191
8207
  if (this.doubted.get(handle) === doubt) this.doubted.delete(handle);
8192
8208
  }
8209
+ pathOf(handle) {
8210
+ return this.handles.get(handle);
8211
+ }
8193
8212
  keptFor(handle) {
8194
8213
  return this.keptHandles.get(handle);
8195
8214
  }
@@ -10073,12 +10092,20 @@ async function linkedElsewhere(fs, path, from) {
10073
10092
  const source = from === void 0 ? void 0 : await fs.lstat(from).catch(() => void 0);
10074
10093
  return !(source && source.ino === st.ino && source.dev === st.dev);
10075
10094
  }
10095
+ async function gatedByHandle(entry, opEntry, path, req, opReq) {
10096
+ const heldAt2 = () => req.handle === void 0 ? void 0 : opEntry.heldAt?.(req.handle);
10097
+ if (req.handle !== void 0) await opEntry.replacements?.landed?.(heldAt2() ?? path);
10098
+ const at = heldAt2() ?? path;
10099
+ const serve = async () => run(opEntry, await keptOr(opEntry, at, req.handle), opReq);
10100
+ return entry.gate ? entry.gate(at, serve) : serve();
10101
+ }
10076
10102
  async function keptOr(entry, path, handle) {
10077
10103
  if (handle !== void 0) {
10078
10104
  const hidden = entry.keptFor?.(handle)?.hidden;
10079
10105
  if (hidden !== void 0) return hidden;
10080
- await bound(entry, path, handle);
10081
- return path;
10106
+ const at = entry.heldAt?.(handle) ?? path;
10107
+ await bound(entry, at, handle);
10108
+ return at;
10082
10109
  }
10083
10110
  const kept = entry.unlinked?.(path);
10084
10111
  return kept && !await entry.fs.exists(path) ? kept.hidden : path;
@@ -10271,8 +10298,7 @@ async function dispatchPath(entry, req) {
10271
10298
  if (entry.revoked?.(resolvedPath))
10272
10299
  return { ok: false, errno: "EIO", message: `${resolvedPath} was unmounted` };
10273
10300
  if (req.op === "write" && req.mode === 1 || UNLINKED_OPS.has(req.op)) {
10274
- const serve = async () => run(opEntry, await keptOr(opEntry, resolvedPath, req.handle), opReq);
10275
- return await (entry.gate ? entry.gate(resolvedPath, serve) : serve());
10301
+ return await gatedByHandle(entry, opEntry, resolvedPath, req, opReq);
10276
10302
  }
10277
10303
  if (!entry.own || !OWN_OPS.has(req.op)) return await run(opEntry, resolvedPath, opReq);
10278
10304
  const target = resolvedArg2 ?? (TWO_PATHS.has(req.op) ? fs.resolvePath(cwd, req.arg2 ?? "") : resolvedPath);
@@ -21707,6 +21733,7 @@ function holdingToken(opts, holds2, caller) {
21707
21733
  boundIno: holds2.boundIno.bind(holds2),
21708
21734
  trust: holds2.trust.bind(holds2),
21709
21735
  keptFor: (handle) => holds2.keptFor(handle),
21736
+ heldAt: (handle) => holds2.pathOf(handle),
21710
21737
  unlinked: (path) => holds2.keptAt(path),
21711
21738
  gate: (path, op) => opts.unlinkGate && holds2.holding(path) ? opts.unlinkGate.run(holds2.keyOf(path), op) : op(),
21712
21739
  own: (path, op) => holds2.own(path, op),
@@ -30996,9 +31023,9 @@ var Launcher = class {
30996
31023
  }
30997
31024
  moved(from, to, source) {
30998
31025
  this.renameLog.add(from, to);
31026
+ for (const holds2 of this.held) holds2.renamed(from, to);
30999
31027
  if (source) return;
31000
31028
  for (const nodes of this.openFiles) nodes.renamed(from, to);
31001
- for (const holds2 of this.held) holds2.renamed(from, to);
31002
31029
  this.watchers.moved(from, to);
31003
31030
  }
31004
31031
  processChain(fs, nodes, unlinked) {