@ai-ecoverse/slicc-kernel 1.113.0 → 1.115.0
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 +41 -1
- package/dist/driver-worker.js +7 -0
- package/dist/driver-worker.js.map +2 -2
- package/dist/index.js +7 -0
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +299 -62
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-driver-worker.js +7 -0
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +134 -16
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +299 -62
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +136 -18
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/meta.d.ts +1 -0
- package/dist/types/fs/types.d.ts +2 -0
- package/dist/types/kernel/children.d.ts +9 -1
- package/dist/types/kernel/fd-table.d.ts +1 -0
- package/dist/types/kernel/fifo.d.ts +13 -0
- package/dist/types/kernel/host.d.ts +5 -2
- package/dist/types/kernel/jobs.d.ts +4 -3
- package/dist/types/kernel/process.d.ts +18 -4
- package/dist/types/kernel/protocol.d.ts +2 -0
- package/dist/types/kernel/signals.d.ts +21 -0
- package/dist/types/launcher.d.ts +4 -1
- package/dist/types/process/kernel-streams.d.ts +3 -0
- package/dist/types/process/process-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +3 -0
- package/dist/types/process/wasi/wasi-host.d.ts +1 -0
- package/dist/types/realm/live-vfs-fs.d.ts +1 -0
- package/dist/types/realm/sync-fs-dispatch.d.ts +1 -0
- package/dist/types/realm/sync-fs-wire.d.ts +3 -1
- package/package.json +5 -4
|
@@ -582,6 +582,7 @@ function parseSyncFsStat(json2) {
|
|
|
582
582
|
isDirectory: s.isDirectory,
|
|
583
583
|
isSymbolicLink: s.isSymbolicLink,
|
|
584
584
|
...s.isSocket === true ? { isSocket: true } : {},
|
|
585
|
+
...s.isFifo === true ? { isFifo: true } : {},
|
|
585
586
|
size: s.size,
|
|
586
587
|
...typeof s.mode === "number" ? { mode: s.mode } : {},
|
|
587
588
|
...typeof s.mtimeMs === "number" ? { mtimeMs: s.mtimeMs } : {},
|
|
@@ -625,6 +626,7 @@ var init_sync_fs_wire = __esm({
|
|
|
625
626
|
"statfs",
|
|
626
627
|
"hold",
|
|
627
628
|
"create",
|
|
629
|
+
"mkfifo",
|
|
628
630
|
"kept",
|
|
629
631
|
"pread",
|
|
630
632
|
"pwrite",
|
|
@@ -1640,7 +1642,7 @@ function signalsIn(mask) {
|
|
|
1640
1642
|
for (let sig = 1; sig <= 31; sig++) if (mask & sigbit(sig)) out.push(sig);
|
|
1641
1643
|
return out;
|
|
1642
1644
|
}
|
|
1643
|
-
var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME;
|
|
1645
|
+
var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME, SI, KERNEL_SIGINFO;
|
|
1644
1646
|
var init_signals = __esm({
|
|
1645
1647
|
"src/kernel/signals.ts"() {
|
|
1646
1648
|
"use strict";
|
|
@@ -1686,6 +1688,13 @@ var init_signals = __esm({
|
|
|
1686
1688
|
SIGSTOP: SIG.STOP,
|
|
1687
1689
|
SIGCONT: SIG.CONT
|
|
1688
1690
|
};
|
|
1691
|
+
SI = { USER: 0, QUEUE: -1, TIMER: -2, TKILL: -6, KERNEL: 128 };
|
|
1692
|
+
KERNEL_SIGINFO = Object.freeze({
|
|
1693
|
+
code: SI.KERNEL,
|
|
1694
|
+
pid: 0,
|
|
1695
|
+
uid: 0,
|
|
1696
|
+
status: 0
|
|
1697
|
+
});
|
|
1689
1698
|
}
|
|
1690
1699
|
});
|
|
1691
1700
|
|
|
@@ -2553,6 +2562,7 @@ var init_wasi_fds = __esm({
|
|
|
2553
2562
|
return this.regular(path, s, oflags, rights, fdflags, mode);
|
|
2554
2563
|
}
|
|
2555
2564
|
regular(path, s, oflags, rights, fdflags, mode) {
|
|
2565
|
+
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
2556
2566
|
if (this.shared || this.kernelHolds(path, s)) {
|
|
2557
2567
|
return this.kernelFile(path, s, oflags, rights, fdflags, mode);
|
|
2558
2568
|
}
|
|
@@ -2647,6 +2657,28 @@ var init_wasi_fds = __esm({
|
|
|
2647
2657
|
this.bump(fd);
|
|
2648
2658
|
return fd;
|
|
2649
2659
|
}
|
|
2660
|
+
kernelFifo(path, existing, oflags, rights, fdflags) {
|
|
2661
|
+
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
2662
|
+
const nonblock = (fdflags & FDFLAGS.NONBLOCK) !== 0;
|
|
2663
|
+
const access = writable2 ? readable3 ? O_RDWR : O_WRONLY : 0;
|
|
2664
|
+
const fd = this.restarting(
|
|
2665
|
+
() => this.kernel.sys.openVfs(path, access | (nonblock ? O_NONBLOCK : 0), 0, { fifo: true })
|
|
2666
|
+
);
|
|
2667
|
+
this.table.set(fd, { type: "kernel", kind: "stream", nonblock, append: false });
|
|
2668
|
+
if (nonblock) this.publishFlags(fd, { nonblock, append: false });
|
|
2669
|
+
this.bump(fd);
|
|
2670
|
+
return fd;
|
|
2671
|
+
}
|
|
2672
|
+
restartable;
|
|
2673
|
+
restarting(call2) {
|
|
2674
|
+
for (; ; ) {
|
|
2675
|
+
try {
|
|
2676
|
+
return call2();
|
|
2677
|
+
} catch (err) {
|
|
2678
|
+
if (err.code !== "EINTR" || !this.restartable?.()) throw err;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2650
2682
|
createNew(path, oflags, mode) {
|
|
2651
2683
|
if (!this.fs.create) {
|
|
2652
2684
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
@@ -3674,7 +3706,7 @@ function wrap(table) {
|
|
|
3674
3706
|
}
|
|
3675
3707
|
return out;
|
|
3676
3708
|
}
|
|
3677
|
-
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, S_IFLNK, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
3709
|
+
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, S_IFLNK, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
3678
3710
|
var init_wasi_host = __esm({
|
|
3679
3711
|
"src/process/wasi/wasi-host.ts"() {
|
|
3680
3712
|
"use strict";
|
|
@@ -3713,6 +3745,7 @@ var init_wasi_host = __esm({
|
|
|
3713
3745
|
DEFAULT_UMASK = 18;
|
|
3714
3746
|
MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS4;
|
|
3715
3747
|
MAX_READ = 1024 * 1024;
|
|
3748
|
+
SIGINFO_BYTES = 24;
|
|
3716
3749
|
FD_ALIAS = /^\/(?:dev\/(stdin|stdout|stderr)|dev\/fd\/(\d+)|proc\/(self|[1-9]\d*)\/fd\/(\d+))$/;
|
|
3717
3750
|
STDIO_FDS = { stdin: 0, stdout: 1, stderr: 2 };
|
|
3718
3751
|
SIGPIPE_EXIT = 128 + SIG.PIPE;
|
|
@@ -3905,7 +3938,7 @@ var init_wasi_host = __esm({
|
|
|
3905
3938
|
if (this.synthetic(path) && deviceOf(path) === void 0)
|
|
3906
3939
|
return void mem.view().setUint32(out, SEALED_MODE, true);
|
|
3907
3940
|
const st = flags & AT_SYMLINK_NOFOLLOW ? this.o.fs.lstat(path) : this.o.fs.stat(path);
|
|
3908
|
-
mem.view().setUint32(out, modeOf2(st), true);
|
|
3941
|
+
mem.view().setUint32(out, (st.isFifo ? S_IFIFO : 0) | modeOf2(st), true);
|
|
3909
3942
|
}
|
|
3910
3943
|
});
|
|
3911
3944
|
}
|
|
@@ -4008,6 +4041,23 @@ var init_wasi_host = __esm({
|
|
|
4008
4041
|
this.entered
|
|
4009
4042
|
);
|
|
4010
4043
|
},
|
|
4044
|
+
sigwait_info: (lo, _hi, timeout, info) => {
|
|
4045
|
+
const mask = this.sigmask;
|
|
4046
|
+
if (!mask) return E.NOSYS;
|
|
4047
|
+
let took = 0;
|
|
4048
|
+
const r = mask.sigwait(
|
|
4049
|
+
lo,
|
|
4050
|
+
timeout,
|
|
4051
|
+
(set) => void this.o.kernel.call({ op: "sig-waiting", tid: mask.tid, set }),
|
|
4052
|
+
(sig) => {
|
|
4053
|
+
took = sig;
|
|
4054
|
+
},
|
|
4055
|
+
this.entered
|
|
4056
|
+
);
|
|
4057
|
+
if (r === E.SUCCESS) this.writeSiginfo(info, took, mask.tid);
|
|
4058
|
+
return r;
|
|
4059
|
+
},
|
|
4060
|
+
siginfo_take: (sig, info) => this.writeSiginfo(info, sig, this.sigmask?.tid ?? this.tid, false) ? E.SUCCESS : E.NOENT,
|
|
4011
4061
|
sigaction_inherited: (out) => {
|
|
4012
4062
|
const bits = this.o.kernel.call({ op: "sig-inherited" });
|
|
4013
4063
|
mem.view().setBigUint64(out, BigInt(libcBits(bits) >>> 0), true);
|
|
@@ -4602,6 +4652,22 @@ var init_wasi_host = __esm({
|
|
|
4602
4652
|
return void 0;
|
|
4603
4653
|
}
|
|
4604
4654
|
}
|
|
4655
|
+
writeSiginfo(at, sig, tid, waited = true) {
|
|
4656
|
+
const taken = this.o.kernel.call({ op: "sig-info", sig, tid });
|
|
4657
|
+
if (!taken && !waited) return false;
|
|
4658
|
+
const info = taken ?? KERNEL_SIGINFO;
|
|
4659
|
+
const view = this.mem.view();
|
|
4660
|
+
const size = Math.min(view.getUint32(at, true), SIGINFO_BYTES);
|
|
4661
|
+
const fields = [sig, info.code, info.pid, info.uid, info.status];
|
|
4662
|
+
let filled = 4;
|
|
4663
|
+
for (const [i, value2] of fields.entries()) {
|
|
4664
|
+
if (4 + (i + 1) * 4 > size) break;
|
|
4665
|
+
view.setInt32(4 + at + i * 4, value2, true);
|
|
4666
|
+
filled = 4 + (i + 1) * 4;
|
|
4667
|
+
}
|
|
4668
|
+
view.setUint32(at, filled, true);
|
|
4669
|
+
return true;
|
|
4670
|
+
}
|
|
4605
4671
|
fdAlias(path) {
|
|
4606
4672
|
const m = FD_ALIAS.exec(path);
|
|
4607
4673
|
if (!m) return void 0;
|
|
@@ -5295,7 +5361,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
5295
5361
|
var init_version = __esm({
|
|
5296
5362
|
"src/version.ts"() {
|
|
5297
5363
|
"use strict";
|
|
5298
|
-
KERNEL_VERSION = true ? "1.
|
|
5364
|
+
KERNEL_VERSION = true ? "1.115.0" : "0.0.0-dev";
|
|
5299
5365
|
OS_RELEASE = "6.0.0-slicc";
|
|
5300
5366
|
}
|
|
5301
5367
|
});
|
|
@@ -7276,6 +7342,9 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
7276
7342
|
lutimes: (path, atimeMs, mtimeMs, now) => {
|
|
7277
7343
|
run({ op: "lutimes", path, atimeMs, mtimeMs, ...now ? { now } : {} }, path);
|
|
7278
7344
|
},
|
|
7345
|
+
mkfifo: (path, mode) => {
|
|
7346
|
+
run({ op: "mkfifo", path, mode }, path);
|
|
7347
|
+
},
|
|
7279
7348
|
create: (path, mode, opening2) => {
|
|
7280
7349
|
const flags = { ...mode !== void 0 ? { mode } : {}, ...opening2 ? { opening: opening2 } : {} };
|
|
7281
7350
|
run({ op: "create", path, ...flags }, path);
|
|
@@ -7349,7 +7418,7 @@ function exactIn(node) {
|
|
|
7349
7418
|
return node?.mount.opts.bridge.owners === true;
|
|
7350
7419
|
}
|
|
7351
7420
|
function modeFromStat(st, exact = false) {
|
|
7352
|
-
const type = st.isSymbolicLink ? S_IFLNK2 : st.isDirectory ? S_IFDIR : st.isSocket ? S_IFSOCK : S_IFREG;
|
|
7421
|
+
const type = st.isSymbolicLink ? S_IFLNK2 : st.isDirectory ? S_IFDIR : st.isSocket ? S_IFSOCK : st.isFifo ? S_IFIFO2 : S_IFREG;
|
|
7353
7422
|
const fallback = st.isDirectory || st.isSymbolicLink ? 511 : 438;
|
|
7354
7423
|
const perm = (st.mode ?? fallback) & PERM_MASK;
|
|
7355
7424
|
return type | (exact ? perm : perm || fallback);
|
|
@@ -7757,11 +7826,14 @@ function createNodeOps(h) {
|
|
|
7757
7826
|
call2(
|
|
7758
7827
|
() => bridge.create ? bridge.create(path, perm, opening.get(h.Fs) > 0) : bridge.writeFile(path, new Uint8Array(0))
|
|
7759
7828
|
);
|
|
7829
|
+
} else if ((mode & S_IFMT2) === S_IFIFO2 && bridge.mkfifo) {
|
|
7830
|
+
call2(() => bridge.mkfifo?.(path, mode & PERM_MASK));
|
|
7760
7831
|
} else {
|
|
7761
7832
|
throw new Fs.ErrnoError(wasiErrno("EPERM"));
|
|
7762
7833
|
}
|
|
7763
7834
|
const node = makeNode(parent, name2, {
|
|
7764
7835
|
isFile: Fs.isFile(mode),
|
|
7836
|
+
...(mode & S_IFMT2) === S_IFIFO2 ? { isFifo: true } : {},
|
|
7765
7837
|
isDirectory: Fs.isDir(mode),
|
|
7766
7838
|
isSymbolicLink: false,
|
|
7767
7839
|
size: 0,
|
|
@@ -7894,7 +7966,18 @@ function createStreamOps(h) {
|
|
|
7894
7966
|
}
|
|
7895
7967
|
return want;
|
|
7896
7968
|
};
|
|
7969
|
+
const fifo = (stream) => {
|
|
7970
|
+
const open = h.Fs.sliccOpenFifo;
|
|
7971
|
+
try {
|
|
7972
|
+
if (!open) throw new Fs.ErrnoError(wasiErrno("ENXIO"));
|
|
7973
|
+
open.call(h.Fs, stream, liveNodePath(stream.node));
|
|
7974
|
+
} catch (err) {
|
|
7975
|
+
if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
|
|
7976
|
+
throw err;
|
|
7977
|
+
}
|
|
7978
|
+
};
|
|
7897
7979
|
const directory = (stream) => {
|
|
7980
|
+
if ((stream.node.mode & S_IFMT2) === S_IFIFO2 && !(stream.flags & O_PATH)) return fifo(stream);
|
|
7898
7981
|
if ((stream.node.mode & S_IFMT2) === S_IFSOCK && !(stream.flags & O_PATH)) {
|
|
7899
7982
|
if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
|
|
7900
7983
|
throw new Fs.ErrnoError(wasiErrno("ENXIO"));
|
|
@@ -8376,7 +8459,7 @@ function readingLinks(Fs) {
|
|
|
8376
8459
|
}
|
|
8377
8460
|
};
|
|
8378
8461
|
}
|
|
8379
|
-
var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
|
|
8462
|
+
var S_IFDIR, S_IFREG, S_IFLNK2, S_IFSOCK, S_IFIFO2, S_IFMT2, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
|
|
8380
8463
|
var init_live_vfs_fs = __esm({
|
|
8381
8464
|
"src/realm/live-vfs-fs.ts"() {
|
|
8382
8465
|
"use strict";
|
|
@@ -8390,6 +8473,7 @@ var init_live_vfs_fs = __esm({
|
|
|
8390
8473
|
S_IFREG = 32768;
|
|
8391
8474
|
S_IFLNK2 = 40960;
|
|
8392
8475
|
S_IFSOCK = 49152;
|
|
8476
|
+
S_IFIFO2 = 4096;
|
|
8393
8477
|
S_IFMT2 = 61440;
|
|
8394
8478
|
PERM_MASK = 4095;
|
|
8395
8479
|
DEFAULT_DIR_PERM = 493;
|
|
@@ -9035,6 +9119,25 @@ function useZeroDevices(Fs) {
|
|
|
9035
9119
|
mkdev.call(Fs, path, CHAR_DEVICE, dev);
|
|
9036
9120
|
}
|
|
9037
9121
|
}
|
|
9122
|
+
function namesFifo(fs, path) {
|
|
9123
|
+
try {
|
|
9124
|
+
const { node } = fs.lookupPath?.(path, { follow: true }) ?? { node: { mode: 0 } };
|
|
9125
|
+
return (node.mode & S_IFMT_BITS) === S_IFIFO_BITS;
|
|
9126
|
+
} catch {
|
|
9127
|
+
return false;
|
|
9128
|
+
}
|
|
9129
|
+
}
|
|
9130
|
+
function useFifoOpens(Fs, attach) {
|
|
9131
|
+
const fs = Fs;
|
|
9132
|
+
if (attach) fs.sliccOpenFifo = attach;
|
|
9133
|
+
const open = fs.open;
|
|
9134
|
+
if (typeof open !== "function" || typeof fs.lookupPath !== "function") return;
|
|
9135
|
+
fs.open = (path, flags, ...rest2) => {
|
|
9136
|
+
const truncates = typeof path === "string" && typeof flags === "number" && flags & O_TRUNC2;
|
|
9137
|
+
const kept = truncates && namesFifo(fs, path) ? flags & ~O_TRUNC2 : flags;
|
|
9138
|
+
return open.call(Fs, path, kept, ...rest2);
|
|
9139
|
+
};
|
|
9140
|
+
}
|
|
9038
9141
|
function useDevRemoval(Fs) {
|
|
9039
9142
|
const fs = Fs;
|
|
9040
9143
|
for (const name2 of ["unlink", "rmdir"]) {
|
|
@@ -9346,7 +9449,7 @@ function linuxDevices(Fs) {
|
|
|
9346
9449
|
}
|
|
9347
9450
|
}
|
|
9348
9451
|
}
|
|
9349
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
9452
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
9350
9453
|
var init_process_fds = __esm({
|
|
9351
9454
|
"src/process/process-fds.ts"() {
|
|
9352
9455
|
"use strict";
|
|
@@ -9404,6 +9507,9 @@ var init_process_fds = __esm({
|
|
|
9404
9507
|
DIR_MODE = 16749;
|
|
9405
9508
|
LINK_MODE = 41408;
|
|
9406
9509
|
CHAR_DEVICE = 8630;
|
|
9510
|
+
O_TRUNC2 = 512;
|
|
9511
|
+
S_IFMT_BITS = 61440;
|
|
9512
|
+
S_IFIFO_BITS = 4096;
|
|
9407
9513
|
O_ACCMODE3 = 3;
|
|
9408
9514
|
O_CREAT = 64;
|
|
9409
9515
|
O_EXCL = 128;
|
|
@@ -11851,7 +11957,7 @@ function datesOf(real) {
|
|
|
11851
11957
|
dates[key] = new Date(value2);
|
|
11852
11958
|
return dates;
|
|
11853
11959
|
}
|
|
11854
|
-
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK2, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH2, STRERROR, CLIPBOARD_PATH2, O_CREAT2, O_EXCL2, O_NOCTTY,
|
|
11960
|
+
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK2, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH2, STRERROR, CLIPBOARD_PATH2, O_CREAT2, O_EXCL2, O_NOCTTY, O_TRUNC3, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
|
|
11855
11961
|
var init_kernel_streams = __esm({
|
|
11856
11962
|
"src/process/kernel-streams.ts"() {
|
|
11857
11963
|
"use strict";
|
|
@@ -11883,7 +11989,7 @@ var init_kernel_streams = __esm({
|
|
|
11883
11989
|
O_CREAT2 = 64;
|
|
11884
11990
|
O_EXCL2 = 128;
|
|
11885
11991
|
O_NOCTTY = 256;
|
|
11886
|
-
|
|
11992
|
+
O_TRUNC3 = 512;
|
|
11887
11993
|
O_DIRECTORY = 65536;
|
|
11888
11994
|
KILLED_BY_SIGPIPE = 128 + 13;
|
|
11889
11995
|
ProcessExit = class extends Error {
|
|
@@ -11921,6 +12027,13 @@ var init_kernel_streams = __esm({
|
|
|
11921
12027
|
if (terminal ?? this.sys.isatty?.(kfd) ?? false) stream.tty = this.ttyOps(kfd);
|
|
11922
12028
|
else delete stream.tty;
|
|
11923
12029
|
}
|
|
12030
|
+
attachFifo(stream, path) {
|
|
12031
|
+
const kfd = this.call(
|
|
12032
|
+
() => this.restarting(() => this.sys.openVfs(path, stream.flags, 0, { fifo: true }))
|
|
12033
|
+
);
|
|
12034
|
+
this.attach(stream, kfd, false);
|
|
12035
|
+
stream.sliccKernelFifo = path;
|
|
12036
|
+
}
|
|
11924
12037
|
attachSocket(stream, kfd) {
|
|
11925
12038
|
this.attach(stream, kfd, false);
|
|
11926
12039
|
stream.sliccKernelSocket = true;
|
|
@@ -12230,7 +12343,7 @@ var init_kernel_streams = __esm({
|
|
|
12230
12343
|
vessel(open, kfd, at, terminal) {
|
|
12231
12344
|
let stream;
|
|
12232
12345
|
try {
|
|
12233
|
-
stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 |
|
|
12346
|
+
stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 | O_TRUNC3), at.mode);
|
|
12234
12347
|
} catch (e) {
|
|
12235
12348
|
this.sys.close(kfd);
|
|
12236
12349
|
throw e;
|
|
@@ -12476,7 +12589,8 @@ function kernelEntry2(stream, kernel) {
|
|
|
12476
12589
|
const device2 = stream.path === void 0 ? void 0 : NAMED_DEVICES[stream.path];
|
|
12477
12590
|
const kind = stream.sliccKernelFile ? "file" : stream.tty ? "tty" : device2 ?? "stream";
|
|
12478
12591
|
const access = kind === "tty" ? O_RDWR4 : (stream.flags ?? O_RDWR4) & O_ACCMODE4;
|
|
12479
|
-
|
|
12592
|
+
const fifo = stream.sliccKernelFifo ? { fifo: stream.sliccKernelFifo } : {};
|
|
12593
|
+
return { fd: stream.fd, kernel, kind, flags: access, ...cloexec, ...fifo };
|
|
12480
12594
|
}
|
|
12481
12595
|
function describeInherited(Fs, sys, streams2, livePath, actions = []) {
|
|
12482
12596
|
const table = /* @__PURE__ */ new Map();
|
|
@@ -12556,6 +12670,7 @@ function placeKernelStream(Fs, streams2, entry) {
|
|
|
12556
12670
|
if (entry.kind === "tty") streams2.nameTerminal(stream);
|
|
12557
12671
|
if (entry.kind === "stream") {
|
|
12558
12672
|
asFifo(stream, streams2, entry.desc !== void 0 ? `d${entry.desc}` : `k${entry.kernel}`);
|
|
12673
|
+
if (entry.fifo) stream.path = entry.fifo;
|
|
12559
12674
|
}
|
|
12560
12675
|
setCloseOnExec(stream, entry.cloexec === true);
|
|
12561
12676
|
return stream;
|
|
@@ -12569,7 +12684,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
12569
12684
|
} else {
|
|
12570
12685
|
const placed = place(
|
|
12571
12686
|
Fs,
|
|
12572
|
-
Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 |
|
|
12687
|
+
Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 | O_TRUNC4)),
|
|
12573
12688
|
entry.fd
|
|
12574
12689
|
);
|
|
12575
12690
|
setCloseOnExec(placed, (entry.flags & O_CLOEXEC) !== 0);
|
|
@@ -12578,7 +12693,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
12578
12693
|
}
|
|
12579
12694
|
}
|
|
12580
12695
|
}
|
|
12581
|
-
var O_RDWR4, O_ACCMODE4, O_CREAT3, O_EXCL3,
|
|
12696
|
+
var O_RDWR4, O_ACCMODE4, O_CREAT3, O_EXCL3, O_TRUNC4, PLACEHOLDER_DIR, NAMED_DEVICES, ACCESS, DEVICES2, FIFO_MODE, nextStreamIno, streamInos;
|
|
12582
12697
|
var init_process_fork = __esm({
|
|
12583
12698
|
"src/process/process-fork.ts"() {
|
|
12584
12699
|
"use strict";
|
|
@@ -12587,7 +12702,7 @@ var init_process_fork = __esm({
|
|
|
12587
12702
|
O_ACCMODE4 = 3;
|
|
12588
12703
|
O_CREAT3 = 64;
|
|
12589
12704
|
O_EXCL3 = 128;
|
|
12590
|
-
|
|
12705
|
+
O_TRUNC4 = 512;
|
|
12591
12706
|
PLACEHOLDER_DIR = "/dev/slicc-fd";
|
|
12592
12707
|
NAMED_DEVICES = {
|
|
12593
12708
|
"/dev/sealed": "sealed",
|
|
@@ -13268,7 +13383,8 @@ function kernelSys(transport) {
|
|
|
13268
13383
|
...opts?.create ? { create: true } : {},
|
|
13269
13384
|
...opts?.created ? { created: true } : {},
|
|
13270
13385
|
...opts?.pin ? { pin: opts.pin } : {},
|
|
13271
|
-
...opts?.handle !== void 0 ? { handle: opts.handle } : {}
|
|
13386
|
+
...opts?.handle !== void 0 ? { handle: opts.handle } : {},
|
|
13387
|
+
...opts?.fifo ? { fifo: true } : {}
|
|
13272
13388
|
},
|
|
13273
13389
|
`fd-open-vfs ${path}`
|
|
13274
13390
|
)
|
|
@@ -13672,6 +13788,7 @@ async function runWasmProcess(init, port3, deps = {}) {
|
|
|
13672
13788
|
streams2.useKernelFdMetadata();
|
|
13673
13789
|
useDevFd(running.FS);
|
|
13674
13790
|
useDevRemoval(running.FS);
|
|
13791
|
+
useFifoOpens(running.FS, (stream, path) => streams2.attachFifo(stream, path));
|
|
13675
13792
|
useFileMmap(running.FS, {
|
|
13676
13793
|
sys,
|
|
13677
13794
|
memory: () => memory,
|
|
@@ -15727,6 +15844,7 @@ function wireSignals(host, gate) {
|
|
|
15727
15844
|
host.interrupted = () => gate.interrupt();
|
|
15728
15845
|
host.raisedOnEntry = () => gate.raisedOnEntry();
|
|
15729
15846
|
host.quietly = (fn) => gate.quiet(fn);
|
|
15847
|
+
host.fds.restartable = () => gate.restartable();
|
|
15730
15848
|
}
|
|
15731
15849
|
function catchUpFirst(host, sync) {
|
|
15732
15850
|
return sync && (() => host.quietly(() => sync.current()));
|
|
@@ -16319,7 +16437,7 @@ var init_wasi_runtime = __esm({
|
|
|
16319
16437
|
UNDELIVERED = {
|
|
16320
16438
|
[PREVIEW1]: ["proc_exit", "clock_time_get"],
|
|
16321
16439
|
[WASIX]: ["proc_exit2", "thread_exit", "thread_spawn_v2", "callback_signal"],
|
|
16322
|
-
[SLICC]: ["sigaction_set"],
|
|
16440
|
+
[SLICC]: ["sigaction_set", "siginfo_take"],
|
|
16323
16441
|
wasi: ["thread-spawn"]
|
|
16324
16442
|
};
|
|
16325
16443
|
DELIVERED = [PREVIEW1, WASIX, SLICC, SLICC_FS, SLICC_TTY];
|