@ai-ecoverse/slicc-kernel 1.60.2 → 1.61.1

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.
package/dist/node.js CHANGED
@@ -2161,6 +2161,7 @@ function processes(l, self) {
2161
2161
  const viewer = credOf(self);
2162
2162
  return l.list(viewer).map(({ tid: _, cred = viewer, umask: _umask, ...entry }) => ({
2163
2163
  ...entry,
2164
+ rss: entry.memory,
2164
2165
  uid: cred.euid,
2165
2166
  gid: cred.egid
2166
2167
  }));
@@ -3541,7 +3542,7 @@ var UnlinkedKeeper = class {
3541
3542
  async linkedName(hidden) {
3542
3543
  if (!mayLink(this.fs, hidden)) return;
3543
3544
  const st = await this.fs.lstat(hidden).catch(() => void 0);
3544
- if (!st || (st.nlink ?? 1) < 2) return;
3545
+ if (st?.nlink === void 0) return;
3545
3546
  const id2 = `${st.dev ?? 0}:${st.ino}`;
3546
3547
  this.linked.set(hidden, id2);
3547
3548
  this.links.set(id2, (this.links.get(id2) ?? 0) + 1);
@@ -6369,6 +6370,12 @@ async function keptOr(entry, path, handle) {
6369
6370
  const kept = entry.unlinked?.(path);
6370
6371
  return kept && !await entry.fs.exists(path) ? kept.hidden : path;
6371
6372
  }
6373
+ async function keptStat(entry, req) {
6374
+ const hidden = entry.keptFor?.(req.handle ?? -1)?.hidden;
6375
+ if (hidden === void 0)
6376
+ return { ok: false, errno: "ENOENT", message: "the handle keeps no file" };
6377
+ return json2(statJson(await entry.fs.stat(hidden)));
6378
+ }
6372
6379
  async function owned(entry, own, req, path, target) {
6373
6380
  const source = target === path ? void 0 : path;
6374
6381
  if (UNLINKING_OPS.has(req.op) && await linkedElsewhere(entry.fs, target, source)) {
@@ -6383,6 +6390,7 @@ async function dispatchSyncFs(req) {
6383
6390
  try {
6384
6391
  const path = fs.resolvePath(cwd, req.path);
6385
6392
  if (req.op === "kept") return json2(entry.keptFor?.(req.handle ?? -1) !== void 0);
6393
+ if (req.op === "stat" && req.handle !== void 0) return await keptStat(entry, req);
6386
6394
  if (req.op === "statfs") return json2(await entry.statfs?.(path) ?? await storageUsage());
6387
6395
  if (req.op === "hold") {
6388
6396
  const [on, open] = [((req.mode ?? 0) & 1) === 1, ((req.mode ?? 0) & 2) === 2];
@@ -9923,6 +9931,12 @@ var VfsNodes = class {
9923
9931
  async identify(path) {
9924
9932
  return this.byPath.has(path) || !mayLink(this.fs, path) ? void 0 : this.identity(path);
9925
9933
  }
9934
+ async flushLinked(path) {
9935
+ if (this.byId.size === 0 || !mayLink(this.fs, path)) return;
9936
+ const id2 = await this.identity(path);
9937
+ const node = id2 === void 0 ? void 0 : this.byId.get(id2);
9938
+ if (node) await node.serial(() => node.flush());
9939
+ }
9926
9940
  async linked(from, to) {
9927
9941
  const node = this.byPath.get(from);
9928
9942
  if (!node || node.orphaned) return;
@@ -10127,6 +10141,7 @@ function keepingOpen(fs, nodes) {
10127
10141
  const source = fs.resolvePath("/", from);
10128
10142
  const at = await (follow2 ? nodes.targetKey(source) : nodes.entryKey(source));
10129
10143
  await nodes.flush(at);
10144
+ await nodes.flushLinked(at);
10130
10145
  const key = await nodes.entryKey(fs.resolvePath("/", to));
10131
10146
  await nodes.onEntry(key, () => fs.link(from, to, follow2));
10132
10147
  await nodes.linked(at, key);