@ai-ecoverse/slicc-kernel 1.125.1 → 1.125.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 +12 -2
- package/dist/kernel-worker.js +220 -82
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +130 -50
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +223 -85
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +130 -50
- package/dist/process-worker.js.map +3 -3
- package/dist/types/kernel/net/tls-chain.d.ts +2 -0
- package/dist/types/kernel/net/tls-client.d.ts +1 -0
- package/dist/types/kernel/net/tls-engine.d.ts +2 -1
- package/dist/types/kernel/net/tls-uplink.d.ts +1 -0
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +3 -0
- package/dist/types/process/wasi/wasi-host.d.ts +2 -0
- package/dist/types/realm/sync-fs-token-registry.d.ts +3 -0
- package/dist/types/realm/sync-fs-wire.d.ts +6 -1
- package/dist/types/realm/sync-sab-bridge.d.ts +1 -0
- package/package.json +1 -1
|
@@ -747,6 +747,17 @@ function index(map, key, path) {
|
|
|
747
747
|
paths.add(path);
|
|
748
748
|
map.set(key, paths);
|
|
749
749
|
}
|
|
750
|
+
function goneAbove(maps, live, path) {
|
|
751
|
+
for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
|
|
752
|
+
const up = path.slice(0, at);
|
|
753
|
+
for (const map of maps) {
|
|
754
|
+
const hit = map.get(up);
|
|
755
|
+
const code2 = hit && "until" in hit ? hit.error.code : void 0;
|
|
756
|
+
if (hit && "until" in hit && code2 === "ENOENT" && live(hit, up)) return hit;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return void 0;
|
|
760
|
+
}
|
|
750
761
|
function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
751
762
|
const blind = shared !== void 0 && shared.length * 4 < SHARED_IDS_BYTES;
|
|
752
763
|
const cache = new StatCache(blind ? void 0 : shared);
|
|
@@ -754,17 +765,8 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
754
765
|
const view = bridge.changes;
|
|
755
766
|
const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
756
767
|
const seen = new SeenAt(view, lstats);
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
const up = path.slice(0, at);
|
|
760
|
-
for (const map of [lstats, stats]) {
|
|
761
|
-
const hit = map.get(up);
|
|
762
|
-
const code2 = hit && "until" in hit ? hit.error.code : void 0;
|
|
763
|
-
if (hit && "until" in hit && code2 === "ENOENT" && live(hit, up)) return hit;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
return void 0;
|
|
767
|
-
};
|
|
768
|
+
const kept = remember(cache, seen, blind);
|
|
769
|
+
const gone = (path) => goneAbove([lstats, stats], live, path);
|
|
768
770
|
const cached = (map, path, get) => {
|
|
769
771
|
if (blind || view?.foreign()) return get();
|
|
770
772
|
cache.fresh();
|
|
@@ -890,7 +892,10 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
890
892
|
...bridge.keptStat ? { keptStat: bridge.keptStat.bind(bridge) } : {},
|
|
891
893
|
...bridge.pinned ? { pinned: (handle) => pinnedIo(bridge, handle, rewriting) } : {},
|
|
892
894
|
...bridge.create ? {
|
|
893
|
-
create: (p, mode, opening2) =>
|
|
895
|
+
create: (p, mode, opening2) => kept(
|
|
896
|
+
p,
|
|
897
|
+
mutating(() => bridge.create?.(p, mode, opening2), ...entry(p))
|
|
898
|
+
)
|
|
894
899
|
} : {},
|
|
895
900
|
...bridge.mkfifo ? {
|
|
896
901
|
mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
|
|
@@ -927,7 +932,7 @@ function pinnedIo(bridge, handle, rewriting) {
|
|
|
927
932
|
} : {}
|
|
928
933
|
};
|
|
929
934
|
}
|
|
930
|
-
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;
|
|
935
|
+
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, remember;
|
|
931
936
|
var init_wasi_files = __esm({
|
|
932
937
|
"src/process/wasi/wasi-files.ts"() {
|
|
933
938
|
"use strict";
|
|
@@ -1317,6 +1322,13 @@ var init_wasi_files = __esm({
|
|
|
1317
1322
|
return since.changed;
|
|
1318
1323
|
}
|
|
1319
1324
|
};
|
|
1325
|
+
remember = (cache, seen, blind) => (path, made) => {
|
|
1326
|
+
if (!made || blind) return made;
|
|
1327
|
+
const { seen: at, ...st } = made;
|
|
1328
|
+
cache.put(cache.stats, path, st);
|
|
1329
|
+
if (at !== void 0) seen.saw(cache.stats, path, at);
|
|
1330
|
+
return made;
|
|
1331
|
+
};
|
|
1320
1332
|
}
|
|
1321
1333
|
});
|
|
1322
1334
|
|
|
@@ -1369,7 +1381,8 @@ function decodeSabResult(status2, payload) {
|
|
|
1369
1381
|
try {
|
|
1370
1382
|
const parsed = JSON.parse(decoder.decode(payload));
|
|
1371
1383
|
const errno2 = typeof parsed.errno === "string" && /^E[A-Z]+$|^EAI_[A-Z]+$/.test(parsed.errno) ? parsed.errno : "EIO";
|
|
1372
|
-
|
|
1384
|
+
const message2 = String(parsed.message ?? errno2);
|
|
1385
|
+
return parsed.direct === true ? { ok: false, errno: errno2, message: message2, direct: true } : { ok: false, errno: errno2, message: message2 };
|
|
1373
1386
|
} catch {
|
|
1374
1387
|
return { ok: false, errno: "EIO", message: "sync-sab: malformed errno payload" };
|
|
1375
1388
|
}
|
|
@@ -3431,6 +3444,8 @@ var init_wasi_fds = __esm({
|
|
|
3431
3444
|
return openDevice2.call(this.kernel.sys, flags);
|
|
3432
3445
|
}
|
|
3433
3446
|
open(path, oflags, rights, fdflags, mode) {
|
|
3447
|
+
this.made = void 0;
|
|
3448
|
+
this.created = false;
|
|
3434
3449
|
const device2 = deviceOf(path);
|
|
3435
3450
|
if (device2) return this.install({ type: "device", device: device2 });
|
|
3436
3451
|
const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
|
|
@@ -3438,8 +3453,8 @@ var init_wasi_fds = __esm({
|
|
|
3438
3453
|
const alias = stdioAlias(path);
|
|
3439
3454
|
if (alias !== void 0) return this.reopen(alias);
|
|
3440
3455
|
const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
|
|
3441
|
-
if (exclusive &&
|
|
3442
|
-
return this.
|
|
3456
|
+
if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
3457
|
+
return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
|
|
3443
3458
|
}
|
|
3444
3459
|
if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
|
|
3445
3460
|
const s = this.statOrMissing(path);
|
|
@@ -3456,15 +3471,15 @@ var init_wasi_fds = __esm({
|
|
|
3456
3471
|
refuseWrite(s, oflags, rights);
|
|
3457
3472
|
return this.regular(path, s, oflags, rights, fdflags, mode);
|
|
3458
3473
|
}
|
|
3459
|
-
regular(path, s, oflags, rights, fdflags, mode) {
|
|
3474
|
+
regular(path, s, oflags, rights, fdflags, mode, created = false) {
|
|
3460
3475
|
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
3461
3476
|
if (s?.isSocket) throw new WasiError("ENXIO");
|
|
3462
3477
|
if (this.shared || this.kernelHolds(path, s)) {
|
|
3463
|
-
return this.kernelFile(path, s, oflags, rights, fdflags, mode);
|
|
3478
|
+
return this.kernelFile(path, s, oflags, rights, fdflags, mode, created);
|
|
3464
3479
|
}
|
|
3465
3480
|
return this.install({
|
|
3466
3481
|
type: "file",
|
|
3467
|
-
file: this.file(path, s, oflags, rights, fdflags, mode)
|
|
3482
|
+
file: this.file(path, s, oflags, rights, fdflags, mode, created)
|
|
3468
3483
|
});
|
|
3469
3484
|
}
|
|
3470
3485
|
kernelHolds(path, st) {
|
|
@@ -3487,9 +3502,9 @@ var init_wasi_fds = __esm({
|
|
|
3487
3502
|
} catch {
|
|
3488
3503
|
}
|
|
3489
3504
|
}
|
|
3490
|
-
file(path, existing, oflags, rights, fdflags, mode) {
|
|
3505
|
+
file(path, existing, oflags, rights, fdflags, mode, created = false) {
|
|
3491
3506
|
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
3492
|
-
let buffer = this.buffers.get(path);
|
|
3507
|
+
let buffer = created ? void 0 : this.buffers.get(path);
|
|
3493
3508
|
if (buffer?.handle !== void 0 && this.fs.kept?.(buffer.handle)) {
|
|
3494
3509
|
this.buffers.delete(path);
|
|
3495
3510
|
buffer = void 0;
|
|
@@ -3500,19 +3515,21 @@ var init_wasi_fds = __esm({
|
|
|
3500
3515
|
if (this.fs.owners) this.fs.access?.(path, want, "open");
|
|
3501
3516
|
if (oflags & OFLAGS.TRUNC) buffer.truncate(0);
|
|
3502
3517
|
} else {
|
|
3503
|
-
buffer = this.freshBuffer(path, existing, oflags, want, mode);
|
|
3518
|
+
buffer = this.freshBuffer(path, existing, oflags, want, mode, created);
|
|
3504
3519
|
}
|
|
3505
3520
|
buffer.opens++;
|
|
3506
3521
|
const file = new LocalFile(buffer, readable3, writable2, (fdflags & FDFLAGS.APPEND) !== 0);
|
|
3507
3522
|
file.ino = existing?.ino;
|
|
3508
3523
|
return file;
|
|
3509
3524
|
}
|
|
3510
|
-
freshBuffer(path, existing, oflags, want, mode) {
|
|
3511
|
-
const made = !existing && this.createNew(path, oflags, mode);
|
|
3525
|
+
freshBuffer(path, existing, oflags, want, mode, created = false) {
|
|
3526
|
+
const made = created || !existing && this.createNew(path, oflags, mode);
|
|
3527
|
+
const reply = made ? this.made : void 0;
|
|
3528
|
+
this.made = void 0;
|
|
3512
3529
|
const empty = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
3513
3530
|
if (existing?.ranged) this.fs.invalidate?.();
|
|
3514
|
-
const seen = this.fs.changes?.now();
|
|
3515
|
-
const st = existing?.ranged || !existing ? this.fs.stat(path) : existing;
|
|
3531
|
+
const seen = reply ? reply.seen : this.fs.changes?.now();
|
|
3532
|
+
const st = reply?.st ?? (existing?.ranged || !existing ? this.fs.stat(path) : existing);
|
|
3516
3533
|
const ranged = st.ranged ? st.size : void 0;
|
|
3517
3534
|
const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
|
|
3518
3535
|
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0, {
|
|
@@ -3579,10 +3596,17 @@ var init_wasi_fds = __esm({
|
|
|
3579
3596
|
}
|
|
3580
3597
|
}
|
|
3581
3598
|
}
|
|
3599
|
+
created = false;
|
|
3600
|
+
made;
|
|
3601
|
+
creating(path, mode) {
|
|
3602
|
+
const st = this.fs.create?.(path, mode, true);
|
|
3603
|
+
this.made = st ? { st, seen: st.seen } : void 0;
|
|
3604
|
+
this.created = true;
|
|
3605
|
+
}
|
|
3582
3606
|
madeAtOnce(path, mode) {
|
|
3583
3607
|
if (!this.fs.create) return false;
|
|
3584
3608
|
try {
|
|
3585
|
-
this.
|
|
3609
|
+
this.creating(path, mode);
|
|
3586
3610
|
return true;
|
|
3587
3611
|
} catch (err) {
|
|
3588
3612
|
if (err.code === "EEXIST") throw err;
|
|
@@ -3592,10 +3616,11 @@ var init_wasi_fds = __esm({
|
|
|
3592
3616
|
createNew(path, oflags, mode) {
|
|
3593
3617
|
if (!this.fs.create) {
|
|
3594
3618
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
3619
|
+
this.created = true;
|
|
3595
3620
|
return true;
|
|
3596
3621
|
}
|
|
3597
3622
|
try {
|
|
3598
|
-
this.
|
|
3623
|
+
this.creating(path, mode);
|
|
3599
3624
|
return true;
|
|
3600
3625
|
} catch (err) {
|
|
3601
3626
|
if (oflags & OFLAGS.EXCL || err.code !== "EEXIST") throw err;
|
|
@@ -4804,7 +4829,11 @@ var init_wasi_host = __esm({
|
|
|
4804
4829
|
}
|
|
4805
4830
|
if (this.synthetic(path)) return ROOT_IDS;
|
|
4806
4831
|
if (kernelDev(path)) return devSync(dev, devStat(path, follow3));
|
|
4807
|
-
return
|
|
4832
|
+
return this.orDev(
|
|
4833
|
+
path,
|
|
4834
|
+
follow3,
|
|
4835
|
+
() => follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path)
|
|
4836
|
+
);
|
|
4808
4837
|
};
|
|
4809
4838
|
return wrap({
|
|
4810
4839
|
fd_chown: (fd, uid, gid) => {
|
|
@@ -4883,7 +4912,16 @@ var init_wasi_host = __esm({
|
|
|
4883
4912
|
const node = devSync(dev, devStat(path, (flags & AT_SYMLINK_NOFOLLOW) === 0));
|
|
4884
4913
|
return void mem.view().setUint32(out, node.mode ?? DEVICE_MODE, true);
|
|
4885
4914
|
}
|
|
4886
|
-
const
|
|
4915
|
+
const follow3 = (flags & AT_SYMLINK_NOFOLLOW) === 0;
|
|
4916
|
+
let st;
|
|
4917
|
+
try {
|
|
4918
|
+
st = follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
|
|
4919
|
+
} catch (err) {
|
|
4920
|
+
const device2 = this.orDev(path, follow3, () => {
|
|
4921
|
+
throw err;
|
|
4922
|
+
});
|
|
4923
|
+
return void mem.view().setUint32(out, device2.mode ?? DEVICE_MODE, true);
|
|
4924
|
+
}
|
|
4887
4925
|
mem.view().setUint32(out, (st.isFifo ? S_IFIFO : 0) | modeOf2(st), true);
|
|
4888
4926
|
}
|
|
4889
4927
|
});
|
|
@@ -5207,9 +5245,8 @@ var init_wasi_host = __esm({
|
|
|
5207
5245
|
if (alias && !alias.stdio) this.openFd(alias.fd);
|
|
5208
5246
|
const path = alias && !alias.stdio ? `/dev/fd/${alias.fd}` : asked;
|
|
5209
5247
|
if (deviceOf(path)) this.interrupted?.();
|
|
5210
|
-
const fresh = (oflags & OFLAGS.CREAT) !== 0 && !this.synthetic(path) && !o.fs.exists(path);
|
|
5211
5248
|
mem.view().setUint32(out, fds.open(path, oflags, rights, fdflags), true);
|
|
5212
|
-
if (
|
|
5249
|
+
if (fds.created) this.created(path, 438);
|
|
5213
5250
|
} catch (err) {
|
|
5214
5251
|
if (err.code !== "ENOENT") throw err;
|
|
5215
5252
|
const raw = mem.string(p, l);
|
|
@@ -5594,6 +5631,21 @@ var init_wasi_host = __esm({
|
|
|
5594
5631
|
synthetic(path) {
|
|
5595
5632
|
return deviceOf(path) !== void 0 || path === SEALED_PATH && !!this.o.kernel.sys.openSealed || path === CLIPBOARD_PATH && !!this.o.kernel.sys.openClipboard;
|
|
5596
5633
|
}
|
|
5634
|
+
linkedDev(path, follow3) {
|
|
5635
|
+
if (!follow3) return void 0;
|
|
5636
|
+
const real = physicalPath(this.o.fs, path);
|
|
5637
|
+
return real !== path && kernelDev(real) ? real : void 0;
|
|
5638
|
+
}
|
|
5639
|
+
orDev(path, follow3, stat) {
|
|
5640
|
+
try {
|
|
5641
|
+
return stat();
|
|
5642
|
+
} catch (err) {
|
|
5643
|
+
const device2 = err.code === "ENOENT" && this.linkedDev(path, follow3);
|
|
5644
|
+
if (!device2) throw err;
|
|
5645
|
+
const json2 = (req) => this.o.kernel.call(req);
|
|
5646
|
+
return devSync({ json: json2 }, devStat(device2, true));
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5597
5649
|
devChar(path, follow3) {
|
|
5598
5650
|
try {
|
|
5599
5651
|
const json2 = (req) => this.o.kernel.call(req);
|
|
@@ -5701,11 +5753,12 @@ var init_wasi_host = __esm({
|
|
|
5701
5753
|
return filestatOf(path, follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path));
|
|
5702
5754
|
} catch (err) {
|
|
5703
5755
|
if (err.code !== "ENOENT") throw err;
|
|
5704
|
-
|
|
5756
|
+
const device2 = kernelDev(path) ? path : this.linkedDev(path, follow3);
|
|
5757
|
+
if (device2 && this.devChar(device2, true)) {
|
|
5705
5758
|
return this.local({
|
|
5706
5759
|
filetype: FILETYPE.CHARACTER_DEVICE,
|
|
5707
5760
|
size: 0n,
|
|
5708
|
-
ino: pathInode(
|
|
5761
|
+
ino: pathInode(device2),
|
|
5709
5762
|
mtimeNs: 0n
|
|
5710
5763
|
});
|
|
5711
5764
|
}
|
|
@@ -6271,7 +6324,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
6271
6324
|
var init_version = __esm({
|
|
6272
6325
|
"src/version.ts"() {
|
|
6273
6326
|
"use strict";
|
|
6274
|
-
KERNEL_VERSION = true ? "1.125.
|
|
6327
|
+
KERNEL_VERSION = true ? "1.125.3" : "0.0.0-dev";
|
|
6275
6328
|
OS_RELEASE = "6.0.0-slicc";
|
|
6276
6329
|
}
|
|
6277
6330
|
});
|
|
@@ -7115,7 +7168,8 @@ function controlsOf(r) {
|
|
|
7115
7168
|
clientCertificate: r.clientCertificate === true,
|
|
7116
7169
|
sni: r.sni !== false,
|
|
7117
7170
|
hostnameChecked: r.hostnameChecked === true,
|
|
7118
|
-
...r.hostnameMatches === void 0 ? {} : { hostnameMatches: r.hostnameMatches }
|
|
7171
|
+
...r.hostnameMatches === void 0 ? {} : { hostnameMatches: r.hostnameMatches },
|
|
7172
|
+
...r.chainError ? { chainError: r.chainError } : {}
|
|
7119
7173
|
};
|
|
7120
7174
|
}
|
|
7121
7175
|
function sessionOf(r) {
|
|
@@ -7141,13 +7195,17 @@ function sessionOf(r) {
|
|
|
7141
7195
|
...controlsOf(r)
|
|
7142
7196
|
});
|
|
7143
7197
|
}
|
|
7198
|
+
function withAlert(err) {
|
|
7199
|
+
const alert = ALERT.exec(err.detail ?? "")?.[1];
|
|
7200
|
+
return alert === void 0 ? err : Object.assign(err, { alert: Number(alert) });
|
|
7201
|
+
}
|
|
7144
7202
|
async function secureCall(call2, what = "connect") {
|
|
7145
7203
|
try {
|
|
7146
7204
|
return await call2();
|
|
7147
7205
|
} catch (err) {
|
|
7148
7206
|
const e = err;
|
|
7149
7207
|
const code2 = e.code === "EPROTO" && e.detail ? TLS_CODE.exec(e.detail)?.[1] : void 0;
|
|
7150
|
-
if (code2) throw new JsCallError(code2, what, e.detail);
|
|
7208
|
+
if (code2) throw withAlert(new JsCallError(code2, what, e.detail));
|
|
7151
7209
|
throw err;
|
|
7152
7210
|
}
|
|
7153
7211
|
}
|
|
@@ -7315,7 +7373,7 @@ function netOps(kernel, io) {
|
|
|
7315
7373
|
}
|
|
7316
7374
|
};
|
|
7317
7375
|
}
|
|
7318
|
-
var PEM, TLS_CODE, SHUT_RD, SHUT_WR, IPV4, NEVER, SOL_SOCKET2, SO_ERROR2;
|
|
7376
|
+
var PEM, TLS_CODE, ALERT, SHUT_RD, SHUT_WR, IPV4, NEVER, SOL_SOCKET2, SO_ERROR2;
|
|
7319
7377
|
var init_js_net = __esm({
|
|
7320
7378
|
"src/process/js/js-net.ts"() {
|
|
7321
7379
|
"use strict";
|
|
@@ -7323,6 +7381,7 @@ var init_js_net = __esm({
|
|
|
7323
7381
|
init_js_kernel();
|
|
7324
7382
|
PEM = /-----BEGIN CERTIFICATE-----([\s\S]*?)-----END CERTIFICATE-----/g;
|
|
7325
7383
|
TLS_CODE = /^([A-Z][A-Z0-9_]+): /;
|
|
7384
|
+
ALERT = / \(alert (\d+)\)$/;
|
|
7326
7385
|
SHUT_RD = 0;
|
|
7327
7386
|
SHUT_WR = 1;
|
|
7328
7387
|
IPV4 = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
|
|
@@ -7541,10 +7600,12 @@ function createSyncSabTransport(sab, port3, deps = {}) {
|
|
|
7541
7600
|
}
|
|
7542
7601
|
};
|
|
7543
7602
|
}
|
|
7544
|
-
function errnoError(code2, path) {
|
|
7545
|
-
|
|
7603
|
+
function errnoError(code2, path, direct) {
|
|
7604
|
+
const err = syncError(code2, `sync-sab bridge, '${path}'`);
|
|
7605
|
+
return direct ? Object.assign(err, { direct }) : err;
|
|
7546
7606
|
}
|
|
7547
7607
|
function createSyncFsSabBridge(transport, opts = {}) {
|
|
7608
|
+
const direct = opts.direct ? { direct: true } : {};
|
|
7548
7609
|
const timeoutMs2 = opts.timeoutMs ?? SYNC_FS_REQUEST_TIMEOUT_MS;
|
|
7549
7610
|
let identity = {};
|
|
7550
7611
|
let once = false;
|
|
@@ -7553,7 +7614,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
7553
7614
|
last = null;
|
|
7554
7615
|
const silence = SYNC_FS_READ_ONLY.has(req.op) ? timeoutMs2 : Number.POSITIVE_INFINITY;
|
|
7555
7616
|
const result = transport.call(req, silence, `sync-sab bridge, '${path}'`, transfer);
|
|
7556
|
-
if (!result.ok) throw errnoError(result.errno, path);
|
|
7617
|
+
if (!result.ok) throw errnoError(result.errno, path, result.direct);
|
|
7557
7618
|
return result;
|
|
7558
7619
|
}
|
|
7559
7620
|
function bytes(req, path) {
|
|
@@ -7599,12 +7660,12 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
7599
7660
|
return s;
|
|
7600
7661
|
},
|
|
7601
7662
|
stat: (path) => {
|
|
7602
|
-
const s = parseSyncFsStat(json2({ op: "stat", path }, path));
|
|
7663
|
+
const s = parseSyncFsStat(json2({ op: "stat", path, ...direct }, path));
|
|
7603
7664
|
if (!s) throw errnoError("EIO", path);
|
|
7604
7665
|
return s;
|
|
7605
7666
|
},
|
|
7606
7667
|
lstat: (path) => {
|
|
7607
|
-
const s = parseSyncFsStat(json2({ op: "lstat", path }, path));
|
|
7668
|
+
const s = parseSyncFsStat(json2({ op: "lstat", path, ...direct }, path));
|
|
7608
7669
|
if (!s) throw errnoError("EIO", path);
|
|
7609
7670
|
return s;
|
|
7610
7671
|
},
|
|
@@ -7682,7 +7743,12 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
7682
7743
|
},
|
|
7683
7744
|
create: (path, mode, opening2) => {
|
|
7684
7745
|
const flags = { ...mode !== void 0 ? { mode } : {}, ...opening2 ? { opening: opening2 } : {} };
|
|
7685
|
-
run({ op: "create", path, ...flags }, path);
|
|
7746
|
+
const r = run({ op: "create", path, ...flags, identity: true }, path);
|
|
7747
|
+
if (!r.ok || r.kind !== "json") return void 0;
|
|
7748
|
+
const st = parseSyncFsStat(r.json);
|
|
7749
|
+
if (!st) return void 0;
|
|
7750
|
+
const { seen } = r.json;
|
|
7751
|
+
return typeof seen === "number" ? { ...st, seen } : st;
|
|
7686
7752
|
},
|
|
7687
7753
|
chown: (path, uid, gid, follow3, handle) => {
|
|
7688
7754
|
const ids = { ...uid !== void 0 ? { uid } : {}, ...gid !== void 0 ? { gid } : {} };
|
|
@@ -10299,15 +10365,15 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
10299
10365
|
};
|
|
10300
10366
|
const track = (stream, names) => {
|
|
10301
10367
|
let current = names;
|
|
10302
|
-
const
|
|
10303
|
-
|
|
10368
|
+
const remember2 = (list) => scans.set(stream, new Set(list.filter((n) => /^[1-9]\d*$/.test(n)).map(Number)));
|
|
10369
|
+
remember2(current ?? []);
|
|
10304
10370
|
Object.defineProperty(stream, "getdents", {
|
|
10305
10371
|
configurable: true,
|
|
10306
10372
|
enumerable: true,
|
|
10307
10373
|
get: () => current,
|
|
10308
10374
|
set: (next2) => {
|
|
10309
10375
|
current = next2;
|
|
10310
|
-
if (next2)
|
|
10376
|
+
if (next2) remember2(next2);
|
|
10311
10377
|
}
|
|
10312
10378
|
});
|
|
10313
10379
|
};
|
|
@@ -10492,6 +10558,10 @@ function physicalProc(fs) {
|
|
|
10492
10558
|
return physical2;
|
|
10493
10559
|
};
|
|
10494
10560
|
}
|
|
10561
|
+
function directMiss(err, path) {
|
|
10562
|
+
if (err?.direct !== true) return false;
|
|
10563
|
+
return !path.split("/").some((part) => part === "." || part === "..");
|
|
10564
|
+
}
|
|
10495
10565
|
function procfsBridge(fs, tree) {
|
|
10496
10566
|
const toProc = (path, follow3) => procPath(fs, path, follow3);
|
|
10497
10567
|
const shadowing = physicalProc(fs);
|
|
@@ -10504,6 +10574,7 @@ function procfsBridge(fs, tree) {
|
|
|
10504
10574
|
try {
|
|
10505
10575
|
return own();
|
|
10506
10576
|
} catch (err) {
|
|
10577
|
+
if (directMiss(err, p)) throw err;
|
|
10507
10578
|
const real = toProc(p, follow3);
|
|
10508
10579
|
if (real === void 0) throw err;
|
|
10509
10580
|
return proc(real);
|
|
@@ -10564,7 +10635,12 @@ function procfsBridge(fs, tree) {
|
|
|
10564
10635
|
const real = shadowing() ? probe() : void 0;
|
|
10565
10636
|
if (real === null) return false;
|
|
10566
10637
|
if (real !== void 0) return tree.exists(real);
|
|
10567
|
-
|
|
10638
|
+
try {
|
|
10639
|
+
fs.stat(p);
|
|
10640
|
+
return true;
|
|
10641
|
+
} catch (err) {
|
|
10642
|
+
if (directMiss(err, p)) return false;
|
|
10643
|
+
}
|
|
10568
10644
|
const late2 = probe();
|
|
10569
10645
|
return typeof late2 === "string" && tree.exists(late2);
|
|
10570
10646
|
},
|
|
@@ -16923,7 +16999,7 @@ async function runWasiProcess(init, port3) {
|
|
|
16923
16999
|
kernel: { sys: traced(stats, "kernel", sys), call: call2 },
|
|
16924
17000
|
fs: procfsBridge(
|
|
16925
17001
|
cachingBridge(
|
|
16926
|
-
traced(stats, "fs", createSyncFsSabBridge(transport, ownersOf(init))),
|
|
17002
|
+
traced(stats, "fs", createSyncFsSabBridge(transport, { ...ownersOf(init), direct: true })),
|
|
16927
17003
|
void 0,
|
|
16928
17004
|
threads?.ids
|
|
16929
17005
|
),
|
|
@@ -17028,7 +17104,11 @@ async function runWasiThread(init, port3) {
|
|
|
17028
17104
|
parent: () => identify(transport, init).ppid,
|
|
17029
17105
|
kernel: { sys, call: call2 },
|
|
17030
17106
|
fs: procfsBridge(
|
|
17031
|
-
cachingBridge(
|
|
17107
|
+
cachingBridge(
|
|
17108
|
+
createSyncFsSabBridge(transport, { ...ownersOf(init), direct: true }),
|
|
17109
|
+
void 0,
|
|
17110
|
+
threads.ids
|
|
17111
|
+
),
|
|
17032
17112
|
procTree(call2, id.pid)
|
|
17033
17113
|
),
|
|
17034
17114
|
shared: threads.ids
|