@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.
- package/README.md +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +15 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +62 -8
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +18 -4
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +62 -8
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -2
|
@@ -621,6 +621,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
621
621
|
lutimes: (p, a, m) => mutating(() => bridge.lutimes(p, a, m), p),
|
|
622
622
|
...bridge.hold ? { hold: bridge.hold.bind(bridge) } : {},
|
|
623
623
|
...bridge.kept ? { kept: bridge.kept.bind(bridge) } : {},
|
|
624
|
+
...bridge.keptStat ? { keptStat: bridge.keptStat.bind(bridge) } : {},
|
|
624
625
|
...bridge.pinned ? { pinned: (handle) => pinnedIo(bridge, handle, rewriting) } : {},
|
|
625
626
|
...bridge.create ? { create: (p) => mutating(() => bridge.create?.(p), ...entry(p)) } : {},
|
|
626
627
|
...chown ? {
|
|
@@ -1702,9 +1703,34 @@ var init_wasi_fds = __esm({
|
|
|
1702
1703
|
}
|
|
1703
1704
|
if (!s && !(oflags & OFLAGS.CREAT)) throw new WasiError("ENOENT");
|
|
1704
1705
|
refuseWrite(s, oflags, rights);
|
|
1705
|
-
|
|
1706
|
+
return this.regular(path, s, oflags, rights, fdflags);
|
|
1707
|
+
}
|
|
1708
|
+
regular(path, s, oflags, rights, fdflags) {
|
|
1709
|
+
if (this.shared || this.kernelHolds(path, s)) {
|
|
1710
|
+
return this.kernelFile(path, s, oflags, rights, fdflags);
|
|
1711
|
+
}
|
|
1706
1712
|
return this.install({ type: "file", file: this.file(path, s, oflags, rights, fdflags) });
|
|
1707
1713
|
}
|
|
1714
|
+
kernelHolds(path, st) {
|
|
1715
|
+
for (const [fd, e] of this.table) {
|
|
1716
|
+
if (e.type !== "kernel" || this.kind(fd, e) !== "file") continue;
|
|
1717
|
+
this.named(fd, e);
|
|
1718
|
+
if (e.path === path || st?.ino !== void 0 && e.ino === st.ino) return true;
|
|
1719
|
+
}
|
|
1720
|
+
return false;
|
|
1721
|
+
}
|
|
1722
|
+
learned = /* @__PURE__ */ new WeakSet();
|
|
1723
|
+
named(fd, e) {
|
|
1724
|
+
if (e.path !== void 0 || this.learned.has(e)) return;
|
|
1725
|
+
this.learned.add(e);
|
|
1726
|
+
try {
|
|
1727
|
+
const vfs = this.kernel.call({ op: "fd-vfs-stat", fd });
|
|
1728
|
+
if (vfs.orphan || vfs.path === void 0) return;
|
|
1729
|
+
e.path = vfs.path;
|
|
1730
|
+
e.ino = this.inoOf(vfs.path);
|
|
1731
|
+
} catch {
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1708
1734
|
file(path, existing, oflags, rights, fdflags) {
|
|
1709
1735
|
const { readable: readable2, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
1710
1736
|
let buffer = this.buffers.get(path);
|
|
@@ -2746,16 +2772,41 @@ var init_wasi_host = __esm({
|
|
|
2746
2772
|
fdFilestat(fd) {
|
|
2747
2773
|
const e = this.fds.get(fd);
|
|
2748
2774
|
if (e.type === "dir") return filestatOf(e.path, this.o.fs.stat(e.path));
|
|
2749
|
-
if (e.type === "file") return this.
|
|
2775
|
+
if (e.type === "file") return this.localFilestat(e.file);
|
|
2750
2776
|
const kind = e.type === "kernel" ? this.fds.kind(fd, e) : void 0;
|
|
2751
2777
|
if (kind === "file") {
|
|
2752
2778
|
const vfs = this.kernelStat(fd);
|
|
2753
|
-
if (vfs.path) return this.statOrphanable(vfs.path, vfs.size, vfs.orphan);
|
|
2779
|
+
if (vfs.path) return this.statOrphanable(vfs.path, vfs.size, vfs.orphan, vfs.orphan);
|
|
2754
2780
|
}
|
|
2755
2781
|
const filetype = kind ? kernelFiletype(kind).filetype : FILETYPE.CHARACTER_DEVICE;
|
|
2756
2782
|
return this.local({ filetype, size: 0n, ino: BigInt(fd + 1), mtimeNs: 0n });
|
|
2757
2783
|
}
|
|
2758
|
-
|
|
2784
|
+
localFilestat(file) {
|
|
2785
|
+
const { buffer } = file;
|
|
2786
|
+
if (buffer.isOrphan()) return this.statOrphanable(file.path, file.size(), false, true);
|
|
2787
|
+
let s;
|
|
2788
|
+
try {
|
|
2789
|
+
s = this.o.fs.stat(file.path);
|
|
2790
|
+
} catch {
|
|
2791
|
+
s = this.keptStat(buffer.handle);
|
|
2792
|
+
}
|
|
2793
|
+
return this.sized(file.path, s, file.size());
|
|
2794
|
+
}
|
|
2795
|
+
keptStat(handle) {
|
|
2796
|
+
if (handle === void 0) return void 0;
|
|
2797
|
+
try {
|
|
2798
|
+
return this.o.fs.keptStat?.(handle);
|
|
2799
|
+
} catch {
|
|
2800
|
+
return void 0;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
sized(path, s, size) {
|
|
2804
|
+
return {
|
|
2805
|
+
...filestatOf(path, s ?? { isFile: true, isDirectory: false, size: 0 }),
|
|
2806
|
+
size: BigInt(size)
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
statOrphanable(path, size, orphan = false, gone = false) {
|
|
2759
2810
|
let s;
|
|
2760
2811
|
if (!orphan) {
|
|
2761
2812
|
try {
|
|
@@ -2763,10 +2814,8 @@ var init_wasi_host = __esm({
|
|
|
2763
2814
|
} catch {
|
|
2764
2815
|
}
|
|
2765
2816
|
}
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
size: BigInt(size)
|
|
2769
|
-
};
|
|
2817
|
+
const out = this.sized(path, s, size);
|
|
2818
|
+
return gone ? { ...out, nlink: 0n } : out;
|
|
2770
2819
|
}
|
|
2771
2820
|
pathFilestat(path, lookup) {
|
|
2772
2821
|
if (deviceOf(path)) {
|
|
@@ -4503,6 +4552,11 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
4503
4552
|
...io({}),
|
|
4504
4553
|
pinned: (handle) => io({ handle }),
|
|
4505
4554
|
kept: (handle) => json({ op: "kept", path: "/", handle }, "/") === true,
|
|
4555
|
+
keptStat: (handle) => {
|
|
4556
|
+
const s = parseSyncFsStat(json({ op: "stat", path: "/", handle }, "/"));
|
|
4557
|
+
if (!s) throw errnoError("EIO", "/");
|
|
4558
|
+
return s;
|
|
4559
|
+
},
|
|
4506
4560
|
stat: (path) => {
|
|
4507
4561
|
const s = parseSyncFsStat(json({ op: "stat", path }, path));
|
|
4508
4562
|
if (!s) throw errnoError("EIO", path);
|