@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
package/dist/process-worker.js
CHANGED
|
@@ -135,7 +135,8 @@ function decodeSabResult(status2, payload) {
|
|
|
135
135
|
try {
|
|
136
136
|
const parsed = JSON.parse(decoder.decode(payload));
|
|
137
137
|
const errno2 = typeof parsed.errno === "string" && /^E[A-Z]+$|^EAI_[A-Z]+$/.test(parsed.errno) ? parsed.errno : "EIO";
|
|
138
|
-
|
|
138
|
+
const message2 = String(parsed.message ?? errno2);
|
|
139
|
+
return parsed.direct === true ? { ok: false, errno: errno2, message: message2, direct: true } : { ok: false, errno: errno2, message: message2 };
|
|
139
140
|
} catch {
|
|
140
141
|
return { ok: false, errno: "EIO", message: "sync-sab: malformed errno payload" };
|
|
141
142
|
}
|
|
@@ -1180,10 +1181,12 @@ function createSyncSabTransport(sab, port2, deps = {}) {
|
|
|
1180
1181
|
}
|
|
1181
1182
|
};
|
|
1182
1183
|
}
|
|
1183
|
-
function errnoError(code2, path) {
|
|
1184
|
-
|
|
1184
|
+
function errnoError(code2, path, direct) {
|
|
1185
|
+
const err = syncError(code2, `sync-sab bridge, '${path}'`);
|
|
1186
|
+
return direct ? Object.assign(err, { direct }) : err;
|
|
1185
1187
|
}
|
|
1186
1188
|
function createSyncFsSabBridge(transport, opts = {}) {
|
|
1189
|
+
const direct = opts.direct ? { direct: true } : {};
|
|
1187
1190
|
const timeoutMs2 = opts.timeoutMs ?? SYNC_FS_REQUEST_TIMEOUT_MS;
|
|
1188
1191
|
let identity = {};
|
|
1189
1192
|
let once = false;
|
|
@@ -1192,7 +1195,7 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1192
1195
|
last = null;
|
|
1193
1196
|
const silence = SYNC_FS_READ_ONLY.has(req.op) ? timeoutMs2 : Number.POSITIVE_INFINITY;
|
|
1194
1197
|
const result = transport.call(req, silence, `sync-sab bridge, '${path}'`, transfer);
|
|
1195
|
-
if (!result.ok) throw errnoError(result.errno, path);
|
|
1198
|
+
if (!result.ok) throw errnoError(result.errno, path, result.direct);
|
|
1196
1199
|
return result;
|
|
1197
1200
|
}
|
|
1198
1201
|
function bytes(req, path) {
|
|
@@ -1238,12 +1241,12 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1238
1241
|
return s;
|
|
1239
1242
|
},
|
|
1240
1243
|
stat: (path) => {
|
|
1241
|
-
const s = parseSyncFsStat(json2({ op: "stat", path }, path));
|
|
1244
|
+
const s = parseSyncFsStat(json2({ op: "stat", path, ...direct }, path));
|
|
1242
1245
|
if (!s) throw errnoError("EIO", path);
|
|
1243
1246
|
return s;
|
|
1244
1247
|
},
|
|
1245
1248
|
lstat: (path) => {
|
|
1246
|
-
const s = parseSyncFsStat(json2({ op: "lstat", path }, path));
|
|
1249
|
+
const s = parseSyncFsStat(json2({ op: "lstat", path, ...direct }, path));
|
|
1247
1250
|
if (!s) throw errnoError("EIO", path);
|
|
1248
1251
|
return s;
|
|
1249
1252
|
},
|
|
@@ -1321,7 +1324,12 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1321
1324
|
},
|
|
1322
1325
|
create: (path, mode, opening2) => {
|
|
1323
1326
|
const flags = { ...mode !== void 0 ? { mode } : {}, ...opening2 ? { opening: opening2 } : {} };
|
|
1324
|
-
run({ op: "create", path, ...flags }, path);
|
|
1327
|
+
const r = run({ op: "create", path, ...flags, identity: true }, path);
|
|
1328
|
+
if (!r.ok || r.kind !== "json") return void 0;
|
|
1329
|
+
const st = parseSyncFsStat(r.json);
|
|
1330
|
+
if (!st) return void 0;
|
|
1331
|
+
const { seen } = r.json;
|
|
1332
|
+
return typeof seen === "number" ? { ...st, seen } : st;
|
|
1325
1333
|
},
|
|
1326
1334
|
chown: (path, uid, gid, follow3, handle) => {
|
|
1327
1335
|
const ids = { ...uid !== void 0 ? { uid } : {}, ...gid !== void 0 ? { gid } : {} };
|
|
@@ -2647,7 +2655,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2647
2655
|
var init_version = __esm({
|
|
2648
2656
|
"src/version.ts"() {
|
|
2649
2657
|
"use strict";
|
|
2650
|
-
KERNEL_VERSION = true ? "1.125.
|
|
2658
|
+
KERNEL_VERSION = true ? "1.125.3" : "0.0.0-dev";
|
|
2651
2659
|
OS_RELEASE = "6.0.0-slicc";
|
|
2652
2660
|
}
|
|
2653
2661
|
});
|
|
@@ -5590,15 +5598,15 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
5590
5598
|
};
|
|
5591
5599
|
const track = (stream, names) => {
|
|
5592
5600
|
let current = names;
|
|
5593
|
-
const
|
|
5594
|
-
|
|
5601
|
+
const remember2 = (list) => scans.set(stream, new Set(list.filter((n) => /^[1-9]\d*$/.test(n)).map(Number)));
|
|
5602
|
+
remember2(current ?? []);
|
|
5595
5603
|
Object.defineProperty(stream, "getdents", {
|
|
5596
5604
|
configurable: true,
|
|
5597
5605
|
enumerable: true,
|
|
5598
5606
|
get: () => current,
|
|
5599
5607
|
set: (next2) => {
|
|
5600
5608
|
current = next2;
|
|
5601
|
-
if (next2)
|
|
5609
|
+
if (next2) remember2(next2);
|
|
5602
5610
|
}
|
|
5603
5611
|
});
|
|
5604
5612
|
};
|
|
@@ -6617,6 +6625,17 @@ function index(map, key, path) {
|
|
|
6617
6625
|
paths.add(path);
|
|
6618
6626
|
map.set(key, paths);
|
|
6619
6627
|
}
|
|
6628
|
+
function goneAbove(maps, live, path) {
|
|
6629
|
+
for (let at = path.lastIndexOf("/"); at > 0; at = path.lastIndexOf("/", at - 1)) {
|
|
6630
|
+
const up = path.slice(0, at);
|
|
6631
|
+
for (const map of maps) {
|
|
6632
|
+
const hit = map.get(up);
|
|
6633
|
+
const code2 = hit && "until" in hit ? hit.error.code : void 0;
|
|
6634
|
+
if (hit && "until" in hit && code2 === "ENOENT" && live(hit, up)) return hit;
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
return void 0;
|
|
6638
|
+
}
|
|
6620
6639
|
function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
6621
6640
|
const blind = shared !== void 0 && shared.length * 4 < SHARED_IDS_BYTES;
|
|
6622
6641
|
const cache = new StatCache(blind ? void 0 : shared);
|
|
@@ -6624,17 +6643,8 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6624
6643
|
const view = bridge.changes;
|
|
6625
6644
|
const live = (miss, path) => miss.until > now() && (view === void 0 || miss.gen === void 0 || !view.changedSince(miss.gen, path).changed);
|
|
6626
6645
|
const seen = new SeenAt(view, lstats);
|
|
6627
|
-
const
|
|
6628
|
-
|
|
6629
|
-
const up = path.slice(0, at);
|
|
6630
|
-
for (const map of [lstats, stats]) {
|
|
6631
|
-
const hit = map.get(up);
|
|
6632
|
-
const code2 = hit && "until" in hit ? hit.error.code : void 0;
|
|
6633
|
-
if (hit && "until" in hit && code2 === "ENOENT" && live(hit, up)) return hit;
|
|
6634
|
-
}
|
|
6635
|
-
}
|
|
6636
|
-
return void 0;
|
|
6637
|
-
};
|
|
6646
|
+
const kept = remember(cache, seen, blind);
|
|
6647
|
+
const gone = (path) => goneAbove([lstats, stats], live, path);
|
|
6638
6648
|
const cached = (map, path, get) => {
|
|
6639
6649
|
if (blind || view?.foreign()) return get();
|
|
6640
6650
|
cache.fresh();
|
|
@@ -6760,7 +6770,10 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6760
6770
|
...bridge.keptStat ? { keptStat: bridge.keptStat.bind(bridge) } : {},
|
|
6761
6771
|
...bridge.pinned ? { pinned: (handle) => pinnedIo2(bridge, handle, rewriting) } : {},
|
|
6762
6772
|
...bridge.create ? {
|
|
6763
|
-
create: (p, mode, opening2) =>
|
|
6773
|
+
create: (p, mode, opening2) => kept(
|
|
6774
|
+
p,
|
|
6775
|
+
mutating(() => bridge.create?.(p, mode, opening2), ...entry(p))
|
|
6776
|
+
)
|
|
6764
6777
|
} : {},
|
|
6765
6778
|
...bridge.mkfifo ? {
|
|
6766
6779
|
mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
|
|
@@ -6797,7 +6810,7 @@ function pinnedIo2(bridge, handle, rewriting) {
|
|
|
6797
6810
|
} : {}
|
|
6798
6811
|
};
|
|
6799
6812
|
}
|
|
6800
|
-
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;
|
|
6813
|
+
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, remember;
|
|
6801
6814
|
var init_wasi_files = __esm({
|
|
6802
6815
|
"src/process/wasi/wasi-files.ts"() {
|
|
6803
6816
|
"use strict";
|
|
@@ -7187,6 +7200,13 @@ var init_wasi_files = __esm({
|
|
|
7187
7200
|
return since.changed;
|
|
7188
7201
|
}
|
|
7189
7202
|
};
|
|
7203
|
+
remember = (cache, seen, blind) => (path, made) => {
|
|
7204
|
+
if (!made || blind) return made;
|
|
7205
|
+
const { seen: at, ...st } = made;
|
|
7206
|
+
cache.put(cache.stats, path, st);
|
|
7207
|
+
if (at !== void 0) seen.saw(cache.stats, path, at);
|
|
7208
|
+
return made;
|
|
7209
|
+
};
|
|
7190
7210
|
}
|
|
7191
7211
|
});
|
|
7192
7212
|
|
|
@@ -8847,6 +8867,8 @@ var init_wasi_fds = __esm({
|
|
|
8847
8867
|
return openDevice2.call(this.kernel.sys, flags);
|
|
8848
8868
|
}
|
|
8849
8869
|
open(path, oflags, rights, fdflags, mode) {
|
|
8870
|
+
this.made = void 0;
|
|
8871
|
+
this.created = false;
|
|
8850
8872
|
const device2 = deviceOf(path);
|
|
8851
8873
|
if (device2) return this.install({ type: "device", device: device2 });
|
|
8852
8874
|
const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
|
|
@@ -8854,8 +8876,8 @@ var init_wasi_fds = __esm({
|
|
|
8854
8876
|
const alias = stdioAlias(path);
|
|
8855
8877
|
if (alias !== void 0) return this.reopen(alias);
|
|
8856
8878
|
const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
|
|
8857
|
-
if (exclusive &&
|
|
8858
|
-
return this.
|
|
8879
|
+
if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
|
|
8880
|
+
return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
|
|
8859
8881
|
}
|
|
8860
8882
|
if (exclusive && this.isLink(path)) throw new WasiError("EEXIST");
|
|
8861
8883
|
const s = this.statOrMissing(path);
|
|
@@ -8872,15 +8894,15 @@ var init_wasi_fds = __esm({
|
|
|
8872
8894
|
refuseWrite(s, oflags, rights);
|
|
8873
8895
|
return this.regular(path, s, oflags, rights, fdflags, mode);
|
|
8874
8896
|
}
|
|
8875
|
-
regular(path, s, oflags, rights, fdflags, mode) {
|
|
8897
|
+
regular(path, s, oflags, rights, fdflags, mode, created = false) {
|
|
8876
8898
|
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
8877
8899
|
if (s?.isSocket) throw new WasiError("ENXIO");
|
|
8878
8900
|
if (this.shared || this.kernelHolds(path, s)) {
|
|
8879
|
-
return this.kernelFile(path, s, oflags, rights, fdflags, mode);
|
|
8901
|
+
return this.kernelFile(path, s, oflags, rights, fdflags, mode, created);
|
|
8880
8902
|
}
|
|
8881
8903
|
return this.install({
|
|
8882
8904
|
type: "file",
|
|
8883
|
-
file: this.file(path, s, oflags, rights, fdflags, mode)
|
|
8905
|
+
file: this.file(path, s, oflags, rights, fdflags, mode, created)
|
|
8884
8906
|
});
|
|
8885
8907
|
}
|
|
8886
8908
|
kernelHolds(path, st) {
|
|
@@ -8903,9 +8925,9 @@ var init_wasi_fds = __esm({
|
|
|
8903
8925
|
} catch {
|
|
8904
8926
|
}
|
|
8905
8927
|
}
|
|
8906
|
-
file(path, existing, oflags, rights, fdflags, mode) {
|
|
8928
|
+
file(path, existing, oflags, rights, fdflags, mode, created = false) {
|
|
8907
8929
|
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
8908
|
-
let buffer = this.buffers.get(path);
|
|
8930
|
+
let buffer = created ? void 0 : this.buffers.get(path);
|
|
8909
8931
|
if (buffer?.handle !== void 0 && this.fs.kept?.(buffer.handle)) {
|
|
8910
8932
|
this.buffers.delete(path);
|
|
8911
8933
|
buffer = void 0;
|
|
@@ -8916,19 +8938,21 @@ var init_wasi_fds = __esm({
|
|
|
8916
8938
|
if (this.fs.owners) this.fs.access?.(path, want, "open");
|
|
8917
8939
|
if (oflags & OFLAGS.TRUNC) buffer.truncate(0);
|
|
8918
8940
|
} else {
|
|
8919
|
-
buffer = this.freshBuffer(path, existing, oflags, want, mode);
|
|
8941
|
+
buffer = this.freshBuffer(path, existing, oflags, want, mode, created);
|
|
8920
8942
|
}
|
|
8921
8943
|
buffer.opens++;
|
|
8922
8944
|
const file = new LocalFile(buffer, readable3, writable2, (fdflags & FDFLAGS.APPEND) !== 0);
|
|
8923
8945
|
file.ino = existing?.ino;
|
|
8924
8946
|
return file;
|
|
8925
8947
|
}
|
|
8926
|
-
freshBuffer(path, existing, oflags, want, mode) {
|
|
8927
|
-
const made = !existing && this.createNew(path, oflags, mode);
|
|
8948
|
+
freshBuffer(path, existing, oflags, want, mode, created = false) {
|
|
8949
|
+
const made = created || !existing && this.createNew(path, oflags, mode);
|
|
8950
|
+
const reply = made ? this.made : void 0;
|
|
8951
|
+
this.made = void 0;
|
|
8928
8952
|
const empty = made || (oflags & OFLAGS.TRUNC) !== 0;
|
|
8929
8953
|
if (existing?.ranged) this.fs.invalidate?.();
|
|
8930
|
-
const seen = this.fs.changes?.now();
|
|
8931
|
-
const st = existing?.ranged || !existing ? this.fs.stat(path) : existing;
|
|
8954
|
+
const seen = reply ? reply.seen : this.fs.changes?.now();
|
|
8955
|
+
const st = reply?.st ?? (existing?.ranged || !existing ? this.fs.stat(path) : existing);
|
|
8932
8956
|
const ranged = st.ranged ? st.size : void 0;
|
|
8933
8957
|
const asked = (want & 4 ? HOLD_READ : 0) | (want & 2 ? HOLD_WRITE : 0) | (made ? HOLD_CREATED : 0);
|
|
8934
8958
|
const handle = this.fs.hold?.(path, true, true, void 0, this.fs.owners ? asked : 0, {
|
|
@@ -8995,10 +9019,17 @@ var init_wasi_fds = __esm({
|
|
|
8995
9019
|
}
|
|
8996
9020
|
}
|
|
8997
9021
|
}
|
|
9022
|
+
created = false;
|
|
9023
|
+
made;
|
|
9024
|
+
creating(path, mode) {
|
|
9025
|
+
const st = this.fs.create?.(path, mode, true);
|
|
9026
|
+
this.made = st ? { st, seen: st.seen } : void 0;
|
|
9027
|
+
this.created = true;
|
|
9028
|
+
}
|
|
8998
9029
|
madeAtOnce(path, mode) {
|
|
8999
9030
|
if (!this.fs.create) return false;
|
|
9000
9031
|
try {
|
|
9001
|
-
this.
|
|
9032
|
+
this.creating(path, mode);
|
|
9002
9033
|
return true;
|
|
9003
9034
|
} catch (err) {
|
|
9004
9035
|
if (err.code === "EEXIST") throw err;
|
|
@@ -9008,10 +9039,11 @@ var init_wasi_fds = __esm({
|
|
|
9008
9039
|
createNew(path, oflags, mode) {
|
|
9009
9040
|
if (!this.fs.create) {
|
|
9010
9041
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
9042
|
+
this.created = true;
|
|
9011
9043
|
return true;
|
|
9012
9044
|
}
|
|
9013
9045
|
try {
|
|
9014
|
-
this.
|
|
9046
|
+
this.creating(path, mode);
|
|
9015
9047
|
return true;
|
|
9016
9048
|
} catch (err) {
|
|
9017
9049
|
if (oflags & OFLAGS.EXCL || err.code !== "EEXIST") throw err;
|
|
@@ -10174,7 +10206,11 @@ var init_wasi_host = __esm({
|
|
|
10174
10206
|
}
|
|
10175
10207
|
if (this.synthetic(path)) return ROOT_IDS;
|
|
10176
10208
|
if (kernelDev(path)) return devSync(dev, devStat(path, follow3));
|
|
10177
|
-
return
|
|
10209
|
+
return this.orDev(
|
|
10210
|
+
path,
|
|
10211
|
+
follow3,
|
|
10212
|
+
() => follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path)
|
|
10213
|
+
);
|
|
10178
10214
|
};
|
|
10179
10215
|
return wrap({
|
|
10180
10216
|
fd_chown: (fd, uid, gid) => {
|
|
@@ -10253,7 +10289,16 @@ var init_wasi_host = __esm({
|
|
|
10253
10289
|
const node = devSync(dev, devStat(path, (flags & AT_SYMLINK_NOFOLLOW2) === 0));
|
|
10254
10290
|
return void mem.view().setUint32(out, node.mode ?? DEVICE_MODE, true);
|
|
10255
10291
|
}
|
|
10256
|
-
const
|
|
10292
|
+
const follow3 = (flags & AT_SYMLINK_NOFOLLOW2) === 0;
|
|
10293
|
+
let st;
|
|
10294
|
+
try {
|
|
10295
|
+
st = follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
|
|
10296
|
+
} catch (err) {
|
|
10297
|
+
const device2 = this.orDev(path, follow3, () => {
|
|
10298
|
+
throw err;
|
|
10299
|
+
});
|
|
10300
|
+
return void mem.view().setUint32(out, device2.mode ?? DEVICE_MODE, true);
|
|
10301
|
+
}
|
|
10257
10302
|
mem.view().setUint32(out, (st.isFifo ? S_IFIFO2 : 0) | modeOf2(st), true);
|
|
10258
10303
|
}
|
|
10259
10304
|
});
|
|
@@ -10577,9 +10622,8 @@ var init_wasi_host = __esm({
|
|
|
10577
10622
|
if (alias && !alias.stdio) this.openFd(alias.fd);
|
|
10578
10623
|
const path = alias && !alias.stdio ? `/dev/fd/${alias.fd}` : asked;
|
|
10579
10624
|
if (deviceOf(path)) this.interrupted?.();
|
|
10580
|
-
const fresh = (oflags & OFLAGS.CREAT) !== 0 && !this.synthetic(path) && !o.fs.exists(path);
|
|
10581
10625
|
mem.view().setUint32(out, fds.open(path, oflags, rights, fdflags), true);
|
|
10582
|
-
if (
|
|
10626
|
+
if (fds.created) this.created(path, 438);
|
|
10583
10627
|
} catch (err) {
|
|
10584
10628
|
if (err.code !== "ENOENT") throw err;
|
|
10585
10629
|
const raw = mem.string(p, l);
|
|
@@ -10964,6 +11008,21 @@ var init_wasi_host = __esm({
|
|
|
10964
11008
|
synthetic(path) {
|
|
10965
11009
|
return deviceOf(path) !== void 0 || path === SEALED_PATH2 && !!this.o.kernel.sys.openSealed || path === CLIPBOARD_PATH2 && !!this.o.kernel.sys.openClipboard;
|
|
10966
11010
|
}
|
|
11011
|
+
linkedDev(path, follow3) {
|
|
11012
|
+
if (!follow3) return void 0;
|
|
11013
|
+
const real = physicalPath(this.o.fs, path);
|
|
11014
|
+
return real !== path && kernelDev(real) ? real : void 0;
|
|
11015
|
+
}
|
|
11016
|
+
orDev(path, follow3, stat) {
|
|
11017
|
+
try {
|
|
11018
|
+
return stat();
|
|
11019
|
+
} catch (err) {
|
|
11020
|
+
const device2 = err.code === "ENOENT" && this.linkedDev(path, follow3);
|
|
11021
|
+
if (!device2) throw err;
|
|
11022
|
+
const json2 = (req) => this.o.kernel.call(req);
|
|
11023
|
+
return devSync({ json: json2 }, devStat(device2, true));
|
|
11024
|
+
}
|
|
11025
|
+
}
|
|
10967
11026
|
devChar(path, follow3) {
|
|
10968
11027
|
try {
|
|
10969
11028
|
const json2 = (req) => this.o.kernel.call(req);
|
|
@@ -11071,11 +11130,12 @@ var init_wasi_host = __esm({
|
|
|
11071
11130
|
return filestatOf(path, follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path));
|
|
11072
11131
|
} catch (err) {
|
|
11073
11132
|
if (err.code !== "ENOENT") throw err;
|
|
11074
|
-
|
|
11133
|
+
const device2 = kernelDev(path) ? path : this.linkedDev(path, follow3);
|
|
11134
|
+
if (device2 && this.devChar(device2, true)) {
|
|
11075
11135
|
return this.local({
|
|
11076
11136
|
filetype: FILETYPE.CHARACTER_DEVICE,
|
|
11077
11137
|
size: 0n,
|
|
11078
|
-
ino: pathInode(
|
|
11138
|
+
ino: pathInode(device2),
|
|
11079
11139
|
mtimeNs: 0n
|
|
11080
11140
|
});
|
|
11081
11141
|
}
|
|
@@ -11830,6 +11890,10 @@ function physicalProc(fs) {
|
|
|
11830
11890
|
return physical2;
|
|
11831
11891
|
};
|
|
11832
11892
|
}
|
|
11893
|
+
function directMiss(err, path) {
|
|
11894
|
+
if (err?.direct !== true) return false;
|
|
11895
|
+
return !path.split("/").some((part) => part === "." || part === "..");
|
|
11896
|
+
}
|
|
11833
11897
|
function procfsBridge(fs, tree) {
|
|
11834
11898
|
const toProc = (path, follow3) => procPath(fs, path, follow3);
|
|
11835
11899
|
const shadowing = physicalProc(fs);
|
|
@@ -11842,6 +11906,7 @@ function procfsBridge(fs, tree) {
|
|
|
11842
11906
|
try {
|
|
11843
11907
|
return own();
|
|
11844
11908
|
} catch (err) {
|
|
11909
|
+
if (directMiss(err, p)) throw err;
|
|
11845
11910
|
const real = toProc(p, follow3);
|
|
11846
11911
|
if (real === void 0) throw err;
|
|
11847
11912
|
return proc(real);
|
|
@@ -11902,7 +11967,12 @@ function procfsBridge(fs, tree) {
|
|
|
11902
11967
|
const real = shadowing() ? probe() : void 0;
|
|
11903
11968
|
if (real === null) return false;
|
|
11904
11969
|
if (real !== void 0) return tree.exists(real);
|
|
11905
|
-
|
|
11970
|
+
try {
|
|
11971
|
+
fs.stat(p);
|
|
11972
|
+
return true;
|
|
11973
|
+
} catch (err) {
|
|
11974
|
+
if (directMiss(err, p)) return false;
|
|
11975
|
+
}
|
|
11906
11976
|
const late2 = probe();
|
|
11907
11977
|
return typeof late2 === "string" && tree.exists(late2);
|
|
11908
11978
|
},
|
|
@@ -14311,7 +14381,7 @@ async function runWasiProcess(init, port2) {
|
|
|
14311
14381
|
kernel: { sys: traced(stats, "kernel", sys), call: call2 },
|
|
14312
14382
|
fs: procfsBridge(
|
|
14313
14383
|
cachingBridge(
|
|
14314
|
-
traced(stats, "fs", createSyncFsSabBridge(transport, ownersOf(init))),
|
|
14384
|
+
traced(stats, "fs", createSyncFsSabBridge(transport, { ...ownersOf(init), direct: true })),
|
|
14315
14385
|
void 0,
|
|
14316
14386
|
threads?.ids
|
|
14317
14387
|
),
|
|
@@ -14416,7 +14486,11 @@ async function runWasiThread(init, port2) {
|
|
|
14416
14486
|
parent: () => identify(transport, init).ppid,
|
|
14417
14487
|
kernel: { sys, call: call2 },
|
|
14418
14488
|
fs: procfsBridge(
|
|
14419
|
-
cachingBridge(
|
|
14489
|
+
cachingBridge(
|
|
14490
|
+
createSyncFsSabBridge(transport, { ...ownersOf(init), direct: true }),
|
|
14491
|
+
void 0,
|
|
14492
|
+
threads.ids
|
|
14493
|
+
),
|
|
14420
14494
|
procTree(call2, id.pid)
|
|
14421
14495
|
),
|
|
14422
14496
|
shared: threads.ids
|
|
@@ -15453,7 +15527,8 @@ function controlsOf(r) {
|
|
|
15453
15527
|
clientCertificate: r.clientCertificate === true,
|
|
15454
15528
|
sni: r.sni !== false,
|
|
15455
15529
|
hostnameChecked: r.hostnameChecked === true,
|
|
15456
|
-
...r.hostnameMatches === void 0 ? {} : { hostnameMatches: r.hostnameMatches }
|
|
15530
|
+
...r.hostnameMatches === void 0 ? {} : { hostnameMatches: r.hostnameMatches },
|
|
15531
|
+
...r.chainError ? { chainError: r.chainError } : {}
|
|
15457
15532
|
};
|
|
15458
15533
|
}
|
|
15459
15534
|
function sessionOf(r) {
|
|
@@ -15479,13 +15554,17 @@ function sessionOf(r) {
|
|
|
15479
15554
|
...controlsOf(r)
|
|
15480
15555
|
});
|
|
15481
15556
|
}
|
|
15557
|
+
function withAlert(err) {
|
|
15558
|
+
const alert = ALERT.exec(err.detail ?? "")?.[1];
|
|
15559
|
+
return alert === void 0 ? err : Object.assign(err, { alert: Number(alert) });
|
|
15560
|
+
}
|
|
15482
15561
|
async function secureCall(call2, what = "connect") {
|
|
15483
15562
|
try {
|
|
15484
15563
|
return await call2();
|
|
15485
15564
|
} catch (err) {
|
|
15486
15565
|
const e = err;
|
|
15487
15566
|
const code2 = e.code === "EPROTO" && e.detail ? TLS_CODE.exec(e.detail)?.[1] : void 0;
|
|
15488
|
-
if (code2) throw new JsCallError(code2, what, e.detail);
|
|
15567
|
+
if (code2) throw withAlert(new JsCallError(code2, what, e.detail));
|
|
15489
15568
|
throw err;
|
|
15490
15569
|
}
|
|
15491
15570
|
}
|
|
@@ -15653,7 +15732,7 @@ function netOps(kernel, io) {
|
|
|
15653
15732
|
}
|
|
15654
15733
|
};
|
|
15655
15734
|
}
|
|
15656
|
-
var PEM, TLS_CODE, SHUT_RD, SHUT_WR, IPV4, NEVER, SOL_SOCKET2, SO_ERROR2;
|
|
15735
|
+
var PEM, TLS_CODE, ALERT, SHUT_RD, SHUT_WR, IPV4, NEVER, SOL_SOCKET2, SO_ERROR2;
|
|
15657
15736
|
var init_js_net = __esm({
|
|
15658
15737
|
"src/process/js/js-net.ts"() {
|
|
15659
15738
|
"use strict";
|
|
@@ -15661,6 +15740,7 @@ var init_js_net = __esm({
|
|
|
15661
15740
|
init_js_kernel();
|
|
15662
15741
|
PEM = /-----BEGIN CERTIFICATE-----([\s\S]*?)-----END CERTIFICATE-----/g;
|
|
15663
15742
|
TLS_CODE = /^([A-Z][A-Z0-9_]+): /;
|
|
15743
|
+
ALERT = / \(alert (\d+)\)$/;
|
|
15664
15744
|
SHUT_RD = 0;
|
|
15665
15745
|
SHUT_WR = 1;
|
|
15666
15746
|
IPV4 = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
|