@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.
@@ -7926,7 +7926,7 @@ function satisfies(version, range2) {
7926
7926
  }
7927
7927
 
7928
7928
  // src/version.ts
7929
- var KERNEL_VERSION = true ? "1.152.1" : "0.0.0-dev";
7929
+ var KERNEL_VERSION = true ? "1.152.2" : "0.0.0-dev";
7930
7930
  var OS_RELEASE = "6.0.0-slicc";
7931
7931
  function procVersion() {
7932
7932
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -8803,6 +8803,7 @@ var PathMarks = class {
8803
8803
  floor = 0;
8804
8804
  touched = /* @__PURE__ */ new Map();
8805
8805
  flying = /* @__PURE__ */ new Map();
8806
+ waiting = /* @__PURE__ */ new Set();
8806
8807
  generation() {
8807
8808
  return this.gen;
8808
8809
  }
@@ -8835,10 +8836,22 @@ var PathMarks = class {
8835
8836
  const n = (this.flying.get(p) ?? 1) - 1;
8836
8837
  if (n > 0) this.flying.set(p, n);
8837
8838
  else this.flying.delete(p);
8839
+ for (const wake of [...this.waiting]) wake();
8838
8840
  this.touch(p);
8839
8841
  }
8840
8842
  }
8841
8843
  }
8844
+ async landed(path) {
8845
+ if (!this.inFlight(path)) return;
8846
+ await new Promise((resolve2) => {
8847
+ const wake = () => {
8848
+ if (this.inFlight(path)) return;
8849
+ this.waiting.delete(wake);
8850
+ resolve2();
8851
+ };
8852
+ this.waiting.add(wake);
8853
+ });
8854
+ }
8842
8855
  inFlight(path) {
8843
8856
  for (let p = path; this.flying.size > 0; p = parentOf5(p)) {
8844
8857
  if (this.flying.has(p)) return true;
@@ -9016,6 +9029,9 @@ var UnlinkedKeeper = class {
9016
9029
  changedSince(path, gen) {
9017
9030
  return this.marks.changedSince(path, gen);
9018
9031
  }
9032
+ landed(path) {
9033
+ return this.marks.landed(path);
9034
+ }
9019
9035
  inFlight(path) {
9020
9036
  return this.marks.inFlight(path);
9021
9037
  }
@@ -12170,6 +12186,9 @@ var HeldPaths = class extends Map {
12170
12186
  trust(handle, doubt) {
12171
12187
  if (this.doubted.get(handle) === doubt) this.doubted.delete(handle);
12172
12188
  }
12189
+ pathOf(handle) {
12190
+ return this.handles.get(handle);
12191
+ }
12173
12192
  keptFor(handle) {
12174
12193
  return this.keptHandles.get(handle);
12175
12194
  }
@@ -14053,12 +14072,20 @@ async function linkedElsewhere(fs, path, from) {
14053
14072
  const source = from === void 0 ? void 0 : await fs.lstat(from).catch(() => void 0);
14054
14073
  return !(source && source.ino === st.ino && source.dev === st.dev);
14055
14074
  }
14075
+ async function gatedByHandle(entry, opEntry, path, req, opReq) {
14076
+ const heldAt2 = () => req.handle === void 0 ? void 0 : opEntry.heldAt?.(req.handle);
14077
+ if (req.handle !== void 0) await opEntry.replacements?.landed?.(heldAt2() ?? path);
14078
+ const at = heldAt2() ?? path;
14079
+ const serve = async () => run(opEntry, await keptOr(opEntry, at, req.handle), opReq);
14080
+ return entry.gate ? entry.gate(at, serve) : serve();
14081
+ }
14056
14082
  async function keptOr(entry, path, handle) {
14057
14083
  if (handle !== void 0) {
14058
14084
  const hidden = entry.keptFor?.(handle)?.hidden;
14059
14085
  if (hidden !== void 0) return hidden;
14060
- await bound(entry, path, handle);
14061
- return path;
14086
+ const at = entry.heldAt?.(handle) ?? path;
14087
+ await bound(entry, at, handle);
14088
+ return at;
14062
14089
  }
14063
14090
  const kept = entry.unlinked?.(path);
14064
14091
  return kept && !await entry.fs.exists(path) ? kept.hidden : path;
@@ -14251,8 +14278,7 @@ async function dispatchPath(entry, req) {
14251
14278
  if (entry.revoked?.(resolvedPath))
14252
14279
  return { ok: false, errno: "EIO", message: `${resolvedPath} was unmounted` };
14253
14280
  if (req.op === "write" && req.mode === 1 || UNLINKED_OPS.has(req.op)) {
14254
- const serve = async () => run(opEntry, await keptOr(opEntry, resolvedPath, req.handle), opReq);
14255
- return await (entry.gate ? entry.gate(resolvedPath, serve) : serve());
14281
+ return await gatedByHandle(entry, opEntry, resolvedPath, req, opReq);
14256
14282
  }
14257
14283
  if (!entry.own || !OWN_OPS.has(req.op)) return await run(opEntry, resolvedPath, opReq);
14258
14284
  const target = resolvedArg2 ?? (TWO_PATHS.has(req.op) ? fs.resolvePath(cwd, req.arg2 ?? "") : resolvedPath);
@@ -25847,6 +25873,7 @@ function holdingToken(opts, holds2, caller) {
25847
25873
  boundIno: holds2.boundIno.bind(holds2),
25848
25874
  trust: holds2.trust.bind(holds2),
25849
25875
  keptFor: (handle) => holds2.keptFor(handle),
25876
+ heldAt: (handle) => holds2.pathOf(handle),
25850
25877
  unlinked: (path) => holds2.keptAt(path),
25851
25878
  gate: (path, op) => opts.unlinkGate && holds2.holding(path) ? opts.unlinkGate.run(holds2.keyOf(path), op) : op(),
25852
25879
  own: (path, op) => holds2.own(path, op),
@@ -31982,9 +32009,9 @@ var Launcher = class {
31982
32009
  }
31983
32010
  moved(from, to, source) {
31984
32011
  this.renameLog.add(from, to);
32012
+ for (const holds2 of this.held) holds2.renamed(from, to);
31985
32013
  if (source) return;
31986
32014
  for (const nodes of this.openFiles) nodes.renamed(from, to);
31987
- for (const holds2 of this.held) holds2.renamed(from, to);
31988
32015
  this.watchers.moved(from, to);
31989
32016
  }
31990
32017
  processChain(fs, nodes, unlinked) {