@ai-ecoverse/slicc-kernel 1.61.0 → 1.61.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.
@@ -6266,7 +6266,7 @@ var UnlinkedKeeper = class {
6266
6266
  async linkedName(hidden) {
6267
6267
  if (!mayLink(this.fs, hidden)) return;
6268
6268
  const st = await this.fs.lstat(hidden).catch(() => void 0);
6269
- if (!st || (st.nlink ?? 1) < 2) return;
6269
+ if (st?.nlink === void 0) return;
6270
6270
  const id2 = `${st.dev ?? 0}:${st.ino}`;
6271
6271
  this.linked.set(hidden, id2);
6272
6272
  this.links.set(id2, (this.links.get(id2) ?? 0) + 1);
@@ -7945,6 +7945,12 @@ async function keptOr(entry, path, handle) {
7945
7945
  const kept = entry.unlinked?.(path);
7946
7946
  return kept && !await entry.fs.exists(path) ? kept.hidden : path;
7947
7947
  }
7948
+ async function keptStat(entry, req) {
7949
+ const hidden = entry.keptFor?.(req.handle ?? -1)?.hidden;
7950
+ if (hidden === void 0)
7951
+ return { ok: false, errno: "ENOENT", message: "the handle keeps no file" };
7952
+ return json2(statJson(await entry.fs.stat(hidden)));
7953
+ }
7948
7954
  async function owned(entry, own, req, path, target) {
7949
7955
  const source = target === path ? void 0 : path;
7950
7956
  if (UNLINKING_OPS.has(req.op) && await linkedElsewhere(entry.fs, target, source)) {
@@ -7959,6 +7965,7 @@ async function dispatchSyncFs(req) {
7959
7965
  try {
7960
7966
  const path = fs.resolvePath(cwd, req.path);
7961
7967
  if (req.op === "kept") return json2(entry.keptFor?.(req.handle ?? -1) !== void 0);
7968
+ if (req.op === "stat" && req.handle !== void 0) return await keptStat(entry, req);
7962
7969
  if (req.op === "statfs") return json2(await entry.statfs?.(path) ?? await storageUsage());
7963
7970
  if (req.op === "hold") {
7964
7971
  const [on, open] = [((req.mode ?? 0) & 1) === 1, ((req.mode ?? 0) & 2) === 2];
@@ -10151,6 +10158,12 @@ var VfsNodes = class {
10151
10158
  async identify(path) {
10152
10159
  return this.byPath.has(path) || !mayLink(this.fs, path) ? void 0 : this.identity(path);
10153
10160
  }
10161
+ async flushLinked(path) {
10162
+ if (this.byId.size === 0 || !mayLink(this.fs, path)) return;
10163
+ const id2 = await this.identity(path);
10164
+ const node = id2 === void 0 ? void 0 : this.byId.get(id2);
10165
+ if (node) await node.serial(() => node.flush());
10166
+ }
10154
10167
  async linked(from, to) {
10155
10168
  const node = this.byPath.get(from);
10156
10169
  if (!node || node.orphaned) return;
@@ -10355,6 +10368,7 @@ function keepingOpen(fs, nodes) {
10355
10368
  const source = fs.resolvePath("/", from);
10356
10369
  const at = await (follow2 ? nodes.targetKey(source) : nodes.entryKey(source));
10357
10370
  await nodes.flush(at);
10371
+ await nodes.flushLinked(at);
10358
10372
  const key = await nodes.entryKey(fs.resolvePath("/", to));
10359
10373
  await nodes.onEntry(key, () => fs.link(from, to, follow2));
10360
10374
  await nodes.linked(at, key);