@ai-ecoverse/slicc-kernel 1.133.3 → 1.133.4
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 +72 -14
- package/dist/kernel-worker.js.map +2 -2
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +157 -128
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +72 -14
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +145 -116
- package/dist/process-worker.js.map +4 -4
- package/dist/types/fs/changes.d.ts +1 -0
- package/dist/types/fs/meta.d.ts +7 -0
- package/dist/types/fs/opfs.d.ts +3 -0
- package/dist/types/fs/remote.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +2 -1
- package/dist/types/realm/live-vfs-fs.d.ts +4 -0
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -458,6 +458,70 @@ var init_access = __esm({
|
|
|
458
458
|
}
|
|
459
459
|
});
|
|
460
460
|
|
|
461
|
+
// src/fs/changes.ts
|
|
462
|
+
function changeHash(path) {
|
|
463
|
+
let h = 2166136261;
|
|
464
|
+
for (let i = 0; i < path.length; i++) {
|
|
465
|
+
h ^= path.charCodeAt(i);
|
|
466
|
+
h = Math.imul(h, 16777619);
|
|
467
|
+
}
|
|
468
|
+
return h === 0 ? 1 : h;
|
|
469
|
+
}
|
|
470
|
+
function normal(path) {
|
|
471
|
+
const parts = [];
|
|
472
|
+
for (const part of path.split("/")) {
|
|
473
|
+
if (part === "" || part === ".") continue;
|
|
474
|
+
if (part === "..") parts.pop();
|
|
475
|
+
else parts.push(part);
|
|
476
|
+
}
|
|
477
|
+
return `/${parts.join("/")}`;
|
|
478
|
+
}
|
|
479
|
+
var GEN, RING, RING_SIZE, SLOT, SHARED_TTL_MS, DIRTY, FOREIGN, CHANGES_BYTES, ChangeView;
|
|
480
|
+
var init_changes = __esm({
|
|
481
|
+
"src/fs/changes.ts"() {
|
|
482
|
+
"use strict";
|
|
483
|
+
GEN = 0;
|
|
484
|
+
RING = 1;
|
|
485
|
+
RING_SIZE = 4096;
|
|
486
|
+
SLOT = 2;
|
|
487
|
+
SHARED_TTL_MS = 100;
|
|
488
|
+
DIRTY = RING + RING_SIZE * SLOT;
|
|
489
|
+
FOREIGN = DIRTY + 1;
|
|
490
|
+
CHANGES_BYTES = (FOREIGN + 1) * 4;
|
|
491
|
+
ChangeView = class {
|
|
492
|
+
view;
|
|
493
|
+
constructor(sab) {
|
|
494
|
+
this.view = new Int32Array(sab);
|
|
495
|
+
}
|
|
496
|
+
now() {
|
|
497
|
+
return Atomics.load(this.view, GEN);
|
|
498
|
+
}
|
|
499
|
+
clean() {
|
|
500
|
+
return this.view.length > DIRTY && Atomics.load(this.view, DIRTY) === 0;
|
|
501
|
+
}
|
|
502
|
+
foreign() {
|
|
503
|
+
return this.view.length > FOREIGN && Atomics.load(this.view, FOREIGN) === 1;
|
|
504
|
+
}
|
|
505
|
+
changedSince(seen, path) {
|
|
506
|
+
const now = Atomics.load(this.view, GEN);
|
|
507
|
+
const distance = now - seen >>> 0;
|
|
508
|
+
if (distance === 0) return { now, changed: false };
|
|
509
|
+
if (distance > RING_SIZE) return { now, changed: true };
|
|
510
|
+
const hash = changeHash(normal(path));
|
|
511
|
+
for (let i = 1; i <= distance; i++) {
|
|
512
|
+
const g = seen + i | 0;
|
|
513
|
+
const at = RING + (g & RING_SIZE - 1) * SLOT;
|
|
514
|
+
if (Atomics.load(this.view, at) !== g) return { now, changed: true };
|
|
515
|
+
const hit = Atomics.load(this.view, at + 1) === hash;
|
|
516
|
+
if (Atomics.load(this.view, at) !== g) return { now, changed: true };
|
|
517
|
+
if (hit) return { now, changed: true };
|
|
518
|
+
}
|
|
519
|
+
return { now, changed: false };
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
|
|
461
525
|
// src/fs/pages.ts
|
|
462
526
|
var PAGE, READAHEAD, CLEAN_LIMIT, WRITEBACK, RUN, Pages;
|
|
463
527
|
var init_pages = __esm({
|
|
@@ -1036,69 +1100,6 @@ var init_sync_fs_wire = __esm({
|
|
|
1036
1100
|
}
|
|
1037
1101
|
});
|
|
1038
1102
|
|
|
1039
|
-
// src/fs/changes.ts
|
|
1040
|
-
function changeHash(path) {
|
|
1041
|
-
let h = 2166136261;
|
|
1042
|
-
for (let i = 0; i < path.length; i++) {
|
|
1043
|
-
h ^= path.charCodeAt(i);
|
|
1044
|
-
h = Math.imul(h, 16777619);
|
|
1045
|
-
}
|
|
1046
|
-
return h === 0 ? 1 : h;
|
|
1047
|
-
}
|
|
1048
|
-
function normal(path) {
|
|
1049
|
-
const parts = [];
|
|
1050
|
-
for (const part of path.split("/")) {
|
|
1051
|
-
if (part === "" || part === ".") continue;
|
|
1052
|
-
if (part === "..") parts.pop();
|
|
1053
|
-
else parts.push(part);
|
|
1054
|
-
}
|
|
1055
|
-
return `/${parts.join("/")}`;
|
|
1056
|
-
}
|
|
1057
|
-
var GEN, RING, RING_SIZE, SLOT, DIRTY, FOREIGN, CHANGES_BYTES, ChangeView;
|
|
1058
|
-
var init_changes = __esm({
|
|
1059
|
-
"src/fs/changes.ts"() {
|
|
1060
|
-
"use strict";
|
|
1061
|
-
GEN = 0;
|
|
1062
|
-
RING = 1;
|
|
1063
|
-
RING_SIZE = 4096;
|
|
1064
|
-
SLOT = 2;
|
|
1065
|
-
DIRTY = RING + RING_SIZE * SLOT;
|
|
1066
|
-
FOREIGN = DIRTY + 1;
|
|
1067
|
-
CHANGES_BYTES = (FOREIGN + 1) * 4;
|
|
1068
|
-
ChangeView = class {
|
|
1069
|
-
view;
|
|
1070
|
-
constructor(sab) {
|
|
1071
|
-
this.view = new Int32Array(sab);
|
|
1072
|
-
}
|
|
1073
|
-
now() {
|
|
1074
|
-
return Atomics.load(this.view, GEN);
|
|
1075
|
-
}
|
|
1076
|
-
clean() {
|
|
1077
|
-
return this.view.length > DIRTY && Atomics.load(this.view, DIRTY) === 0;
|
|
1078
|
-
}
|
|
1079
|
-
foreign() {
|
|
1080
|
-
return this.view.length > FOREIGN && Atomics.load(this.view, FOREIGN) === 1;
|
|
1081
|
-
}
|
|
1082
|
-
changedSince(seen, path) {
|
|
1083
|
-
const now = Atomics.load(this.view, GEN);
|
|
1084
|
-
const distance = now - seen >>> 0;
|
|
1085
|
-
if (distance === 0) return { now, changed: false };
|
|
1086
|
-
if (distance > RING_SIZE) return { now, changed: true };
|
|
1087
|
-
const hash = changeHash(normal(path));
|
|
1088
|
-
for (let i = 1; i <= distance; i++) {
|
|
1089
|
-
const g = seen + i | 0;
|
|
1090
|
-
const at = RING + (g & RING_SIZE - 1) * SLOT;
|
|
1091
|
-
if (Atomics.load(this.view, at) !== g) return { now, changed: true };
|
|
1092
|
-
const hit = Atomics.load(this.view, at + 1) === hash;
|
|
1093
|
-
if (Atomics.load(this.view, at) !== g) return { now, changed: true };
|
|
1094
|
-
if (hit) return { now, changed: true };
|
|
1095
|
-
}
|
|
1096
|
-
return { now, changed: false };
|
|
1097
|
-
}
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
1103
|
// src/realm/sync-sab-bridge.ts
|
|
1103
1104
|
function syncCallCount() {
|
|
1104
1105
|
return calls;
|
|
@@ -1469,8 +1470,16 @@ function refusal(err) {
|
|
|
1469
1470
|
const code2 = err?.code;
|
|
1470
1471
|
return code2 === "EACCES" || code2 === "EPERM";
|
|
1471
1472
|
}
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1473
|
+
function young(s) {
|
|
1474
|
+
return performance.now() - (s.filledAt ?? Number.NEGATIVE_INFINITY) < SHARED_TTL_MS;
|
|
1475
|
+
}
|
|
1476
|
+
function cachedStat(node, dir, view) {
|
|
1477
|
+
const s = node.live;
|
|
1478
|
+
if (view?.foreign() && !s.dirty) {
|
|
1479
|
+
const gen = s.statGen ?? s.named;
|
|
1480
|
+
if (s.openCount > 0 || !young(s) || gen === void 0) return false;
|
|
1481
|
+
if (view.changedSince(gen, liveNodePath(node)).changed) return false;
|
|
1482
|
+
}
|
|
1474
1483
|
return s.stat !== void 0 && (!dir || s.statAt === syncCallCount());
|
|
1475
1484
|
}
|
|
1476
1485
|
function searchParents(Fs, node, bridge, call2) {
|
|
@@ -1536,9 +1545,22 @@ function linkedStates(bridgeOf) {
|
|
|
1536
1545
|
const holder = (node) => opens.get(node.live) ?? node;
|
|
1537
1546
|
return { opening: opening2, sharedWith, know, idOf: idOf4, holder };
|
|
1538
1547
|
}
|
|
1548
|
+
function filled(s, stat, asked) {
|
|
1549
|
+
Object.assign(s, { stat, statAt: syncCallCount(), seenAt: syncEpoch(), ...asked });
|
|
1550
|
+
}
|
|
1551
|
+
function asking(bridge) {
|
|
1552
|
+
return { filledAt: performance.now(), statGen: bridge.changes?.now() };
|
|
1553
|
+
}
|
|
1554
|
+
function listing(s) {
|
|
1555
|
+
return { filledAt: s.listedAt ?? Number.NEGATIVE_INFINITY, statGen: s.listedGen };
|
|
1556
|
+
}
|
|
1557
|
+
function answeredAt(node, asked) {
|
|
1558
|
+
Object.assign(node.live, asked);
|
|
1559
|
+
return node;
|
|
1560
|
+
}
|
|
1539
1561
|
function freshState(stat) {
|
|
1540
1562
|
const base = { len: 0, loaded: false, dirty: false, openCount: 0 };
|
|
1541
|
-
return stat ? { stat, statAt: syncCallCount(), seenAt: syncEpoch(), ...base } : base;
|
|
1563
|
+
return stat ? { stat, statAt: syncCallCount(), filledAt: performance.now(), seenAt: syncEpoch(), ...base } : base;
|
|
1542
1564
|
}
|
|
1543
1565
|
function createHelpers(Fs, ops) {
|
|
1544
1566
|
const bridgeOf = (node) => node.mount.opts.bridge;
|
|
@@ -1591,9 +1613,11 @@ function createHelpers(Fs, ops) {
|
|
|
1591
1613
|
const size = node.live.ranged?.size() ?? node.live.len;
|
|
1592
1614
|
return { ...node.live.stat, size };
|
|
1593
1615
|
}
|
|
1594
|
-
|
|
1616
|
+
const view = bridgeOf(node).changes;
|
|
1617
|
+
if (!cachedStat(node, Fs.isDir(node.mode), view)) {
|
|
1618
|
+
const asked = { statGen: view?.now(), filledAt: performance.now() };
|
|
1595
1619
|
const st = call2(() => bridgeOf(node).lstat(liveNodePath(linked.holder(node))));
|
|
1596
|
-
|
|
1620
|
+
filled(node.live, st, asked);
|
|
1597
1621
|
node.mode = modeFromStat(st, exactIn(node));
|
|
1598
1622
|
}
|
|
1599
1623
|
return node.live.stat;
|
|
@@ -1755,7 +1779,7 @@ function createNodeOps(h) {
|
|
|
1755
1779
|
const owned = bridgeOf(node).owners === true;
|
|
1756
1780
|
if (owned && Fs.isLink(node.mode) && statOf(node).uid === void 0)
|
|
1757
1781
|
node.live.stat = void 0;
|
|
1758
|
-
const cached = owned && cachedStat(node
|
|
1782
|
+
const cached = owned && cachedStat(node, Fs.isDir(node.mode), bridgeOf(node).changes);
|
|
1759
1783
|
const st = statOf(node);
|
|
1760
1784
|
if (cached) searchParents(Fs, node, bridgeOf(node), call2);
|
|
1761
1785
|
const s = node.live;
|
|
@@ -1804,8 +1828,9 @@ function createNodeOps(h) {
|
|
|
1804
1828
|
lookup(parent, name2) {
|
|
1805
1829
|
const listed2 = parent.live.listed?.get(name2);
|
|
1806
1830
|
parent.live.listed?.delete(name2);
|
|
1831
|
+
const asked = listed2 ? listing(parent.live) : asking(bridgeOf(parent));
|
|
1807
1832
|
const st = listed2 ?? call2(() => bridgeOf(parent).lstat(childPath(parent, name2)));
|
|
1808
|
-
return makeNode(parent, name2, st);
|
|
1833
|
+
return answeredAt(makeNode(parent, name2, st), asked);
|
|
1809
1834
|
},
|
|
1810
1835
|
mknod(parent, name2, mode) {
|
|
1811
1836
|
parent.live.listed = void 0;
|
|
@@ -1878,8 +1903,11 @@ function createNodeOps(h) {
|
|
|
1878
1903
|
call2(() => bridgeOf(parent).rmdir(childPath(parent, name2)));
|
|
1879
1904
|
},
|
|
1880
1905
|
readdir(node) {
|
|
1906
|
+
const listedAt = performance.now();
|
|
1907
|
+
const listedGen = bridgeOf(node).changes?.now();
|
|
1881
1908
|
const listed2 = call2(() => bridgeOf(node).readdirStat(liveNodePath(node)));
|
|
1882
1909
|
node.live.listed = /* @__PURE__ */ new Map();
|
|
1910
|
+
Object.assign(node.live, { listedAt, listedGen });
|
|
1883
1911
|
for (const [name2, st] of listed2) if (st) node.live.listed.set(name2, st);
|
|
1884
1912
|
return [".", "..", ...listed2.map(([name2]) => name2)];
|
|
1885
1913
|
},
|
|
@@ -2511,6 +2539,7 @@ var init_live_vfs_fs = __esm({
|
|
|
2511
2539
|
"src/realm/live-vfs-fs.ts"() {
|
|
2512
2540
|
"use strict";
|
|
2513
2541
|
init_access();
|
|
2542
|
+
init_changes();
|
|
2514
2543
|
init_ranged();
|
|
2515
2544
|
init_types();
|
|
2516
2545
|
init_wasi_errno();
|
|
@@ -2664,7 +2693,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2664
2693
|
var init_version = __esm({
|
|
2665
2694
|
"src/version.ts"() {
|
|
2666
2695
|
"use strict";
|
|
2667
|
-
KERNEL_VERSION = true ? "1.133.
|
|
2696
|
+
KERNEL_VERSION = true ? "1.133.4" : "0.0.0-dev";
|
|
2668
2697
|
OS_RELEASE = "6.0.0-slicc";
|
|
2669
2698
|
}
|
|
2670
2699
|
});
|
|
@@ -5366,8 +5395,8 @@ function sysEntry(parts) {
|
|
|
5366
5395
|
}
|
|
5367
5396
|
return at;
|
|
5368
5397
|
}
|
|
5369
|
-
function sysText(file,
|
|
5370
|
-
return typeof file === "string" ? file : file(
|
|
5398
|
+
function sysText(file, listing2) {
|
|
5399
|
+
return typeof file === "string" ? file : file(listing2());
|
|
5371
5400
|
}
|
|
5372
5401
|
function commOf(info) {
|
|
5373
5402
|
const name2 = info.argv[0] ?? "";
|
|
@@ -5495,35 +5524,35 @@ function memoryInfo(source, used = 0) {
|
|
|
5495
5524
|
["SwapFree", kb(0)]
|
|
5496
5525
|
].map(([key, value2]) => `${`${key}:`.padEnd(16)}${value2.padStart(12)}`).concat("").join("\n");
|
|
5497
5526
|
}
|
|
5498
|
-
function systemFile(name2,
|
|
5527
|
+
function systemFile(name2, listing2, now, memory) {
|
|
5499
5528
|
if (name2 === "version") return procVersion();
|
|
5500
|
-
const up = Math.max(0, now -
|
|
5529
|
+
const up = Math.max(0, now - listing2.boot) / 1e3;
|
|
5501
5530
|
if (name2 === "uptime") return `${up.toFixed(2)} ${up.toFixed(2)}
|
|
5502
5531
|
`;
|
|
5503
5532
|
if (name2 === "meminfo") {
|
|
5504
5533
|
return memoryInfo(
|
|
5505
5534
|
memory,
|
|
5506
|
-
|
|
5535
|
+
listing2.processes.reduce((sum2, p) => sum2 + p.memory, 0)
|
|
5507
5536
|
);
|
|
5508
5537
|
}
|
|
5509
|
-
const live =
|
|
5538
|
+
const live = listing2.processes.filter((p) => p.state !== "Z");
|
|
5510
5539
|
if (name2 === "loadavg") {
|
|
5511
|
-
const last = Math.max(0, ...
|
|
5512
|
-
const [one, five, fifteen] = (
|
|
5540
|
+
const last = Math.max(0, ...listing2.processes.map((p) => p.pid));
|
|
5541
|
+
const [one, five, fifteen] = (listing2.load ?? [0, 0, 0]).map((n) => n.toFixed(2));
|
|
5513
5542
|
return `${one} ${five} ${fifteen} 1/${live.length} ${last}
|
|
5514
5543
|
`;
|
|
5515
5544
|
}
|
|
5516
|
-
const sum = (key) =>
|
|
5545
|
+
const sum = (key) => listing2.cpu?.[key] ?? listing2.processes.reduce((n, p) => n + (p[key] ?? 0), 0);
|
|
5517
5546
|
const user = ticks(sum("utime"));
|
|
5518
5547
|
const system = ticks(sum("stime"));
|
|
5519
|
-
const idle =
|
|
5548
|
+
const idle = listing2.cpu ? ticks(listing2.cpu.idle) : Math.max(0, ticks(now - listing2.boot) - user - system);
|
|
5520
5549
|
return [
|
|
5521
5550
|
`cpu ${user} 0 ${system} ${idle} 0 0 0 0 0 0`,
|
|
5522
5551
|
`cpu0 ${user} 0 ${system} ${idle} 0 0 0 0 0 0`,
|
|
5523
5552
|
"intr 0",
|
|
5524
5553
|
"ctxt 0",
|
|
5525
|
-
`btime ${Math.floor(
|
|
5526
|
-
`processes ${
|
|
5554
|
+
`btime ${Math.floor(listing2.boot / 1e3)}`,
|
|
5555
|
+
`processes ${listing2.processes.length}`,
|
|
5527
5556
|
"procs_running 1",
|
|
5528
5557
|
"procs_blocked 0",
|
|
5529
5558
|
""
|
|
@@ -5608,10 +5637,10 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
5608
5637
|
const find = (processes2, target, own) => (own ? processes2.find((p) => p.tid === target) : void 0) ?? processes2.find((p) => p.pid === target || p.tid === target);
|
|
5609
5638
|
const infoOf = (target) => find(procList().processes, target, false);
|
|
5610
5639
|
const pidContent = (target, name2, own = false) => () => {
|
|
5611
|
-
const
|
|
5612
|
-
const info = find(
|
|
5640
|
+
const listing2 = procList();
|
|
5641
|
+
const info = find(listing2.processes, target, own);
|
|
5613
5642
|
if (!info) throw error();
|
|
5614
|
-
return pidFile(name2, info,
|
|
5643
|
+
return pidFile(name2, info, listing2.boot);
|
|
5615
5644
|
};
|
|
5616
5645
|
const sysDir = (parent, name2, tree) => {
|
|
5617
5646
|
const dir = fresh(parent, name2, DIR_MODE2);
|
|
@@ -5746,15 +5775,15 @@ var init_procfs = __esm({
|
|
|
5746
5775
|
osrelease: `${OS_RELEASE}
|
|
5747
5776
|
`,
|
|
5748
5777
|
ostype: "Linux\n",
|
|
5749
|
-
slicc_wasm_memories: (
|
|
5778
|
+
slicc_wasm_memories: (listing2) => `${listing2.wasm?.live ?? 0} ${listing2.wasm?.ceiling ?? 0} ${listing2.wasm?.source ?? "none"}
|
|
5750
5779
|
`,
|
|
5751
|
-
slicc_shared_root: (
|
|
5780
|
+
slicc_shared_root: (listing2) => `${listing2.peers ?? 0}
|
|
5752
5781
|
`,
|
|
5753
|
-
slicc_fs_calls: (
|
|
5782
|
+
slicc_fs_calls: (listing2) => `${listing2.fsCalls ?? 0}
|
|
5754
5783
|
`,
|
|
5755
|
-
slicc_opfs_calls: (
|
|
5784
|
+
slicc_opfs_calls: (listing2) => `${listing2.opfsCalls ?? 0}
|
|
5756
5785
|
`,
|
|
5757
|
-
slicc_opfs_ops: (
|
|
5786
|
+
slicc_opfs_ops: (listing2) => `${listing2.opfsOps ?? 0}
|
|
5758
5787
|
`
|
|
5759
5788
|
}
|
|
5760
5789
|
};
|
|
@@ -6741,11 +6770,11 @@ function copying(bridge, mutating, entry) {
|
|
|
6741
6770
|
copy: (from, to, mode, exclusive) => mutating(() => copy2.call(bridge, from, to, mode, exclusive), ...entry(to))
|
|
6742
6771
|
};
|
|
6743
6772
|
}
|
|
6744
|
-
function listed({ cache, seen, filled }, p, list, gen, asked) {
|
|
6773
|
+
function listed({ cache, seen, filled: filled2 }, p, list, gen, asked) {
|
|
6745
6774
|
const base = p === "/" ? "" : p;
|
|
6746
6775
|
for (const [name2, st] of list) {
|
|
6747
6776
|
if (!st) continue;
|
|
6748
|
-
|
|
6777
|
+
filled2.set(st, asked);
|
|
6749
6778
|
const at = `${base}/${name2}`;
|
|
6750
6779
|
cache.put(cache.lstats, at, st);
|
|
6751
6780
|
if (gen !== void 0) seen.saw(cache.lstats, at, gen);
|
|
@@ -6758,7 +6787,7 @@ function fetched({
|
|
|
6758
6787
|
view,
|
|
6759
6788
|
now,
|
|
6760
6789
|
seen,
|
|
6761
|
-
filled,
|
|
6790
|
+
filled: filled2,
|
|
6762
6791
|
cache
|
|
6763
6792
|
}, map, path, get) {
|
|
6764
6793
|
const gen = view?.now();
|
|
@@ -6770,7 +6799,7 @@ function fetched({
|
|
|
6770
6799
|
} catch (e) {
|
|
6771
6800
|
hit = { error: e, until: asked + MISS_TTL_MS, ...gen !== void 0 ? { gen } : {} };
|
|
6772
6801
|
}
|
|
6773
|
-
|
|
6802
|
+
filled2.set(hit, asked);
|
|
6774
6803
|
cache.put(map, path, hit);
|
|
6775
6804
|
return hit;
|
|
6776
6805
|
}
|
|
@@ -6779,17 +6808,17 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6779
6808
|
const cache = new StatCache(blind ? void 0 : shared);
|
|
6780
6809
|
const { stats, lstats } = cache;
|
|
6781
6810
|
const view = bridge.changes;
|
|
6782
|
-
const
|
|
6783
|
-
const
|
|
6784
|
-
const live = (miss, path) => miss.until > now() &&
|
|
6811
|
+
const filled2 = new Fills(view, now);
|
|
6812
|
+
const young2 = (entry2) => filled2.young(entry2);
|
|
6813
|
+
const live = (miss, path) => miss.until > now() && young2(miss) && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
6785
6814
|
const seen = new SeenAt(view, lstats);
|
|
6786
|
-
const kept = remember(cache, seen, blind, (entry2) =>
|
|
6815
|
+
const kept = remember(cache, seen, blind, (entry2) => filled2.set(entry2));
|
|
6787
6816
|
const gone = (path) => goneAbove([lstats, stats], live, path);
|
|
6788
6817
|
const usable = (map, path) => {
|
|
6789
6818
|
const hit = map.get(path);
|
|
6790
6819
|
if (hit === void 0) return void 0;
|
|
6791
6820
|
if ("until" in hit) return live(hit, path) ? hit : void 0;
|
|
6792
|
-
return
|
|
6821
|
+
return young2(hit) && !seen.changed(map, path) ? hit : void 0;
|
|
6793
6822
|
};
|
|
6794
6823
|
const cached = (map, path, get) => {
|
|
6795
6824
|
if (blind) return get();
|
|
@@ -6798,7 +6827,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6798
6827
|
if (hit === void 0) {
|
|
6799
6828
|
const missing2 = gone(path);
|
|
6800
6829
|
if (missing2) throw missing2.error;
|
|
6801
|
-
hit = fetched({ view, now, seen, filled, cache }, map, path, get);
|
|
6830
|
+
hit = fetched({ view, now, seen, filled: filled2, cache }, map, path, get);
|
|
6802
6831
|
}
|
|
6803
6832
|
if ("until" in hit) throw hit.error;
|
|
6804
6833
|
return hit;
|
|
@@ -6857,14 +6886,14 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6857
6886
|
const gen = view?.now();
|
|
6858
6887
|
const asked = now();
|
|
6859
6888
|
const list = bridge.readdirStat(p);
|
|
6860
|
-
if (!blind) listed({ cache, seen, filled }, p, list, gen, asked);
|
|
6889
|
+
if (!blind) listed({ cache, seen, filled: filled2 }, p, list, gen, asked);
|
|
6861
6890
|
return list;
|
|
6862
6891
|
},
|
|
6863
6892
|
readlink: (p) => {
|
|
6864
6893
|
const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
|
|
6865
6894
|
const gen = seen.lstat(p);
|
|
6866
6895
|
const current = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
|
|
6867
|
-
if (known && current && !("until" in known) &&
|
|
6896
|
+
if (known && current && !("until" in known) && young2(known) && !known.isSymbolicLink) {
|
|
6868
6897
|
throw syncError("EINVAL", `'${p}' is not a symbolic link`);
|
|
6869
6898
|
}
|
|
6870
6899
|
return bridge.readlink(p);
|
|
@@ -6937,10 +6966,11 @@ function pinnedIo2(bridge, handle, rewriting) {
|
|
|
6937
6966
|
} : {}
|
|
6938
6967
|
};
|
|
6939
6968
|
}
|
|
6940
|
-
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS,
|
|
6969
|
+
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, UMASK2, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt, remember, Fills;
|
|
6941
6970
|
var init_wasi_files = __esm({
|
|
6942
6971
|
"src/process/wasi/wasi-files.ts"() {
|
|
6943
6972
|
"use strict";
|
|
6973
|
+
init_changes();
|
|
6944
6974
|
init_ranged();
|
|
6945
6975
|
init_sync_fs_wire();
|
|
6946
6976
|
WasiError = class extends Error {
|
|
@@ -7164,7 +7194,6 @@ var init_wasi_files = __esm({
|
|
|
7164
7194
|
};
|
|
7165
7195
|
MAX_LINKS = 40;
|
|
7166
7196
|
MISS_TTL_MS = 20;
|
|
7167
|
-
SHARED_TTL_MS = 100;
|
|
7168
7197
|
CACHE_CAP = 8192;
|
|
7169
7198
|
FS_GEN = 4;
|
|
7170
7199
|
CRED_GEN = 5;
|
|
@@ -11318,13 +11347,13 @@ var init_wasi_host = __esm({
|
|
|
11318
11347
|
const view = this.mem.view();
|
|
11319
11348
|
const size = Math.min(view.getUint32(at, true), SIGINFO_BYTES);
|
|
11320
11349
|
const fields = [sig, info.code, info.pid, info.uid, info.status];
|
|
11321
|
-
let
|
|
11350
|
+
let filled2 = 4;
|
|
11322
11351
|
for (const [i, value2] of fields.entries()) {
|
|
11323
11352
|
if (4 + (i + 1) * 4 > size) break;
|
|
11324
11353
|
view.setInt32(4 + at + i * 4, value2, true);
|
|
11325
|
-
|
|
11354
|
+
filled2 = 4 + (i + 1) * 4;
|
|
11326
11355
|
}
|
|
11327
|
-
view.setUint32(at,
|
|
11356
|
+
view.setUint32(at, filled2, true);
|
|
11328
11357
|
return true;
|
|
11329
11358
|
}
|
|
11330
11359
|
fdAlias(path) {
|
|
@@ -12389,10 +12418,10 @@ var init_wasi_procfs = __esm({
|
|
|
12389
12418
|
return {
|
|
12390
12419
|
kind: "file",
|
|
12391
12420
|
content: () => {
|
|
12392
|
-
const
|
|
12393
|
-
const info =
|
|
12421
|
+
const listing2 = this.listing();
|
|
12422
|
+
const info = listing2.processes.find((p) => p.pid === Number(top));
|
|
12394
12423
|
if (!info) throw syncError("ENOENT", `/proc/${top}/${leaf}`);
|
|
12395
|
-
return pidFile(leaf, info,
|
|
12424
|
+
return pidFile(leaf, info, listing2.boot);
|
|
12396
12425
|
}
|
|
12397
12426
|
};
|
|
12398
12427
|
}
|
|
@@ -12410,9 +12439,9 @@ var init_wasi_procfs = __esm({
|
|
|
12410
12439
|
return {
|
|
12411
12440
|
kind: "file",
|
|
12412
12441
|
content: () => {
|
|
12413
|
-
const
|
|
12414
|
-
const info =
|
|
12415
|
-
const line = info && taskStat(info, Number(tid),
|
|
12442
|
+
const listing2 = this.listing();
|
|
12443
|
+
const info = listing2.processes.find((p) => p.pid === pid);
|
|
12444
|
+
const line = info && taskStat(info, Number(tid), listing2.boot);
|
|
12416
12445
|
if (line === void 0) throw syncError("ENOENT", `/proc/${pid}/task/${tid}/stat`);
|
|
12417
12446
|
return line;
|
|
12418
12447
|
}
|
|
@@ -16117,10 +16146,10 @@ var init_js_net = __esm({
|
|
|
16117
16146
|
|
|
16118
16147
|
// src/process/js/js-proc.ts
|
|
16119
16148
|
function* procStep(abs, pid, run) {
|
|
16120
|
-
const
|
|
16149
|
+
const listing2 = yield { op: "proc-list" };
|
|
16121
16150
|
const mounts = abs === "/proc/mounts" ? yield { op: "mount-list" } : [];
|
|
16122
16151
|
const tree = new ProcTree(
|
|
16123
|
-
{ procList: () =>
|
|
16152
|
+
{ procList: () => listing2, mountList: () => mounts },
|
|
16124
16153
|
pid,
|
|
16125
16154
|
memorySource()
|
|
16126
16155
|
);
|