@ai-ecoverse/slicc-kernel 1.116.1 → 1.116.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.
- package/README.md +1 -0
- package/dist/kernel-worker.js +20 -3
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +2 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +20 -3
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +2 -1
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -589,6 +589,7 @@ Directories are renamed with `FileSystemHandle.move()` where available, else by
|
|
|
589
589
|
- **The node's identity, not its name, picks the FIFO:** an open FIFO keeps working after an `unlink` or a `rename`, and a new `mkfifo` at the same name is another FIFO. `/proc/<pid>/fd/N` names the FIFO's path, also in children that inherit the end.
|
|
590
590
|
- **One kernel per storage root:** the table of open FIFOs is per kernel, so two tabs (two kernels on one origin) opening the same FIFO don't connect, as with record locks ([#675](https://github.com/ai-ecoverse/slicc-kernel/issues/675)).
|
|
591
591
|
- GNU make 4.4's `-jN` uses a FIFO jobserver this way (`--jobserver-auth=fifo:PATH`), so sub-makes join it by path.
|
|
592
|
+
- **Below an open** ([#908](https://github.com/ai-ecoverse/slicc-kernel/issues/908)): a FIFO or socket node is never read or written as a plain file. A JS program's `ctx.fs.readFile`/`writeFile` and the kernel API's `readFile`/`writeFile` (and the positioned reads, writes and truncates under them) fail with `ENXIO` on either, because they read or write a whole file rather than open one. Emscripten and WASI programs' opens of a FIFO go through the kernel's FIFO open as above, and a WASI program's open of a socket node is `ENXIO`, as on Linux.
|
|
592
593
|
|
|
593
594
|
`mmap` of a regular file works on every file system, for Emscripten programs built with `mmap` (whose glue exports `emscripten_builtin_memalign`) as well as for WASIX ones: the kernel reads the mapped range into fresh memory of the process, as Emscripten's MEMFS does. A `MAP_PRIVATE` mapping may be written, and its changes stay in the process. A writable `MAP_SHARED` mapping of such a file is `ENODEV`; a file in the process's own in-memory file system (MEMFS, as under `/dev`) keeps Emscripten's own mapping, which writes back. A read-only `MAP_SHARED` mapping is a copy taken at `mmap`, so later changes to the file do not show in it.
|
|
594
595
|
|
package/dist/kernel-worker.js
CHANGED
|
@@ -1699,13 +1699,20 @@ var OpfsFs = class {
|
|
|
1699
1699
|
if (handle.kind === "directory") throw fsError("EISDIR", path);
|
|
1700
1700
|
return handle;
|
|
1701
1701
|
}
|
|
1702
|
+
async refuseNode(path, empty) {
|
|
1703
|
+
if (!empty) return;
|
|
1704
|
+
const [entry] = await this.meta.get([(await this.locate(path, true)).path]);
|
|
1705
|
+
if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
|
|
1706
|
+
}
|
|
1702
1707
|
async readFileBuffer(path) {
|
|
1703
1708
|
const handle = await this.existing(path);
|
|
1704
|
-
|
|
1709
|
+
const bytes = await this.retrying(
|
|
1705
1710
|
path,
|
|
1706
1711
|
async () => new Uint8Array(await (await handle.getFile()).arrayBuffer()),
|
|
1707
1712
|
false
|
|
1708
1713
|
);
|
|
1714
|
+
await this.refuseNode(path, bytes.length === 0);
|
|
1715
|
+
return bytes;
|
|
1709
1716
|
}
|
|
1710
1717
|
async readVersioned(path, cached = false) {
|
|
1711
1718
|
const handle = await this.existing(path);
|
|
@@ -1715,6 +1722,7 @@ var OpfsFs = class {
|
|
|
1715
1722
|
const stamp = await this.stamp(path, cached);
|
|
1716
1723
|
const file = await handle.getFile();
|
|
1717
1724
|
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
1725
|
+
await this.refuseNode(path, bytes.length === 0);
|
|
1718
1726
|
return { bytes, version: `${file.lastModified}:${file.size}:${stamp}` };
|
|
1719
1727
|
},
|
|
1720
1728
|
false
|
|
@@ -1736,7 +1744,11 @@ var OpfsFs = class {
|
|
|
1736
1744
|
const handle = await this.existing(path);
|
|
1737
1745
|
return this.retrying(
|
|
1738
1746
|
path,
|
|
1739
|
-
async () =>
|
|
1747
|
+
async () => {
|
|
1748
|
+
const file = await handle.getFile();
|
|
1749
|
+
await this.refuseNode(path, file.size === 0);
|
|
1750
|
+
return new Uint8Array(await file.slice(offset, offset + length2).arrayBuffer());
|
|
1751
|
+
},
|
|
1740
1752
|
false
|
|
1741
1753
|
);
|
|
1742
1754
|
}
|
|
@@ -1752,6 +1764,7 @@ var OpfsFs = class {
|
|
|
1752
1764
|
}
|
|
1753
1765
|
async truncate(path, size) {
|
|
1754
1766
|
const handle = await this.existing(path, true);
|
|
1767
|
+
await this.refuseNode(path, (await handle.getFile()).size === 0);
|
|
1755
1768
|
const resolve2 = this.ranged || this.remote?.watched();
|
|
1756
1769
|
const target = resolve2 || this.counted.length > 0 ? (await this.locate(path, true)).path : path;
|
|
1757
1770
|
await this.counting(target);
|
|
@@ -1804,6 +1817,10 @@ var OpfsFs = class {
|
|
|
1804
1817
|
}
|
|
1805
1818
|
async fileFor(path) {
|
|
1806
1819
|
const [target, existed] = await this.writeTarget(path);
|
|
1820
|
+
if (existed) {
|
|
1821
|
+
const [entry] = await this.meta.get([target]);
|
|
1822
|
+
if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
|
|
1823
|
+
}
|
|
1807
1824
|
const [dir, name2] = await this.parent(target);
|
|
1808
1825
|
try {
|
|
1809
1826
|
const handle = await this.inDir(
|
|
@@ -6241,7 +6258,7 @@ function satisfies(version, range2) {
|
|
|
6241
6258
|
}
|
|
6242
6259
|
|
|
6243
6260
|
// src/version.ts
|
|
6244
|
-
var KERNEL_VERSION = true ? "1.116.
|
|
6261
|
+
var KERNEL_VERSION = true ? "1.116.2" : "0.0.0-dev";
|
|
6245
6262
|
var OS_RELEASE = "6.0.0-slicc";
|
|
6246
6263
|
function procVersion() {
|
|
6247
6264
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|