@ai-ecoverse/slicc-kernel 1.124.8 → 1.124.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 +18 -0
- package/dist/kernel-worker.js +2 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +87 -15
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +2 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +87 -15
- package/dist/process-worker.js.map +3 -3
- package/dist/types/kernel/host.d.ts +3 -2
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-procfs.d.ts +1 -0
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -2624,7 +2624,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2624
2624
|
var init_version = __esm({
|
|
2625
2625
|
"src/version.ts"() {
|
|
2626
2626
|
"use strict";
|
|
2627
|
-
KERNEL_VERSION = true ? "1.124.
|
|
2627
|
+
KERNEL_VERSION = true ? "1.124.10" : "0.0.0-dev";
|
|
2628
2628
|
OS_RELEASE = "6.0.0-slicc";
|
|
2629
2629
|
}
|
|
2630
2630
|
});
|
|
@@ -6589,7 +6589,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6589
6589
|
const { stats, lstats } = cache;
|
|
6590
6590
|
const view = bridge.changes;
|
|
6591
6591
|
const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
6592
|
-
const
|
|
6592
|
+
const seen = new SeenAt(view, lstats);
|
|
6593
6593
|
const gone = (path) => {
|
|
6594
6594
|
for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
|
|
6595
6595
|
const up = path.slice(0, at);
|
|
@@ -6605,13 +6605,14 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6605
6605
|
if (blind || view?.foreign()) return get();
|
|
6606
6606
|
cache.fresh();
|
|
6607
6607
|
let hit = map.get(path);
|
|
6608
|
+
if (hit !== void 0 && !("until" in hit) && seen.changed(map, path)) hit = void 0;
|
|
6608
6609
|
if (hit === void 0 || "until" in hit && !live(hit, path)) {
|
|
6609
6610
|
const missing2 = gone(path);
|
|
6610
6611
|
if (missing2) throw missing2.error;
|
|
6611
6612
|
const gen = view?.now();
|
|
6612
6613
|
try {
|
|
6613
6614
|
hit = get();
|
|
6614
|
-
if (gen !== void 0
|
|
6615
|
+
if (gen !== void 0) seen.saw(map, path, gen);
|
|
6615
6616
|
} catch (e) {
|
|
6616
6617
|
hit = {
|
|
6617
6618
|
error: e,
|
|
@@ -6664,18 +6665,23 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6664
6665
|
readFile: (p) => bridge.readFile(p),
|
|
6665
6666
|
readdir: (p) => bridge.readdir(p),
|
|
6666
6667
|
readdirStat: (p) => {
|
|
6668
|
+
const gen = view?.now();
|
|
6667
6669
|
const list = bridge.readdirStat(p);
|
|
6668
6670
|
const base = p === "/" ? "" : p;
|
|
6669
6671
|
for (const [name2, st] of list) {
|
|
6670
6672
|
if (!st || blind) continue;
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
+
const at = `${base}/${name2}`;
|
|
6674
|
+
cache.put(lstats, at, st);
|
|
6675
|
+
if (gen !== void 0) seen.saw(lstats, at, gen);
|
|
6676
|
+
if (st.isSymbolicLink) continue;
|
|
6677
|
+
cache.put(stats, at, st);
|
|
6678
|
+
if (gen !== void 0) seen.saw(stats, at, gen);
|
|
6673
6679
|
}
|
|
6674
6680
|
return list;
|
|
6675
6681
|
},
|
|
6676
6682
|
readlink: (p) => {
|
|
6677
6683
|
const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
|
|
6678
|
-
const gen =
|
|
6684
|
+
const gen = seen.lstat(p);
|
|
6679
6685
|
const current = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
|
|
6680
6686
|
if (known && current && !("until" in known) && !known.isSymbolicLink) {
|
|
6681
6687
|
throw syncError("EINVAL", `'${p}' is not a symbolic link`);
|
|
@@ -6746,7 +6752,7 @@ function pinnedIo2(bridge, handle, rewriting) {
|
|
|
6746
6752
|
} : {}
|
|
6747
6753
|
};
|
|
6748
6754
|
}
|
|
6749
|
-
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache;
|
|
6755
|
+
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt;
|
|
6750
6756
|
var init_wasi_files = __esm({
|
|
6751
6757
|
"src/process/wasi/wasi-files.ts"() {
|
|
6752
6758
|
"use strict";
|
|
@@ -7105,6 +7111,37 @@ var init_wasi_files = __esm({
|
|
|
7105
7111
|
this.byIno.clear();
|
|
7106
7112
|
}
|
|
7107
7113
|
};
|
|
7114
|
+
SEEN_CAP = 4096;
|
|
7115
|
+
SeenAt = class {
|
|
7116
|
+
view;
|
|
7117
|
+
lstats;
|
|
7118
|
+
links = /* @__PURE__ */ new Map();
|
|
7119
|
+
stats = /* @__PURE__ */ new Map();
|
|
7120
|
+
constructor(view, lstats) {
|
|
7121
|
+
this.view = view;
|
|
7122
|
+
this.lstats = lstats;
|
|
7123
|
+
}
|
|
7124
|
+
of(map) {
|
|
7125
|
+
return map === this.lstats ? this.links : this.stats;
|
|
7126
|
+
}
|
|
7127
|
+
lstat(path) {
|
|
7128
|
+
return this.links.get(path);
|
|
7129
|
+
}
|
|
7130
|
+
saw(map, path, gen) {
|
|
7131
|
+
const seen = this.of(map);
|
|
7132
|
+
if (seen.size >= SEEN_CAP) seen.clear();
|
|
7133
|
+
seen.set(path, gen);
|
|
7134
|
+
}
|
|
7135
|
+
changed(map, path) {
|
|
7136
|
+
if (this.view === void 0) return false;
|
|
7137
|
+
const seen = this.of(map);
|
|
7138
|
+
const gen = seen.get(path);
|
|
7139
|
+
if (gen === void 0) return true;
|
|
7140
|
+
const since = this.view.changedSince(gen, path);
|
|
7141
|
+
if (!since.changed) seen.set(path, since.now);
|
|
7142
|
+
return since.changed;
|
|
7143
|
+
}
|
|
7144
|
+
};
|
|
7108
7145
|
}
|
|
7109
7146
|
});
|
|
7110
7147
|
|
|
@@ -7983,6 +8020,9 @@ var init_wasi_fds = __esm({
|
|
|
7983
8020
|
const alias = stdioAlias(path);
|
|
7984
8021
|
if (alias !== void 0) return this.reopen(alias);
|
|
7985
8022
|
const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
|
|
8023
|
+
if (exclusive && this.shared && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
8024
|
+
return this.kernelFile(path, void 0, oflags, rights, fdflags, mode, true);
|
|
8025
|
+
}
|
|
7986
8026
|
if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
|
|
7987
8027
|
const s = this.statOrMissing(path);
|
|
7988
8028
|
if (exclusive && s) throw new WasiError("EEXIST");
|
|
@@ -8082,11 +8122,11 @@ var init_wasi_fds = __esm({
|
|
|
8082
8122
|
if (id !== void 0) this.know(buffer, id);
|
|
8083
8123
|
return buffer;
|
|
8084
8124
|
}
|
|
8085
|
-
kernelFile(path, existing, oflags, rights, fdflags, mode) {
|
|
8125
|
+
kernelFile(path, existing, oflags, rights, fdflags, mode, created = false) {
|
|
8086
8126
|
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
8087
8127
|
const append = (fdflags & FDFLAGS.APPEND) !== 0;
|
|
8088
8128
|
const flags = (writable2 ? readable3 ? O_RDWR4 : O_WRONLY4 : 0) | (append ? O_APPEND2 : 0);
|
|
8089
|
-
const made = !existing && this.createNew(path, oflags, mode);
|
|
8129
|
+
const made = created || !existing && this.createNew(path, oflags, mode);
|
|
8090
8130
|
const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
8091
8131
|
const fd = this.kernel.sys.openVfs(path, flags, 0, {
|
|
8092
8132
|
...truncate ? { truncate } : {},
|
|
@@ -8121,6 +8161,16 @@ var init_wasi_fds = __esm({
|
|
|
8121
8161
|
}
|
|
8122
8162
|
}
|
|
8123
8163
|
}
|
|
8164
|
+
madeAtOnce(path, mode) {
|
|
8165
|
+
if (!this.fs.create) return false;
|
|
8166
|
+
try {
|
|
8167
|
+
this.fs.create(path, mode, true);
|
|
8168
|
+
return true;
|
|
8169
|
+
} catch (err) {
|
|
8170
|
+
if (err.code === "EEXIST") throw err;
|
|
8171
|
+
return false;
|
|
8172
|
+
}
|
|
8173
|
+
}
|
|
8124
8174
|
createNew(path, oflags, mode) {
|
|
8125
8175
|
if (!this.fs.create) {
|
|
8126
8176
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
@@ -10879,15 +10929,37 @@ function frozen(bytes) {
|
|
|
10879
10929
|
truncate: refuse2
|
|
10880
10930
|
};
|
|
10881
10931
|
}
|
|
10882
|
-
function
|
|
10883
|
-
const
|
|
10884
|
-
|
|
10932
|
+
function physicalProc(fs) {
|
|
10933
|
+
const view = fs.changes;
|
|
10934
|
+
let seen;
|
|
10935
|
+
return () => {
|
|
10936
|
+
if (seen && view && !view.foreign()) {
|
|
10937
|
+
const proc = view.changedSince(seen.gen, "/proc");
|
|
10938
|
+
if (!proc.changed && !view.changedSince(seen.gen, "/").changed) {
|
|
10939
|
+
seen.gen = proc.now;
|
|
10940
|
+
return seen.physical;
|
|
10941
|
+
}
|
|
10942
|
+
}
|
|
10943
|
+
const gen = view?.now();
|
|
10944
|
+
let physical2;
|
|
10885
10945
|
try {
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10946
|
+
fs.stat("/proc");
|
|
10947
|
+
physical2 = true;
|
|
10948
|
+
} catch (err) {
|
|
10949
|
+
const code2 = err.code;
|
|
10950
|
+
if (code2 !== "ENOENT" && code2 !== "ENOTDIR") {
|
|
10951
|
+
seen = void 0;
|
|
10952
|
+
return false;
|
|
10953
|
+
}
|
|
10954
|
+
physical2 = false;
|
|
10889
10955
|
}
|
|
10956
|
+
seen = gen === void 0 ? void 0 : { gen, physical: physical2 };
|
|
10957
|
+
return physical2;
|
|
10890
10958
|
};
|
|
10959
|
+
}
|
|
10960
|
+
function procfsBridge(fs, tree) {
|
|
10961
|
+
const toProc = (path, follow2) => procPath(fs, path, follow2);
|
|
10962
|
+
const shadowing = physicalProc(fs);
|
|
10891
10963
|
const via = (p, proc, own, follow2 = true) => {
|
|
10892
10964
|
if (inProc(p)) return proc(p);
|
|
10893
10965
|
if (shadowing()) {
|