@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
|
@@ -740,7 +740,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
740
740
|
const { stats, lstats } = cache;
|
|
741
741
|
const view = bridge.changes;
|
|
742
742
|
const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
743
|
-
const
|
|
743
|
+
const seen = new SeenAt(view, lstats);
|
|
744
744
|
const gone = (path) => {
|
|
745
745
|
for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
|
|
746
746
|
const up = path.slice(0, at);
|
|
@@ -756,13 +756,14 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
756
756
|
if (blind || view?.foreign()) return get();
|
|
757
757
|
cache.fresh();
|
|
758
758
|
let hit = map.get(path);
|
|
759
|
+
if (hit !== void 0 && !("until" in hit) && seen.changed(map, path)) hit = void 0;
|
|
759
760
|
if (hit === void 0 || "until" in hit && !live(hit, path)) {
|
|
760
761
|
const missing2 = gone(path);
|
|
761
762
|
if (missing2) throw missing2.error;
|
|
762
763
|
const gen = view?.now();
|
|
763
764
|
try {
|
|
764
765
|
hit = get();
|
|
765
|
-
if (gen !== void 0
|
|
766
|
+
if (gen !== void 0) seen.saw(map, path, gen);
|
|
766
767
|
} catch (e) {
|
|
767
768
|
hit = {
|
|
768
769
|
error: e,
|
|
@@ -815,18 +816,23 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
815
816
|
readFile: (p) => bridge.readFile(p),
|
|
816
817
|
readdir: (p) => bridge.readdir(p),
|
|
817
818
|
readdirStat: (p) => {
|
|
819
|
+
const gen = view?.now();
|
|
818
820
|
const list = bridge.readdirStat(p);
|
|
819
821
|
const base = p === "/" ? "" : p;
|
|
820
822
|
for (const [name2, st] of list) {
|
|
821
823
|
if (!st || blind) continue;
|
|
822
|
-
|
|
823
|
-
|
|
824
|
+
const at = `${base}/${name2}`;
|
|
825
|
+
cache.put(lstats, at, st);
|
|
826
|
+
if (gen !== void 0) seen.saw(lstats, at, gen);
|
|
827
|
+
if (st.isSymbolicLink) continue;
|
|
828
|
+
cache.put(stats, at, st);
|
|
829
|
+
if (gen !== void 0) seen.saw(stats, at, gen);
|
|
824
830
|
}
|
|
825
831
|
return list;
|
|
826
832
|
},
|
|
827
833
|
readlink: (p) => {
|
|
828
834
|
const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
|
|
829
|
-
const gen =
|
|
835
|
+
const gen = seen.lstat(p);
|
|
830
836
|
const current = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
|
|
831
837
|
if (known && current && !("until" in known) && !known.isSymbolicLink) {
|
|
832
838
|
throw syncError("EINVAL", `'${p}' is not a symbolic link`);
|
|
@@ -897,7 +903,7 @@ function pinnedIo(bridge, handle, rewriting) {
|
|
|
897
903
|
} : {}
|
|
898
904
|
};
|
|
899
905
|
}
|
|
900
|
-
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING, RING_SIZE, SLOT, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache;
|
|
906
|
+
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, RING, RING_SIZE, SLOT, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt;
|
|
901
907
|
var init_wasi_files = __esm({
|
|
902
908
|
"src/process/wasi/wasi-files.ts"() {
|
|
903
909
|
"use strict";
|
|
@@ -1256,6 +1262,37 @@ var init_wasi_files = __esm({
|
|
|
1256
1262
|
this.byIno.clear();
|
|
1257
1263
|
}
|
|
1258
1264
|
};
|
|
1265
|
+
SEEN_CAP = 4096;
|
|
1266
|
+
SeenAt = class {
|
|
1267
|
+
view;
|
|
1268
|
+
lstats;
|
|
1269
|
+
links = /* @__PURE__ */ new Map();
|
|
1270
|
+
stats = /* @__PURE__ */ new Map();
|
|
1271
|
+
constructor(view, lstats) {
|
|
1272
|
+
this.view = view;
|
|
1273
|
+
this.lstats = lstats;
|
|
1274
|
+
}
|
|
1275
|
+
of(map) {
|
|
1276
|
+
return map === this.lstats ? this.links : this.stats;
|
|
1277
|
+
}
|
|
1278
|
+
lstat(path) {
|
|
1279
|
+
return this.links.get(path);
|
|
1280
|
+
}
|
|
1281
|
+
saw(map, path, gen) {
|
|
1282
|
+
const seen = this.of(map);
|
|
1283
|
+
if (seen.size >= SEEN_CAP) seen.clear();
|
|
1284
|
+
seen.set(path, gen);
|
|
1285
|
+
}
|
|
1286
|
+
changed(map, path) {
|
|
1287
|
+
if (this.view === void 0) return false;
|
|
1288
|
+
const seen = this.of(map);
|
|
1289
|
+
const gen = seen.get(path);
|
|
1290
|
+
if (gen === void 0) return true;
|
|
1291
|
+
const since = this.view.changedSince(gen, path);
|
|
1292
|
+
if (!since.changed) seen.set(path, since.now);
|
|
1293
|
+
return since.changed;
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1259
1296
|
}
|
|
1260
1297
|
});
|
|
1261
1298
|
|
|
@@ -2588,6 +2625,9 @@ var init_wasi_fds = __esm({
|
|
|
2588
2625
|
const alias = stdioAlias(path);
|
|
2589
2626
|
if (alias !== void 0) return this.reopen(alias);
|
|
2590
2627
|
const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
|
|
2628
|
+
if (exclusive && this.shared && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
2629
|
+
return this.kernelFile(path, void 0, oflags, rights, fdflags, mode, true);
|
|
2630
|
+
}
|
|
2591
2631
|
if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
|
|
2592
2632
|
const s = this.statOrMissing(path);
|
|
2593
2633
|
if (exclusive && s) throw new WasiError("EEXIST");
|
|
@@ -2687,11 +2727,11 @@ var init_wasi_fds = __esm({
|
|
|
2687
2727
|
if (id !== void 0) this.know(buffer, id);
|
|
2688
2728
|
return buffer;
|
|
2689
2729
|
}
|
|
2690
|
-
kernelFile(path, existing, oflags, rights, fdflags, mode) {
|
|
2730
|
+
kernelFile(path, existing, oflags, rights, fdflags, mode, created = false) {
|
|
2691
2731
|
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
2692
2732
|
const append = (fdflags & FDFLAGS.APPEND) !== 0;
|
|
2693
2733
|
const flags = (writable2 ? readable3 ? O_RDWR : O_WRONLY : 0) | (append ? O_APPEND : 0);
|
|
2694
|
-
const made = !existing && this.createNew(path, oflags, mode);
|
|
2734
|
+
const made = created || !existing && this.createNew(path, oflags, mode);
|
|
2695
2735
|
const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
2696
2736
|
const fd = this.kernel.sys.openVfs(path, flags, 0, {
|
|
2697
2737
|
...truncate ? { truncate } : {},
|
|
@@ -2726,6 +2766,16 @@ var init_wasi_fds = __esm({
|
|
|
2726
2766
|
}
|
|
2727
2767
|
}
|
|
2728
2768
|
}
|
|
2769
|
+
madeAtOnce(path, mode) {
|
|
2770
|
+
if (!this.fs.create) return false;
|
|
2771
|
+
try {
|
|
2772
|
+
this.fs.create(path, mode, true);
|
|
2773
|
+
return true;
|
|
2774
|
+
} catch (err) {
|
|
2775
|
+
if (err.code === "EEXIST") throw err;
|
|
2776
|
+
return false;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2729
2779
|
createNew(path, oflags, mode) {
|
|
2730
2780
|
if (!this.fs.create) {
|
|
2731
2781
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
@@ -5438,7 +5488,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
5438
5488
|
var init_version = __esm({
|
|
5439
5489
|
"src/version.ts"() {
|
|
5440
5490
|
"use strict";
|
|
5441
|
-
KERNEL_VERSION = true ? "1.124.
|
|
5491
|
+
KERNEL_VERSION = true ? "1.124.10" : "0.0.0-dev";
|
|
5442
5492
|
OS_RELEASE = "6.0.0-slicc";
|
|
5443
5493
|
}
|
|
5444
5494
|
});
|
|
@@ -10293,15 +10343,37 @@ function frozen(bytes) {
|
|
|
10293
10343
|
truncate: refuse2
|
|
10294
10344
|
};
|
|
10295
10345
|
}
|
|
10296
|
-
function
|
|
10297
|
-
const
|
|
10298
|
-
|
|
10346
|
+
function physicalProc(fs) {
|
|
10347
|
+
const view = fs.changes;
|
|
10348
|
+
let seen;
|
|
10349
|
+
return () => {
|
|
10350
|
+
if (seen && view && !view.foreign()) {
|
|
10351
|
+
const proc = view.changedSince(seen.gen, "/proc");
|
|
10352
|
+
if (!proc.changed && !view.changedSince(seen.gen, "/").changed) {
|
|
10353
|
+
seen.gen = proc.now;
|
|
10354
|
+
return seen.physical;
|
|
10355
|
+
}
|
|
10356
|
+
}
|
|
10357
|
+
const gen = view?.now();
|
|
10358
|
+
let physical2;
|
|
10299
10359
|
try {
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10360
|
+
fs.stat("/proc");
|
|
10361
|
+
physical2 = true;
|
|
10362
|
+
} catch (err) {
|
|
10363
|
+
const code2 = err.code;
|
|
10364
|
+
if (code2 !== "ENOENT" && code2 !== "ENOTDIR") {
|
|
10365
|
+
seen = void 0;
|
|
10366
|
+
return false;
|
|
10367
|
+
}
|
|
10368
|
+
physical2 = false;
|
|
10303
10369
|
}
|
|
10370
|
+
seen = gen === void 0 ? void 0 : { gen, physical: physical2 };
|
|
10371
|
+
return physical2;
|
|
10304
10372
|
};
|
|
10373
|
+
}
|
|
10374
|
+
function procfsBridge(fs, tree) {
|
|
10375
|
+
const toProc = (path, follow2) => procPath(fs, path, follow2);
|
|
10376
|
+
const shadowing = physicalProc(fs);
|
|
10305
10377
|
const via = (p, proc, own, follow2 = true) => {
|
|
10306
10378
|
if (inProc(p)) return proc(p);
|
|
10307
10379
|
if (shadowing()) {
|