@ai-ecoverse/slicc-kernel 1.125.9 → 1.125.10
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 +1 -1
- package/dist/kernel-worker.js +31 -7
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +1 -1
- package/dist/node-process-worker.js.map +1 -1
- package/dist/node.js +31 -7
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +1 -1
- package/dist/process-worker.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -635,7 +635,7 @@ The proxy answers `200` with `Content-Type: application/vnd.slicc.raw-fetch`: a
|
|
|
635
635
|
|
|
636
636
|
## Filesystem
|
|
637
637
|
|
|
638
|
-
`/` is the OPFS root. Each process mounts the top-level directories that exist when it starts (plus `/usr` and `/bin`), so files in them are shared by all processes and visible through the OPFS API as soon as the process that wrote them has closed them; `run` resolves only after that. `createKernel` creates `/tmp` and `/home` in OPFS, so they are shared too. Files directly in `/`, and directories created there after a process started, are OPFS as well, the same for Emscripten and WASI programs; only `/dev` and `/proc` live in each process's memory. A program's `mkdir` (WASI `path_create_directory`, Emscripten's `mkdir`) is exclusive, as on Linux: it fails with `EEXIST` when the name exists, and of several processes or threads making one name at once exactly one succeeds, so a directory works as a lock. Under a missing directory it fails with `ENOENT`, as on Linux (`mkdir -p` and `os.makedirs` make the parents in the program); a JS program's `ctx.fs.mkdir` makes parents itself. The kernel makes the system `PNPM_HOME` (`/usr/local/share/pnpm`, or the embedder's) when it starts, since pnpm makes only its `bin` directory there. A full origin storage (`QuotaExceededError`, which also comes early in a browser's private or off-the-record contexts, whatever `navigator.storage.estimate()` says) is `ENOSPC`, never retried. An OPFS or IndexedDB failure that has no POSIX counterpart is `EIO`; its message names the DOM error and the operation (`lookup`, `read`, `write`, `commit` or `sidecar`), and the kernel worker logs the first of each kind to its console. File contents are buffered per open file and written back on close, `fsync` and exit, so a refused write (`ENOSPC`, `EIO`) surfaces at that close or `fsync`, and a program that ignores close errors doesn't see it (`echo x > f` can exit 0 with `f` empty, as with any buffered write-back). A write-back error a close has already reported to a WASI program isn't raised again when it exits, so the program keeps its own exit status. Metadata operations (`mkdir`, `rename`, `rm`, …) go straight to OPFS. The kernel worker is the only writer.
|
|
638
|
+
`/` is the OPFS root. Each process mounts the top-level directories that exist when it starts (plus `/usr` and `/bin`), so files in them are shared by all processes and visible through the OPFS API as soon as the process that wrote them has closed them; `run` resolves only after that. `createKernel` creates `/tmp` and `/home` in OPFS, so they are shared too. Files directly in `/`, and directories created there after a process started, are OPFS as well, the same for Emscripten and WASI programs; only `/dev` and `/proc` live in each process's memory. A program's `mkdir` (WASI `path_create_directory`, Emscripten's `mkdir`) is exclusive, as on Linux: it fails with `EEXIST` when the name exists, and of several processes or threads making one name at once exactly one succeeds, so a directory works as a lock. Under a missing directory it fails with `ENOENT`, as on Linux (`mkdir -p` and `os.makedirs` make the parents in the program); a JS program's `ctx.fs.mkdir` makes parents itself. The kernel makes the system `PNPM_HOME` (`/usr/local/share/pnpm`, or the embedder's) when it starts, since pnpm makes only its `bin` directory there. A full origin storage (`QuotaExceededError`, which also comes early in a browser's private or off-the-record contexts, whatever `navigator.storage.estimate()` says) is `ENOSPC`, never retried. A read that meets `NotFoundError` while a writer outside the kernel swaps the file in with `createWritable` (and a `stat`, `lstat` or `utimes` that meets it) looks the name up again, up to three times, before it fails ([#1075](https://github.com/ai-ecoverse/slicc-kernel/issues/1075)), so a program whose package is overwritten in place keeps starting. An OPFS or IndexedDB failure that has no POSIX counterpart is `EIO`; its message names the DOM error and the operation (`lookup`, `read`, `write`, `commit` or `sidecar`), and the kernel worker logs the first of each kind to its console. File contents are buffered per open file and written back on close, `fsync` and exit, so a refused write (`ENOSPC`, `EIO`) surfaces at that close or `fsync`, and a program that ignores close errors doesn't see it (`echo x > f` can exit 0 with `f` empty, as with any buffered write-back). A write-back error a close has already reported to a WASI program isn't raised again when it exits, so the program keeps its own exit status. Metadata operations (`mkdir`, `rename`, `rm`, …) go straight to OPFS. The kernel worker is the only writer.
|
|
639
639
|
|
|
640
640
|
A lookup follows at most 40 symlinks, as Linux does: the 41st is `ELOOP`, for WASI programs, JS programs and the kernel API alike, with or without `..` in a link's target. Emscripten programs resolve paths in their glue, which stops one link earlier, at 40.
|
|
641
641
|
|
package/dist/kernel-worker.js
CHANGED
|
@@ -1077,6 +1077,17 @@ var S_IFIFO = 4096;
|
|
|
1077
1077
|
var PERM_MASK = 4095;
|
|
1078
1078
|
var S_ISGID2 = 1024;
|
|
1079
1079
|
var READ_ATTEMPTS = 3;
|
|
1080
|
+
async function swapped(op) {
|
|
1081
|
+
for (let attempt = 1; ; attempt++) {
|
|
1082
|
+
try {
|
|
1083
|
+
return await op();
|
|
1084
|
+
} catch (err) {
|
|
1085
|
+
if (err?.name !== "NotFoundError" || attempt >= READ_ATTEMPTS) {
|
|
1086
|
+
throw err;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1080
1091
|
var MAX_LINKS2 = 40;
|
|
1081
1092
|
var CHECK_MS = 1e3;
|
|
1082
1093
|
var ABSENT_MS = 2;
|
|
@@ -1862,10 +1873,14 @@ var OpfsFs = class {
|
|
|
1862
1873
|
return { ...stat, ...ownOf(meta) ?? inherit(entries) };
|
|
1863
1874
|
}
|
|
1864
1875
|
stat(path) {
|
|
1865
|
-
return this.unreplaced(
|
|
1876
|
+
return this.unreplaced(
|
|
1877
|
+
() => swapped(async () => this.describe(await this.located(path, true)))
|
|
1878
|
+
);
|
|
1866
1879
|
}
|
|
1867
1880
|
lstat(path) {
|
|
1868
|
-
return this.unreplaced(
|
|
1881
|
+
return this.unreplaced(
|
|
1882
|
+
() => swapped(async () => this.describe(await this.located(path, false)))
|
|
1883
|
+
);
|
|
1869
1884
|
}
|
|
1870
1885
|
async exists(path) {
|
|
1871
1886
|
return this.locate(path, true).then(
|
|
@@ -1891,8 +1906,17 @@ var OpfsFs = class {
|
|
|
1891
1906
|
}
|
|
1892
1907
|
reading(path, op) {
|
|
1893
1908
|
return this.unreplaced(async () => {
|
|
1894
|
-
|
|
1895
|
-
|
|
1909
|
+
for (let attempt = 1; ; attempt++) {
|
|
1910
|
+
const found = await this.locate(path, true);
|
|
1911
|
+
const handle = found.handle;
|
|
1912
|
+
if (handle.kind === "directory") throw fsError("EISDIR", path);
|
|
1913
|
+
try {
|
|
1914
|
+
return await this.retrying(path, () => op(handle), false);
|
|
1915
|
+
} catch (err) {
|
|
1916
|
+
if (err.code !== "ENOENT" || attempt >= READ_ATTEMPTS) throw err;
|
|
1917
|
+
this.files.delete(found.path);
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1896
1920
|
});
|
|
1897
1921
|
}
|
|
1898
1922
|
async existing(path, writing = false) {
|
|
@@ -2396,10 +2420,10 @@ var OpfsFs = class {
|
|
|
2396
2420
|
}));
|
|
2397
2421
|
}
|
|
2398
2422
|
async utimes(path, atime, mtime) {
|
|
2399
|
-
await this.setTimes(await this.locate(path, true), atime, mtime);
|
|
2423
|
+
await swapped(async () => this.setTimes(await this.locate(path, true), atime, mtime));
|
|
2400
2424
|
}
|
|
2401
2425
|
async lutimes(path, atime, mtime) {
|
|
2402
|
-
await this.setTimes(await this.locate(path, false), atime, mtime);
|
|
2426
|
+
await swapped(async () => this.setTimes(await this.locate(path, false), atime, mtime));
|
|
2403
2427
|
}
|
|
2404
2428
|
async setTimes(found, atime, mtime) {
|
|
2405
2429
|
this.refuse(found.path);
|
|
@@ -6632,7 +6656,7 @@ function satisfies(version, range2) {
|
|
|
6632
6656
|
}
|
|
6633
6657
|
|
|
6634
6658
|
// src/version.ts
|
|
6635
|
-
var KERNEL_VERSION = true ? "1.125.
|
|
6659
|
+
var KERNEL_VERSION = true ? "1.125.10" : "0.0.0-dev";
|
|
6636
6660
|
var OS_RELEASE = "6.0.0-slicc";
|
|
6637
6661
|
function procVersion() {
|
|
6638
6662
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|