@ai-ecoverse/slicc-kernel 1.134.3 → 1.134.4

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/README.md CHANGED
@@ -859,13 +859,14 @@ A process's working directory is the directory it changed into, not just its pat
859
859
  - a wasip1 program's `.` (its `.` preopen) can't be opened or listed (`ENOENT`, an empty listing for its preopen descriptor);
860
860
  - its relative lookups and creates are `ENOENT`;
861
861
  - `..` still reaches the parent.
862
+ - an Emscripten program (bash, coreutils, …) and its forked subshells and children: relative paths resolve against `<path> (deleted)`, so `ls` fails with `cannot open directory '.'`, a glob matches nothing, and a relative create is `ENOENT`. `getcwd` is `ENOENT`, as on Linux, so a shell started there says `shell-init: error retrieving current directory` and its `pwd` fails, while bash's own `$PWD`, `cd ..` and `cd /abs` keep working.
863
+ - a JS program: `ctx.fs` and `ctx.sync.fs` with relative paths are `ENOENT`, and `../x` reaches the parent. `ctx.cwd` (and `process.cwd()`) keeps the plain path, as a WASIX program's `getcwd` does. This needs the sync lane, which JS programs have where `SharedArrayBuffer` is available.
862
864
  - **Detection costs nothing in the steady state:**
863
865
  - each held directory has a counter in memory the kernel shares with the process. It moves only when this kernel, another tab, or a `postFsNotice` reports a change at that directory or above it: the kernel's own watcher paths, and every path and tree of a peer change or notice.
864
866
  - a process checks the counter, a memory read, before each relative lookup. Only after it moved does it ask the kernel once (`cwd-check`), and the kernel compares the inode at the path with the one it recorded.
865
867
  - **The `rm` record:** so that `rm -r d; mkdir d` can be told apart, removing a directory leaves the same small record a rename leaves at the name it vacates (see [Metadata](#metadata)).
866
868
  - **Limits:**
867
869
  - a WASIX program's C library keeps the working directory as a string and turns relative paths into absolute ones before they reach the kernel. So a WASIX program still sees the new directory through relative paths, and `getcwd` still returns the path, until wasix-sysroot resolves relative paths against the working directory's descriptor ([#1164](https://github.com/ai-ecoverse/slicc-kernel/issues/1164) stays open for that).
868
- - Emscripten and JS programs: [#1164](https://github.com/ai-ecoverse/slicc-kernel/issues/1164), next.
869
870
  - a removal between the check and the lookup is a race, as with any path, and the lookup sees the new directory.
870
871
  - on a `hostfs` folder the inode is the host's, which a host file system may reuse for the new directory (ext4 can; APFS doesn't). There the replacement isn't noticed.
871
872
  - with more than 1023 distinct working directories held at once, the rest are not tracked.
@@ -1103,7 +1104,7 @@ In a browser every process worker of the page shares one renderer. V8 reserves a
1103
1104
  - **Below a learned ceiling,** a process that still runs out of memory is started again once another process exits, and the spawn fails with `EAGAIN` after 10 s with none.
1104
1105
  - **`/proc/sys/kernel/slicc_wasm_memories`** reads `<live> <ceiling> <source>`. The source is `default`, `learned`, or `none` (with the ceiling 0).
1105
1106
 
1106
- `/proc/sys/kernel/slicc_shared_root` reads `1` while another kernel shares the root (a tab, or a second kernel in the page) and `0` otherwise. A peer whose kernel ends (its tab closes or reloads) stops counting at once: each kernel queues a request for every peer's alive Web Lock, and the grant tells it the peer has gone ([#984](https://github.com/ai-ecoverse/slicc-kernel/issues/984)). `/proc/sys/kernel/slicc_fs_calls` reads the number of path calls (lookups, stats, opens, creates, removals and the like) the kernel has served its programs since it started. `/proc/sys/kernel/slicc_opfs_calls` counts the OPFS calls the kernel has made to look names up and read stats (`getFile`, `getFileHandle`, `getDirectoryHandle`, `resolve`). `/proc/sys/kernel/slicc_opfs_ops` counts every request the root file system makes of OPFS: those lookups, plus creates, writes (one per write, truncate or write session), reads, listings, renames and removals ([#1017](https://github.com/ai-ecoverse/slicc-kernel/issues/1017)). With an idle peer, a tar unpack makes at most 1.5 times the calls it makes alone ([#984](https://github.com/ai-ecoverse/slicc-kernel/issues/984)).
1107
+ `/proc/sys/kernel/slicc_shared_root` reads `1` while another kernel shares the root (a tab, or a second kernel in the page) and `0` otherwise. A peer whose kernel ends (its tab closes or reloads) stops counting at once: each kernel queues a request for every peer's alive Web Lock, and the grant tells it the peer has gone ([#984](https://github.com/ai-ecoverse/slicc-kernel/issues/984)). `/proc/sys/kernel/slicc_fs_calls` reads the number of path calls (lookups, stats, opens, creates, removals and the like) the kernel has served its programs since it started. `/proc/sys/kernel/slicc_opfs_calls` counts the OPFS calls the kernel has made to look names up and read stats (`getFile`, `getFileHandle`, `getDirectoryHandle`, `resolve`). `/proc/sys/kernel/slicc_opfs_ops` counts every request the root file system makes of OPFS: those lookups, plus creates, writes (one per write, truncate or write session), reads, listings, renames and removals ([#1017](https://github.com/ai-ecoverse/slicc-kernel/issues/1017)). With an idle peer, a tar unpack makes at most 1.5 times the calls it makes alone ([#984](https://github.com/ai-ecoverse/slicc-kernel/issues/984)). `/proc/sys/kernel/slicc_cwd_checks` counts the times a process asked the kernel whether its [working directory](#the-working-directory) is still the one it holds.
1107
1108
 
1108
1109
  ### Metadata
1109
1110
 
@@ -7098,7 +7098,7 @@ function satisfies(version, range2) {
7098
7098
  }
7099
7099
 
7100
7100
  // src/version.ts
7101
- var KERNEL_VERSION = true ? "1.134.3" : "0.0.0-dev";
7101
+ var KERNEL_VERSION = true ? "1.134.4" : "0.0.0-dev";
7102
7102
  var OS_RELEASE = "6.0.0-slicc";
7103
7103
  function procVersion() {
7104
7104
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -13662,7 +13662,7 @@ var AsyncRangedFile = class {
13662
13662
  };
13663
13663
 
13664
13664
  // src/realm/sync-sab-bridge.ts
13665
- var PATH_OPS = new Set(SYNC_FS_OPS);
13665
+ var UNCOUNTED_OPS = /* @__PURE__ */ new Set([...SYNC_FS_OPS, "cwd-check", "cwd-chdir"]);
13666
13666
  var SPIN_CORES = 4;
13667
13667
  var spinning = (globalThis.navigator?.hardwareConcurrency ?? 0) >= SPIN_CORES;
13668
13668
 
@@ -13710,6 +13710,8 @@ var SYS_TREE = {
13710
13710
  slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
13711
13711
  `,
13712
13712
  slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
13713
+ `,
13714
+ slicc_cwd_checks: (listing) => `${listing.cwdChecks ?? 0}
13713
13715
  `
13714
13716
  }
13715
13717
  };
@@ -28187,7 +28189,8 @@ var Launcher = class {
28187
28189
  peers: Number(this.locks.shared?.() === true),
28188
28190
  fsCalls: servedFsCalls(),
28189
28191
  opfsCalls: this.rootFs.opfsCalls?.() ?? 0,
28190
- opfsOps: this.rootFs.opfsOps?.() ?? 0
28192
+ opfsOps: this.rootFs.opfsOps?.() ?? 0,
28193
+ cwdChecks: this.cwds.checks
28191
28194
  }),
28192
28195
  sudo: (call, signal) => this.sudo(pid, call, signal),
28193
28196
  crontab: (call) => this.crontab(pid, call),