@ai-ecoverse/slicc-kernel 1.164.1 → 1.164.3
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 +3 -2
- package/dist/kernel-worker.js +1 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-driver-worker.js +37 -5
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +140 -112
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +1 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +33 -13
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/changes.d.ts +2 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/package.json +1 -1
|
@@ -338,6 +338,9 @@ var init_wasi_abi = __esm({
|
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
// src/fs/changes.ts
|
|
341
|
+
function renameWait(view) {
|
|
342
|
+
return view.foreign() ? RENAME_WAIT_SHARED_MS : RENAME_WAIT_MS;
|
|
343
|
+
}
|
|
341
344
|
function changeHash(path) {
|
|
342
345
|
let h = 2166136261;
|
|
343
346
|
for (let i = 0; i < path.length; i++) {
|
|
@@ -355,7 +358,7 @@ function normal(path) {
|
|
|
355
358
|
}
|
|
356
359
|
return `/${parts.join("/")}`;
|
|
357
360
|
}
|
|
358
|
-
var GEN, RING, RING_SIZE, SLOT, SHARED_TTL_MS, RENAME_WAIT_MS, DIRTY, FOREIGN, RENAMES, CHANGES_BYTES, ChangeView;
|
|
361
|
+
var GEN, RING, RING_SIZE, SLOT, SHARED_TTL_MS, RENAME_WAIT_MS, RENAME_WAIT_SHARED_MS, DIRTY, FOREIGN, RENAMES, CHANGES_BYTES, ChangeView;
|
|
359
362
|
var init_changes = __esm({
|
|
360
363
|
"src/fs/changes.ts"() {
|
|
361
364
|
"use strict";
|
|
@@ -366,6 +369,7 @@ var init_changes = __esm({
|
|
|
366
369
|
SLOT = 2;
|
|
367
370
|
SHARED_TTL_MS = 100;
|
|
368
371
|
RENAME_WAIT_MS = 100;
|
|
372
|
+
RENAME_WAIT_SHARED_MS = 1e3;
|
|
369
373
|
DIRTY = RING + RING_SIZE * SLOT;
|
|
370
374
|
FOREIGN = DIRTY + 1;
|
|
371
375
|
RENAMES = FOREIGN + 1;
|
|
@@ -387,18 +391,18 @@ var init_changes = __esm({
|
|
|
387
391
|
renames() {
|
|
388
392
|
return this.view.length > RENAMES ? capturedAtomics.load(this.view, RENAMES) : 0;
|
|
389
393
|
}
|
|
390
|
-
awaitRename(
|
|
391
|
-
if (this.view.length > RENAMES) capturedAtomics.wait(this.view, RENAMES,
|
|
394
|
+
awaitRename(seen2, ms) {
|
|
395
|
+
if (this.view.length > RENAMES) capturedAtomics.wait(this.view, RENAMES, seen2, ms);
|
|
392
396
|
return this.renames();
|
|
393
397
|
}
|
|
394
|
-
changedSince(
|
|
398
|
+
changedSince(seen2, path) {
|
|
395
399
|
const now = capturedAtomics.load(this.view, GEN);
|
|
396
|
-
const distance = now -
|
|
400
|
+
const distance = now - seen2 >>> 0;
|
|
397
401
|
if (distance === 0) return { now, changed: false };
|
|
398
402
|
if (distance > RING_SIZE) return { now, changed: true };
|
|
399
403
|
const hash = changeHash(normal(path));
|
|
400
404
|
for (let i = 1; i <= distance; i++) {
|
|
401
|
-
const g =
|
|
405
|
+
const g = seen2 + i | 0;
|
|
402
406
|
const at = RING + (g & RING_SIZE - 1) * SLOT;
|
|
403
407
|
if (capturedAtomics.load(this.view, at) !== g) return { now, changed: true };
|
|
404
408
|
const hit = capturedAtomics.load(this.view, at + 1) === hash;
|
|
@@ -608,7 +612,7 @@ function linkedWatch(watch, st) {
|
|
|
608
612
|
watch.sig = signatureOf(st);
|
|
609
613
|
return watch;
|
|
610
614
|
}
|
|
611
|
-
function viaAlias(watch,
|
|
615
|
+
function viaAlias(watch, seen2, path) {
|
|
612
616
|
if (watch.resolved === void 0) {
|
|
613
617
|
let real;
|
|
614
618
|
try {
|
|
@@ -617,7 +621,7 @@ function viaAlias(watch, seen, path) {
|
|
|
617
621
|
}
|
|
618
622
|
watch.resolved = real && real !== path ? real : null;
|
|
619
623
|
}
|
|
620
|
-
return watch.resolved !== null && watch.view.changedSince(
|
|
624
|
+
return watch.resolved !== null && watch.view.changedSince(seen2, watch.resolved).changed;
|
|
621
625
|
}
|
|
622
626
|
function viaLink(watch, path) {
|
|
623
627
|
if (!watch.linked) return false;
|
|
@@ -631,10 +635,10 @@ function viaLink(watch, path) {
|
|
|
631
635
|
watch.sig = sig;
|
|
632
636
|
return true;
|
|
633
637
|
}
|
|
634
|
-
function watchedChange(watch,
|
|
635
|
-
const said = watch.view.changedSince(
|
|
636
|
-
if (said.changed || said.now ===
|
|
637
|
-
return { now: said.now, changed: viaAlias(watch,
|
|
638
|
+
function watchedChange(watch, seen2, path) {
|
|
639
|
+
const said = watch.view.changedSince(seen2, path);
|
|
640
|
+
if (said.changed || said.now === seen2) return said;
|
|
641
|
+
return { now: said.now, changed: viaAlias(watch, seen2, path) || viaLink(watch, path) };
|
|
638
642
|
}
|
|
639
643
|
var signatureOf, RangedFile;
|
|
640
644
|
var init_ranged = __esm({
|
|
@@ -944,23 +948,23 @@ function copying(bridge, mutating, entry) {
|
|
|
944
948
|
copy: (from, to, mode, exclusive) => mutating(() => copy2.call(bridge, from, to, mode, exclusive), ...entry(to))
|
|
945
949
|
};
|
|
946
950
|
}
|
|
947
|
-
function listed({ cache, seen, filled: filled2 }, p, list, gen, asked) {
|
|
951
|
+
function listed({ cache, seen: seen2, filled: filled2 }, p, list, gen, asked) {
|
|
948
952
|
const base = p === "/" ? "" : p;
|
|
949
953
|
for (const [name2, st] of list) {
|
|
950
954
|
if (!st) continue;
|
|
951
955
|
filled2.set(st, asked);
|
|
952
956
|
const at = `${base}/${name2}`;
|
|
953
957
|
cache.put(cache.lstats, at, st);
|
|
954
|
-
if (gen !== void 0)
|
|
958
|
+
if (gen !== void 0) seen2.saw(cache.lstats, at, gen);
|
|
955
959
|
if (st.isSymbolicLink) continue;
|
|
956
960
|
cache.put(cache.stats, at, st);
|
|
957
|
-
if (gen !== void 0)
|
|
961
|
+
if (gen !== void 0) seen2.saw(cache.stats, at, gen);
|
|
958
962
|
}
|
|
959
963
|
}
|
|
960
964
|
function fetched({
|
|
961
965
|
view,
|
|
962
966
|
now,
|
|
963
|
-
seen,
|
|
967
|
+
seen: seen2,
|
|
964
968
|
filled: filled2,
|
|
965
969
|
cache
|
|
966
970
|
}, map, path, get) {
|
|
@@ -969,7 +973,7 @@ function fetched({
|
|
|
969
973
|
let hit;
|
|
970
974
|
try {
|
|
971
975
|
hit = get();
|
|
972
|
-
if (gen !== void 0)
|
|
976
|
+
if (gen !== void 0) seen2.saw(map, path, gen);
|
|
973
977
|
} catch (e) {
|
|
974
978
|
hit = { error: e, until: asked + MISS_TTL_MS, ...gen !== void 0 ? { gen } : {} };
|
|
975
979
|
}
|
|
@@ -985,14 +989,14 @@ function cachingBridge(bridge, now = () => capturedperformance.now(), shared) {
|
|
|
985
989
|
const filled2 = new Fills(view, now);
|
|
986
990
|
const young2 = (entry2) => filled2.young(entry2);
|
|
987
991
|
const live = (miss, path) => miss.until > now() && young2(miss) && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
988
|
-
const
|
|
989
|
-
const kept = remember(cache,
|
|
992
|
+
const seen2 = new SeenAt(view, lstats);
|
|
993
|
+
const kept = remember(cache, seen2, blind, (entry2) => filled2.set(entry2));
|
|
990
994
|
const gone2 = (path) => goneAbove([lstats, stats], live, path);
|
|
991
995
|
const usable = (map, path) => {
|
|
992
996
|
const hit = map.get(path);
|
|
993
997
|
if (hit === void 0) return void 0;
|
|
994
998
|
if ("until" in hit) return live(hit, path) ? hit : void 0;
|
|
995
|
-
return young2(hit) && !
|
|
999
|
+
return young2(hit) && !seen2.changed(map, path) ? hit : void 0;
|
|
996
1000
|
};
|
|
997
1001
|
const cached2 = (map, path, get) => {
|
|
998
1002
|
if (blind) return get();
|
|
@@ -1001,7 +1005,7 @@ function cachingBridge(bridge, now = () => capturedperformance.now(), shared) {
|
|
|
1001
1005
|
if (hit === void 0) {
|
|
1002
1006
|
const missing2 = gone2(path);
|
|
1003
1007
|
if (missing2) throw missing2.error;
|
|
1004
|
-
hit = fetched({ view, now, seen, filled: filled2, cache }, map, path, get);
|
|
1008
|
+
hit = fetched({ view, now, seen: seen2, filled: filled2, cache }, map, path, get);
|
|
1005
1009
|
}
|
|
1006
1010
|
if ("until" in hit) throw hit.error;
|
|
1007
1011
|
return hit;
|
|
@@ -1061,12 +1065,12 @@ function cachingBridge(bridge, now = () => capturedperformance.now(), shared) {
|
|
|
1061
1065
|
const gen = view?.now();
|
|
1062
1066
|
const asked = now();
|
|
1063
1067
|
const list = bridge.readdirStat(p);
|
|
1064
|
-
if (!blind) listed({ cache, seen, filled: filled2 }, p, list, gen, asked);
|
|
1068
|
+
if (!blind) listed({ cache, seen: seen2, filled: filled2 }, p, list, gen, asked);
|
|
1065
1069
|
return list;
|
|
1066
1070
|
},
|
|
1067
1071
|
readlink: (p) => {
|
|
1068
1072
|
const known = blind ? void 0 : (cache.fresh(), lstats.get(p));
|
|
1069
|
-
const gen =
|
|
1073
|
+
const gen = seen2.lstat(p);
|
|
1070
1074
|
const current2 = view !== void 0 && gen !== void 0 && !view.changedSince(gen, p).changed;
|
|
1071
1075
|
if (known && current2 && !("until" in known) && young2(known) && !known.isSymbolicLink) {
|
|
1072
1076
|
throw syncError("EINVAL", `'${p}' is not a symbolic link`);
|
|
@@ -1141,7 +1145,7 @@ function pinnedIo(bridge, handle, rewriting) {
|
|
|
1141
1145
|
} : {}
|
|
1142
1146
|
};
|
|
1143
1147
|
}
|
|
1144
|
-
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, UMASK, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt, remember, Fills;
|
|
1148
|
+
var FOLLOW_MS, WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS, CACHE_CAP, FS_GEN, CRED_GEN, UMASK, RING2, RING_SIZE2, SLOT2, FD_RING, FD_RING_SIZE, SHARED_IDS_BYTES, StatCache, SEEN_CAP, SeenAt, remember, Fills;
|
|
1145
1149
|
var init_wasi_files = __esm({
|
|
1146
1150
|
"src/process/wasi/wasi-files.ts"() {
|
|
1147
1151
|
"use strict";
|
|
@@ -1149,6 +1153,7 @@ var init_wasi_files = __esm({
|
|
|
1149
1153
|
init_changes();
|
|
1150
1154
|
init_ranged();
|
|
1151
1155
|
init_sync_fs_wire();
|
|
1156
|
+
FOLLOW_MS = 2e3;
|
|
1152
1157
|
WasiError = class extends capturedError {
|
|
1153
1158
|
code;
|
|
1154
1159
|
constructor(code2) {
|
|
@@ -1199,11 +1204,14 @@ var init_wasi_files = __esm({
|
|
|
1199
1204
|
return this.where;
|
|
1200
1205
|
}
|
|
1201
1206
|
retried(op) {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
+
const end = capturedperformance.now() + FOLLOW_MS;
|
|
1208
|
+
for (; ; ) {
|
|
1209
|
+
try {
|
|
1210
|
+
return op();
|
|
1211
|
+
} catch (err) {
|
|
1212
|
+
const gone2 = err.code === "ENOENT";
|
|
1213
|
+
if (!gone2 || capturedperformance.now() > end || !this.moved?.(true)) throw err;
|
|
1214
|
+
}
|
|
1207
1215
|
}
|
|
1208
1216
|
}
|
|
1209
1217
|
set path(path) {
|
|
@@ -1559,26 +1567,26 @@ var init_wasi_files = __esm({
|
|
|
1559
1567
|
return this.links.get(path);
|
|
1560
1568
|
}
|
|
1561
1569
|
saw(map, path, gen) {
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1570
|
+
const seen2 = this.of(map);
|
|
1571
|
+
if (seen2.size >= SEEN_CAP) seen2.clear();
|
|
1572
|
+
seen2.set(path, gen);
|
|
1565
1573
|
}
|
|
1566
1574
|
changed(map, path) {
|
|
1567
1575
|
if (this.view === void 0) return false;
|
|
1568
|
-
const
|
|
1569
|
-
const gen =
|
|
1576
|
+
const seen2 = this.of(map);
|
|
1577
|
+
const gen = seen2.get(path);
|
|
1570
1578
|
if (gen === void 0) return true;
|
|
1571
1579
|
const since = this.view.changedSince(gen, path);
|
|
1572
|
-
if (!since.changed)
|
|
1580
|
+
if (!since.changed) seen2.set(path, since.now);
|
|
1573
1581
|
return since.changed;
|
|
1574
1582
|
}
|
|
1575
1583
|
};
|
|
1576
|
-
remember = (cache,
|
|
1584
|
+
remember = (cache, seen2, blind, fill) => (path, made) => {
|
|
1577
1585
|
if (!made || blind) return made;
|
|
1578
1586
|
const { seen: at, ...st } = made;
|
|
1579
1587
|
fill(st);
|
|
1580
1588
|
cache.put(cache.stats, path, st);
|
|
1581
|
-
if (at !== void 0)
|
|
1589
|
+
if (at !== void 0) seen2.saw(cache.stats, path, at);
|
|
1582
1590
|
return made;
|
|
1583
1591
|
};
|
|
1584
1592
|
Fills = class {
|
|
@@ -2173,8 +2181,8 @@ function errnoError(code2, path, direct) {
|
|
|
2173
2181
|
const err = syncError(code2, `sync-sab bridge, '${path}'`);
|
|
2174
2182
|
return direct ? capturedObject.assign(err, { direct }) : err;
|
|
2175
2183
|
}
|
|
2176
|
-
function holdSeen(
|
|
2177
|
-
return { gen:
|
|
2184
|
+
function holdSeen(seen2) {
|
|
2185
|
+
return { gen: seen2.gen, ino: seen2.ino, ...seen2.nofollow ? { nofollow: true } : {} };
|
|
2178
2186
|
}
|
|
2179
2187
|
function createSyncFsSabBridge(transport, opts = {}) {
|
|
2180
2188
|
const direct = opts.direct ? { direct: true } : {};
|
|
@@ -2324,8 +2332,8 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
2324
2332
|
if (!r.ok || r.kind !== "json") return void 0;
|
|
2325
2333
|
const st = parseSyncFsStat(r.json);
|
|
2326
2334
|
if (!st) return void 0;
|
|
2327
|
-
const { seen } = r.json;
|
|
2328
|
-
return typeof
|
|
2335
|
+
const { seen: seen2 } = r.json;
|
|
2336
|
+
return typeof seen2 === "number" ? { ...st, seen: seen2 } : st;
|
|
2329
2337
|
},
|
|
2330
2338
|
chown: (path, uid, gid, follow3, handle) => {
|
|
2331
2339
|
const ids = { ...uid !== void 0 ? { uid } : {}, ...gid !== void 0 ? { gid } : {} };
|
|
@@ -2345,10 +2353,10 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
2345
2353
|
access: (path, mode, kind = "access", nofollow) => {
|
|
2346
2354
|
run({ op: "access", path, mode, arg2: kind, ...nofollow ? { nofollow } : {} }, path);
|
|
2347
2355
|
},
|
|
2348
|
-
hold: (path, held2, open, handle, want = 0,
|
|
2356
|
+
hold: (path, held2, open, handle, want = 0, seen2 = {}) => {
|
|
2349
2357
|
const mode = (held2 ? 1 : 0) | (open ? 2 : 0);
|
|
2350
2358
|
if (mode === 3) {
|
|
2351
|
-
return json2({ op: "hold", path, mode: mode | want, ...holdSeen(
|
|
2359
|
+
return json2({ op: "hold", path, mode: mode | want, ...holdSeen(seen2) }, path);
|
|
2352
2360
|
}
|
|
2353
2361
|
run({ op: "hold", path, mode, ...handle !== void 0 ? { handle } : {} }, path);
|
|
2354
2362
|
return void 0;
|
|
@@ -2382,8 +2390,8 @@ var init_sync_sab_bridge = __esm({
|
|
|
2382
2390
|
});
|
|
2383
2391
|
|
|
2384
2392
|
// src/process/js/async-sab.ts
|
|
2385
|
-
async function changed(header, index3,
|
|
2386
|
-
const waited = waitAsync(header, index3,
|
|
2393
|
+
async function changed(header, index3, seen2, waitAsync = defaultWaitAsync) {
|
|
2394
|
+
const waited = waitAsync(header, index3, seen2);
|
|
2387
2395
|
if (waited.async) await waited.value;
|
|
2388
2396
|
}
|
|
2389
2397
|
function createAsyncSabTransport(sab, port3, waitAsync = defaultWaitAsync) {
|
|
@@ -2595,14 +2603,14 @@ var init_js_kernel = __esm({
|
|
|
2595
2603
|
}
|
|
2596
2604
|
async settled(id, signal) {
|
|
2597
2605
|
for (; ; ) {
|
|
2598
|
-
const
|
|
2606
|
+
const seen2 = capturedAtomics.load(this.header, SAB_I_ASYNC);
|
|
2599
2607
|
const taken = await this.raw({ op: "async-take", id });
|
|
2600
2608
|
if (taken.ok || taken.errno !== "EAGAIN") return taken;
|
|
2601
2609
|
if (signal?.aborted) {
|
|
2602
2610
|
await this.raw({ op: "async-cancel", id });
|
|
2603
2611
|
throw signal.reason;
|
|
2604
2612
|
}
|
|
2605
|
-
await untilAborted(changed(this.header, SAB_I_ASYNC,
|
|
2613
|
+
await untilAborted(changed(this.header, SAB_I_ASYNC, seen2, this.waitAsync), signal);
|
|
2606
2614
|
}
|
|
2607
2615
|
}
|
|
2608
2616
|
deliver() {
|
|
@@ -3390,14 +3398,14 @@ var init_wasi_cred = __esm({
|
|
|
3390
3398
|
return this.cred;
|
|
3391
3399
|
}
|
|
3392
3400
|
change(apply4) {
|
|
3393
|
-
const
|
|
3401
|
+
const seen2 = this.gen();
|
|
3394
3402
|
const cred = apply4();
|
|
3395
3403
|
if (!this.shared) {
|
|
3396
3404
|
this.cred = cred;
|
|
3397
3405
|
return cred;
|
|
3398
3406
|
}
|
|
3399
3407
|
const was = capturedAtomics.add(this.shared, CRED_GEN, 1);
|
|
3400
|
-
this.cred = was ===
|
|
3408
|
+
this.cred = was === seen2 ? cred : void 0;
|
|
3401
3409
|
this.stamp = was + 1;
|
|
3402
3410
|
return cred;
|
|
3403
3411
|
}
|
|
@@ -3423,9 +3431,9 @@ var init_wasi_cred = __esm({
|
|
|
3423
3431
|
return this.mask;
|
|
3424
3432
|
}
|
|
3425
3433
|
for (; ; ) {
|
|
3426
|
-
const
|
|
3427
|
-
if (
|
|
3428
|
-
else if (
|
|
3434
|
+
const seen2 = capturedAtomics.load(shared, UMASK);
|
|
3435
|
+
if (seen2 & LOCKED) capturedAtomics.wait(shared, UMASK, seen2);
|
|
3436
|
+
else if (seen2 & KNOWN) return seen2 & 511;
|
|
3429
3437
|
else {
|
|
3430
3438
|
const mask = this.call();
|
|
3431
3439
|
if (capturedAtomics.compareExchange(shared, UMASK, 0, mask | KNOWN) === 0) return mask;
|
|
@@ -3446,8 +3454,8 @@ var init_wasi_cred = __esm({
|
|
|
3446
3454
|
this.mask = mask & 511;
|
|
3447
3455
|
return old;
|
|
3448
3456
|
}
|
|
3449
|
-
const
|
|
3450
|
-
let next2 =
|
|
3457
|
+
const seen2 = this.lock(shared);
|
|
3458
|
+
let next2 = seen2;
|
|
3451
3459
|
try {
|
|
3452
3460
|
const old = this.call(mask);
|
|
3453
3461
|
next2 = mask & 511 | KNOWN;
|
|
@@ -3459,9 +3467,9 @@ var init_wasi_cred = __esm({
|
|
|
3459
3467
|
}
|
|
3460
3468
|
lock(shared) {
|
|
3461
3469
|
for (; ; ) {
|
|
3462
|
-
const
|
|
3463
|
-
if (
|
|
3464
|
-
else if (capturedAtomics.compareExchange(shared, UMASK,
|
|
3470
|
+
const seen2 = capturedAtomics.load(shared, UMASK);
|
|
3471
|
+
if (seen2 & LOCKED) capturedAtomics.wait(shared, UMASK, seen2);
|
|
3472
|
+
else if (capturedAtomics.compareExchange(shared, UMASK, seen2, seen2 | LOCKED) === seen2) return seen2;
|
|
3465
3473
|
}
|
|
3466
3474
|
}
|
|
3467
3475
|
};
|
|
@@ -3626,16 +3634,28 @@ var init_wasi_fds = __esm({
|
|
|
3626
3634
|
}
|
|
3627
3635
|
followRenames(missing2 = false) {
|
|
3628
3636
|
const view = this.fs.changes;
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3637
|
+
const end = missing2 && view ? capturedperformance.now() + renameWait(view) : 0;
|
|
3638
|
+
const start2 = this.renamesSeen;
|
|
3639
|
+
for (; ; ) {
|
|
3640
|
+
const now = view?.renames() ?? 0;
|
|
3641
|
+
if (now !== this.renamesSeen && this.fs.renames && this.followTo(now)) return true;
|
|
3642
|
+
if (missing2 && this.renamesSeen !== start2) return true;
|
|
3643
|
+
const left = end - capturedperformance.now();
|
|
3644
|
+
if (!view || left <= 0) return false;
|
|
3645
|
+
view.awaitRename(now, left);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
followTo(now) {
|
|
3632
3649
|
const held2 = [...this.buffers].filter(([, b]) => !b.isOrphan()).map(([p]) => p);
|
|
3633
3650
|
if (held2.length === 0) {
|
|
3634
3651
|
this.renamesSeen = now;
|
|
3635
3652
|
return false;
|
|
3636
3653
|
}
|
|
3637
|
-
const { now:
|
|
3638
|
-
|
|
3654
|
+
const { now: seen2, renames } = this.fs.renames(
|
|
3655
|
+
this.renamesSeen,
|
|
3656
|
+
held2
|
|
3657
|
+
);
|
|
3658
|
+
this.renamesSeen = seen2;
|
|
3639
3659
|
for (const [from, to] of renames) this.renamed(from, to, void 0, true);
|
|
3640
3660
|
return renames.length > 0;
|
|
3641
3661
|
}
|
|
@@ -4372,7 +4392,7 @@ var init_wasi_fds = __esm({
|
|
|
4372
4392
|
this.made = void 0;
|
|
4373
4393
|
const empty = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
4374
4394
|
if (existing?.ranged) this.fs.invalidate?.();
|
|
4375
|
-
const
|
|
4395
|
+
const seen2 = reply ? reply.seen : this.fs.changes?.now();
|
|
4376
4396
|
const st = reply?.st ?? (existing?.ranged || !existing ? this.fs.stat(path) : existing);
|
|
4377
4397
|
const ranged = st.ranged ? st.size : void 0;
|
|
4378
4398
|
const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
|
|
@@ -4387,7 +4407,7 @@ var init_wasi_fds = __esm({
|
|
|
4387
4407
|
{
|
|
4388
4408
|
view,
|
|
4389
4409
|
ino: st.ino,
|
|
4390
|
-
seen,
|
|
4410
|
+
seen: seen2,
|
|
4391
4411
|
stat: (at) => {
|
|
4392
4412
|
this.fs.invalidate?.();
|
|
4393
4413
|
return this.fs.stat(at);
|
|
@@ -4825,7 +4845,7 @@ var init_wasi_sigmask = __esm({
|
|
|
4825
4845
|
publish(set);
|
|
4826
4846
|
try {
|
|
4827
4847
|
for (; ; ) {
|
|
4828
|
-
const
|
|
4848
|
+
const seen2 = capturedAtomics.load(this.header, SAB_I_SIGNALS);
|
|
4829
4849
|
const sig = this.take(set);
|
|
4830
4850
|
if (sig !== 0) {
|
|
4831
4851
|
took(sig);
|
|
@@ -4834,7 +4854,7 @@ var init_wasi_sigmask = __esm({
|
|
|
4834
4854
|
if (entered || this.deliverUnblocked() || this.interrupted()) return E.INTR;
|
|
4835
4855
|
const left = deadline - capturedperformance.now();
|
|
4836
4856
|
if (left <= 0) return E.AGAIN;
|
|
4837
|
-
capturedAtomics.wait(this.header, SAB_I_SIGNALS,
|
|
4857
|
+
capturedAtomics.wait(this.header, SAB_I_SIGNALS, seen2, capturedMath.min(left, POLL_MS));
|
|
4838
4858
|
}
|
|
4839
4859
|
} finally {
|
|
4840
4860
|
publish(0);
|
|
@@ -7365,7 +7385,7 @@ var init_version = __esm({
|
|
|
7365
7385
|
"src/version.ts"() {
|
|
7366
7386
|
"use strict";
|
|
7367
7387
|
init_captured_globals();
|
|
7368
|
-
KERNEL_VERSION = true ? "1.164.
|
|
7388
|
+
KERNEL_VERSION = true ? "1.164.3" : "0.0.0-dev";
|
|
7369
7389
|
OS_RELEASE = "6.0.0-slicc";
|
|
7370
7390
|
}
|
|
7371
7391
|
});
|
|
@@ -8835,10 +8855,10 @@ function loadedWatch(bridge, call3, path, st) {
|
|
|
8835
8855
|
return view && linkedWatch({ view, stat: () => call3(() => bridge.stat(path())) }, st);
|
|
8836
8856
|
}
|
|
8837
8857
|
function rangedFileOf(bridge, call3, path, io) {
|
|
8838
|
-
const
|
|
8858
|
+
const seen2 = bridge.changes?.now();
|
|
8839
8859
|
const stat = () => call3(() => bridge.stat(path()));
|
|
8840
8860
|
const st = stat();
|
|
8841
|
-
const watch = bridge.changes && linkedWatch({ view: bridge.changes, ino: st.ino, seen, stat }, st);
|
|
8861
|
+
const watch = bridge.changes && linkedWatch({ view: bridge.changes, ino: st.ino, seen: seen2, stat }, st);
|
|
8842
8862
|
return new RangedFile(io, path(), st.size, st.version, watch);
|
|
8843
8863
|
}
|
|
8844
8864
|
function unlessIo(op) {
|
|
@@ -9001,18 +9021,18 @@ function relinked(Fs, moving, to) {
|
|
|
9001
9021
|
}
|
|
9002
9022
|
function renameFollower(Fs, bridgeOf, call3) {
|
|
9003
9023
|
const open = new capturedSet();
|
|
9004
|
-
const
|
|
9024
|
+
const seen2 = new capturedMap();
|
|
9005
9025
|
const follow3 = (node, missing2 = false) => {
|
|
9006
9026
|
const bridge = bridgeOf(node);
|
|
9007
9027
|
const view = bridge.changes;
|
|
9008
|
-
const since =
|
|
9028
|
+
const since = seen2.get(bridge);
|
|
9009
9029
|
let now = view?.renames() ?? 0;
|
|
9010
|
-
if (missing2 && view && now === since) now = view.awaitRename(now,
|
|
9030
|
+
if (missing2 && view && now === since) now = view.awaitRename(now, renameWait(view));
|
|
9011
9031
|
const ask = bridge.renames?.bind(bridge);
|
|
9012
9032
|
if (since === void 0 || now === since || !ask) return false;
|
|
9013
9033
|
const held2 = [...open].filter((n) => !n.live.orphan && bridgeOf(n) === bridge);
|
|
9014
9034
|
if (held2.length === 0) {
|
|
9015
|
-
|
|
9035
|
+
seen2.set(bridge, now);
|
|
9016
9036
|
return false;
|
|
9017
9037
|
}
|
|
9018
9038
|
const reply = call3(
|
|
@@ -9021,7 +9041,7 @@ function renameFollower(Fs, bridgeOf, call3) {
|
|
|
9021
9041
|
held2.map((n) => liveNodePath(n))
|
|
9022
9042
|
)
|
|
9023
9043
|
);
|
|
9024
|
-
|
|
9044
|
+
seen2.set(bridge, reply.now);
|
|
9025
9045
|
for (const [from, to] of reply.renames) {
|
|
9026
9046
|
for (const n of held2) {
|
|
9027
9047
|
const moving = heldUnder(n, from);
|
|
@@ -9043,12 +9063,12 @@ function renameFollower(Fs, bridgeOf, call3) {
|
|
|
9043
9063
|
open.add(node);
|
|
9044
9064
|
},
|
|
9045
9065
|
watchRenames(bridge) {
|
|
9046
|
-
if (!
|
|
9066
|
+
if (!seen2.has(bridge)) seen2.set(bridge, bridge.changes?.renames() ?? 0);
|
|
9047
9067
|
},
|
|
9048
9068
|
ownRename(bridge, seq) {
|
|
9049
|
-
const since =
|
|
9069
|
+
const since = seen2.get(bridge);
|
|
9050
9070
|
if (seq !== void 0 && since !== void 0 && seq === (since + 1 | 0))
|
|
9051
|
-
|
|
9071
|
+
seen2.set(bridge, seq);
|
|
9052
9072
|
}
|
|
9053
9073
|
};
|
|
9054
9074
|
}
|
|
@@ -9500,8 +9520,8 @@ function appendThrough(h, stream, bytes) {
|
|
|
9500
9520
|
}
|
|
9501
9521
|
function holdLive(bridge, node, on, want) {
|
|
9502
9522
|
const s = node.live;
|
|
9503
|
-
const
|
|
9504
|
-
return bridge.hold?.(liveNodePath(node), on, true, s.handle, want,
|
|
9523
|
+
const seen2 = on && s.stat ? { gen: s.stat.gen, ...s.stat.ino !== void 0 ? { ino: s.stat.ino } : {} } : void 0;
|
|
9524
|
+
return bridge.hold?.(liveNodePath(node), on, true, s.handle, want, seen2);
|
|
9505
9525
|
}
|
|
9506
9526
|
function dropOpen(s) {
|
|
9507
9527
|
if (s.openCount === 0) return false;
|
|
@@ -10437,10 +10457,10 @@ function syscallOf(glue, name2, value2) {
|
|
|
10437
10457
|
function wrapCloexecSyscalls(imports, glue, deps) {
|
|
10438
10458
|
if (!glue) return;
|
|
10439
10459
|
const factories = wrapperFactories(deps);
|
|
10440
|
-
const
|
|
10460
|
+
const seen2 = new capturedSet();
|
|
10441
10461
|
for (const namespace of capturedObject.values(imports)) {
|
|
10442
|
-
if (!namespace || typeof namespace !== "object" ||
|
|
10443
|
-
|
|
10462
|
+
if (!namespace || typeof namespace !== "object" || seen2.has(namespace)) continue;
|
|
10463
|
+
seen2.add(namespace);
|
|
10444
10464
|
for (const [name2, value2] of capturedObject.entries(namespace)) {
|
|
10445
10465
|
const key = syscallOf(glue, name2, value2);
|
|
10446
10466
|
const wrap2 = key && factories[key];
|
|
@@ -10558,11 +10578,11 @@ function persistsItself(stream) {
|
|
|
10558
10578
|
return typeof type?.syncfs === "function";
|
|
10559
10579
|
}
|
|
10560
10580
|
function namespaces(imports) {
|
|
10561
|
-
const
|
|
10581
|
+
const seen2 = new capturedSet();
|
|
10562
10582
|
for (const namespace of capturedObject.values(imports)) {
|
|
10563
|
-
if (namespace && typeof namespace === "object")
|
|
10583
|
+
if (namespace && typeof namespace === "object") seen2.add(namespace);
|
|
10564
10584
|
}
|
|
10565
|
-
return [...
|
|
10585
|
+
return [...seen2];
|
|
10566
10586
|
}
|
|
10567
10587
|
function keyOf(namespace, name2, glue) {
|
|
10568
10588
|
const own2 = glue?.[name2];
|
|
@@ -11755,13 +11775,13 @@ function frozen(bytes) {
|
|
|
11755
11775
|
}
|
|
11756
11776
|
function physicalProc(fs, now = () => capturedperformance.now()) {
|
|
11757
11777
|
const view = fs.changes;
|
|
11758
|
-
let
|
|
11778
|
+
let seen2;
|
|
11759
11779
|
return () => {
|
|
11760
|
-
if (
|
|
11761
|
-
const proc = view.changedSince(
|
|
11762
|
-
if (!proc.changed && !view.changedSince(
|
|
11763
|
-
|
|
11764
|
-
return
|
|
11780
|
+
if (seen2 && view && (!view.foreign() || now() - seen2.at < SHARED_TTL_MS)) {
|
|
11781
|
+
const proc = view.changedSince(seen2.gen, "/proc");
|
|
11782
|
+
if (!proc.changed && !view.changedSince(seen2.gen, "/").changed) {
|
|
11783
|
+
seen2.gen = proc.now;
|
|
11784
|
+
return seen2.physical;
|
|
11765
11785
|
}
|
|
11766
11786
|
}
|
|
11767
11787
|
const gen = view?.now();
|
|
@@ -11773,12 +11793,12 @@ function physicalProc(fs, now = () => capturedperformance.now()) {
|
|
|
11773
11793
|
} catch (err) {
|
|
11774
11794
|
const code2 = err.code;
|
|
11775
11795
|
if (code2 !== "ENOENT" && code2 !== "ENOTDIR") {
|
|
11776
|
-
|
|
11796
|
+
seen2 = void 0;
|
|
11777
11797
|
return false;
|
|
11778
11798
|
}
|
|
11779
11799
|
physical2 = false;
|
|
11780
11800
|
}
|
|
11781
|
-
|
|
11801
|
+
seen2 = gen === void 0 ? void 0 : { gen, physical: physical2, at };
|
|
11782
11802
|
return physical2;
|
|
11783
11803
|
};
|
|
11784
11804
|
}
|
|
@@ -11946,10 +11966,10 @@ function procfsBridge(fs, tree) {
|
|
|
11946
11966
|
],
|
|
11947
11967
|
() => fs.link(from, to, follow3)
|
|
11948
11968
|
),
|
|
11949
|
-
hold: (p, held2, open, handle, want,
|
|
11969
|
+
hold: (p, held2, open, handle, want, seen2) => {
|
|
11950
11970
|
if (handle !== void 0 && snapshots.delete(handle)) return void 0;
|
|
11951
11971
|
if (!held2) return fs.hold?.(p, held2, open, handle);
|
|
11952
|
-
return via(p, snapshot2, () => fs.hold?.(p, held2, open, void 0, want,
|
|
11972
|
+
return via(p, snapshot2, () => fs.hold?.(p, held2, open, void 0, want, seen2) ?? late(p));
|
|
11953
11973
|
},
|
|
11954
11974
|
kept: (handle) => snapshots.has(handle) || fs.kept?.(handle) === true,
|
|
11955
11975
|
escape: (p) => inProc(p) ? current(fs, tree, p) : void 0,
|
|
@@ -14033,12 +14053,12 @@ function restarted2(issue) {
|
|
|
14033
14053
|
}
|
|
14034
14054
|
function forkRestarted(deps, state, snapshotAt) {
|
|
14035
14055
|
let memory = state.memory;
|
|
14036
|
-
let
|
|
14056
|
+
let seen2 = snapshotAt;
|
|
14037
14057
|
return restarted2(() => {
|
|
14038
14058
|
const streams2 = deps.describeFork();
|
|
14039
14059
|
const now = deps.deliveries?.();
|
|
14040
|
-
if (now !==
|
|
14041
|
-
|
|
14060
|
+
if (now !== seen2) {
|
|
14061
|
+
seen2 = now;
|
|
14042
14062
|
const live = deps.memory?.();
|
|
14043
14063
|
if (live) memory = new capturedUint8Array(live.buffer).slice();
|
|
14044
14064
|
}
|
|
@@ -18236,13 +18256,13 @@ var init_wasix_linker = __esm({
|
|
|
18236
18256
|
}
|
|
18237
18257
|
return void 0;
|
|
18238
18258
|
}
|
|
18239
|
-
findIn(m, name2,
|
|
18240
|
-
if (
|
|
18241
|
-
|
|
18259
|
+
findIn(m, name2, seen2) {
|
|
18260
|
+
if (seen2.has(m.handle)) return void 0;
|
|
18261
|
+
seen2.add(m.handle);
|
|
18242
18262
|
const v = m.instance.exports[name2];
|
|
18243
18263
|
if (v !== void 0) return [m.handle, v];
|
|
18244
18264
|
for (const h of m.needed) {
|
|
18245
|
-
const found2 = this.findIn(this.module(h), name2,
|
|
18265
|
+
const found2 = this.findIn(this.module(h), name2, seen2);
|
|
18246
18266
|
if (found2) return found2;
|
|
18247
18267
|
}
|
|
18248
18268
|
return void 0;
|
|
@@ -19739,11 +19759,20 @@ function keptFrames(trace) {
|
|
|
19739
19759
|
}
|
|
19740
19760
|
var formatter = null;
|
|
19741
19761
|
var formatting = false;
|
|
19742
|
-
var
|
|
19743
|
-
function
|
|
19762
|
+
var seen = new capturedWeakMap();
|
|
19763
|
+
function positionsAt(positions, error, site) {
|
|
19764
|
+
if (positions === void 0 || !keptFrame(site)) return void 0;
|
|
19765
|
+
try {
|
|
19766
|
+
return positions(error);
|
|
19767
|
+
} catch {
|
|
19768
|
+
return void 0;
|
|
19769
|
+
}
|
|
19770
|
+
}
|
|
19771
|
+
function stackDispatcher(fallback, positions) {
|
|
19744
19772
|
return (error, trace) => {
|
|
19745
19773
|
if (typeof error === "object" && error !== null && trace.length > 0) {
|
|
19746
|
-
|
|
19774
|
+
const site = trace[0];
|
|
19775
|
+
apply(mapSet, seen, [error, { site, at: positionsAt(positions, error, site) }]);
|
|
19747
19776
|
}
|
|
19748
19777
|
const fn = formatter;
|
|
19749
19778
|
if (fn === null || formatting) return apply(fallback, void 0, [error, trace]);
|
|
@@ -19759,7 +19788,7 @@ function stackDispatcher(fallback) {
|
|
|
19759
19788
|
};
|
|
19760
19789
|
}
|
|
19761
19790
|
var found = internals();
|
|
19762
|
-
if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback));
|
|
19791
|
+
if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback, found.positions));
|
|
19763
19792
|
var nodeStackFormatter = found ? (fn) => {
|
|
19764
19793
|
if (fn !== null && typeof fn !== "function") {
|
|
19765
19794
|
throw new capturedTypeError("setStackFormatter needs a function or null");
|
|
@@ -19768,16 +19797,16 @@ var nodeStackFormatter = found ? (fn) => {
|
|
|
19768
19797
|
formatter = fn;
|
|
19769
19798
|
return previous;
|
|
19770
19799
|
} : void 0;
|
|
19771
|
-
function errorSourceOf(
|
|
19800
|
+
function errorSourceOf(error) {
|
|
19772
19801
|
if (typeof error !== "object" || error === null || !isNativeError(error)) return void 0;
|
|
19773
19802
|
try {
|
|
19774
19803
|
void error.stack;
|
|
19775
19804
|
} catch {
|
|
19776
19805
|
return void 0;
|
|
19777
19806
|
}
|
|
19778
|
-
const
|
|
19779
|
-
if (
|
|
19780
|
-
const at =
|
|
19807
|
+
const got = apply(mapGet, seen, [error]);
|
|
19808
|
+
if (got === void 0 || !keptFrame(got.site)) return void 0;
|
|
19809
|
+
const { site, at } = got;
|
|
19781
19810
|
if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
|
|
19782
19811
|
return void 0;
|
|
19783
19812
|
if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
|
|
@@ -19789,8 +19818,7 @@ function errorSourceOf(positions2, error) {
|
|
|
19789
19818
|
out.startColumn = typeof at.startColumn === "number" ? at.startColumn : 0;
|
|
19790
19819
|
return freeze(out);
|
|
19791
19820
|
}
|
|
19792
|
-
var
|
|
19793
|
-
var nodeErrorSource = positions ? (error) => errorSourceOf(positions, error) : void 0;
|
|
19821
|
+
var nodeErrorSource = found?.positions ? errorSourceOf : void 0;
|
|
19794
19822
|
|
|
19795
19823
|
// src/node-lockdown.ts
|
|
19796
19824
|
init_lockdown();
|