@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
package/dist/process-worker.js
CHANGED
|
@@ -328,7 +328,7 @@ function signalsIn(mask) {
|
|
|
328
328
|
for (let sig = 1; sig <= 31; sig++) if (mask & sigbit(sig)) out.push(sig);
|
|
329
329
|
return out;
|
|
330
330
|
}
|
|
331
|
-
var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME;
|
|
331
|
+
var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME, SI, KERNEL_SIGINFO;
|
|
332
332
|
var init_signals = __esm({
|
|
333
333
|
"src/kernel/signals.ts"() {
|
|
334
334
|
"use strict";
|
|
@@ -374,6 +374,13 @@ var init_signals = __esm({
|
|
|
374
374
|
SIGSTOP: SIG.STOP,
|
|
375
375
|
SIGCONT: SIG.CONT
|
|
376
376
|
};
|
|
377
|
+
SI = { USER: 0, QUEUE: -1, TIMER: -2, TKILL: -6, KERNEL: 128 };
|
|
378
|
+
KERNEL_SIGINFO = Object.freeze({
|
|
379
|
+
code: SI.KERNEL,
|
|
380
|
+
pid: 0,
|
|
381
|
+
uid: 0,
|
|
382
|
+
status: 0
|
|
383
|
+
});
|
|
377
384
|
}
|
|
378
385
|
});
|
|
379
386
|
|
|
@@ -942,6 +949,7 @@ function parseSyncFsStat(json2) {
|
|
|
942
949
|
isDirectory: s.isDirectory,
|
|
943
950
|
isSymbolicLink: s.isSymbolicLink,
|
|
944
951
|
...s.isSocket === true ? { isSocket: true } : {},
|
|
952
|
+
...s.isFifo === true ? { isFifo: true } : {},
|
|
945
953
|
size: s.size,
|
|
946
954
|
...typeof s.mode === "number" ? { mode: s.mode } : {},
|
|
947
955
|
...typeof s.mtimeMs === "number" ? { mtimeMs: s.mtimeMs } : {},
|
|
@@ -985,6 +993,7 @@ var init_sync_fs_wire = __esm({
|
|
|
985
993
|
"statfs",
|
|
986
994
|
"hold",
|
|
987
995
|
"create",
|
|
996
|
+
"mkfifo",
|
|
988
997
|
"kept",
|
|
989
998
|
"pread",
|
|
990
999
|
"pwrite",
|
|
@@ -1268,6 +1277,9 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
1268
1277
|
lutimes: (path, atimeMs, mtimeMs, now) => {
|
|
1269
1278
|
run({ op: "lutimes", path, atimeMs, mtimeMs, ...now ? { now } : {} }, path);
|
|
1270
1279
|
},
|
|
1280
|
+
mkfifo: (path, mode) => {
|
|
1281
|
+
run({ op: "mkfifo", path, mode }, path);
|
|
1282
|
+
},
|
|
1271
1283
|
create: (path, mode, opening2) => {
|
|
1272
1284
|
const flags = { ...mode !== void 0 ? { mode } : {}, ...opening2 ? { opening: opening2 } : {} };
|
|
1273
1285
|
run({ op: "create", path, ...flags }, path);
|
|
@@ -1341,7 +1353,7 @@ function exactIn(node) {
|
|
|
1341
1353
|
return node?.mount.opts.bridge.owners === true;
|
|
1342
1354
|
}
|
|
1343
1355
|
function modeFromStat(st, exact = false) {
|
|
1344
|
-
const type = st.isSymbolicLink ? S_IFLNK : st.isDirectory ? S_IFDIR : st.isSocket ? S_IFSOCK : S_IFREG;
|
|
1356
|
+
const type = st.isSymbolicLink ? S_IFLNK : st.isDirectory ? S_IFDIR : st.isSocket ? S_IFSOCK : st.isFifo ? S_IFIFO : S_IFREG;
|
|
1345
1357
|
const fallback = st.isDirectory || st.isSymbolicLink ? 511 : 438;
|
|
1346
1358
|
const perm = (st.mode ?? fallback) & PERM_MASK;
|
|
1347
1359
|
return type | (exact ? perm : perm || fallback);
|
|
@@ -1749,11 +1761,14 @@ function createNodeOps(h) {
|
|
|
1749
1761
|
call2(
|
|
1750
1762
|
() => bridge.create ? bridge.create(path, perm, opening.get(h.Fs) > 0) : bridge.writeFile(path, new Uint8Array(0))
|
|
1751
1763
|
);
|
|
1764
|
+
} else if ((mode & S_IFMT) === S_IFIFO && bridge.mkfifo) {
|
|
1765
|
+
call2(() => bridge.mkfifo?.(path, mode & PERM_MASK));
|
|
1752
1766
|
} else {
|
|
1753
1767
|
throw new Fs.ErrnoError(wasiErrno("EPERM"));
|
|
1754
1768
|
}
|
|
1755
1769
|
const node = makeNode(parent, name2, {
|
|
1756
1770
|
isFile: Fs.isFile(mode),
|
|
1771
|
+
...(mode & S_IFMT) === S_IFIFO ? { isFifo: true } : {},
|
|
1757
1772
|
isDirectory: Fs.isDir(mode),
|
|
1758
1773
|
isSymbolicLink: false,
|
|
1759
1774
|
size: 0,
|
|
@@ -1886,7 +1901,18 @@ function createStreamOps(h) {
|
|
|
1886
1901
|
}
|
|
1887
1902
|
return want;
|
|
1888
1903
|
};
|
|
1904
|
+
const fifo = (stream) => {
|
|
1905
|
+
const open = h.Fs.sliccOpenFifo;
|
|
1906
|
+
try {
|
|
1907
|
+
if (!open) throw new Fs.ErrnoError(wasiErrno("ENXIO"));
|
|
1908
|
+
open.call(h.Fs, stream, liveNodePath(stream.node));
|
|
1909
|
+
} catch (err) {
|
|
1910
|
+
if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
|
|
1911
|
+
throw err;
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1889
1914
|
const directory = (stream) => {
|
|
1915
|
+
if ((stream.node.mode & S_IFMT) === S_IFIFO && !(stream.flags & O_PATH)) return fifo(stream);
|
|
1890
1916
|
if ((stream.node.mode & S_IFMT) === S_IFSOCK && !(stream.flags & O_PATH)) {
|
|
1891
1917
|
if (stream.fd !== void 0) Fs.closeStream?.(stream.fd);
|
|
1892
1918
|
throw new Fs.ErrnoError(wasiErrno("ENXIO"));
|
|
@@ -2368,7 +2394,7 @@ function readingLinks(Fs) {
|
|
|
2368
2394
|
}
|
|
2369
2395
|
};
|
|
2370
2396
|
}
|
|
2371
|
-
var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
|
|
2397
|
+
var S_IFDIR, S_IFREG, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFMT, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
|
|
2372
2398
|
var init_live_vfs_fs = __esm({
|
|
2373
2399
|
"src/realm/live-vfs-fs.ts"() {
|
|
2374
2400
|
"use strict";
|
|
@@ -2382,6 +2408,7 @@ var init_live_vfs_fs = __esm({
|
|
|
2382
2408
|
S_IFREG = 32768;
|
|
2383
2409
|
S_IFLNK = 40960;
|
|
2384
2410
|
S_IFSOCK = 49152;
|
|
2411
|
+
S_IFIFO = 4096;
|
|
2385
2412
|
S_IFMT = 61440;
|
|
2386
2413
|
PERM_MASK = 4095;
|
|
2387
2414
|
DEFAULT_DIR_PERM = 493;
|
|
@@ -2515,7 +2542,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2515
2542
|
var init_version = __esm({
|
|
2516
2543
|
"src/version.ts"() {
|
|
2517
2544
|
"use strict";
|
|
2518
|
-
KERNEL_VERSION = true ? "1.
|
|
2545
|
+
KERNEL_VERSION = true ? "1.115.0" : "0.0.0-dev";
|
|
2519
2546
|
OS_RELEASE = "6.0.0-slicc";
|
|
2520
2547
|
}
|
|
2521
2548
|
});
|
|
@@ -3149,6 +3176,25 @@ function useZeroDevices(Fs) {
|
|
|
3149
3176
|
mkdev.call(Fs, path, CHAR_DEVICE, dev);
|
|
3150
3177
|
}
|
|
3151
3178
|
}
|
|
3179
|
+
function namesFifo(fs, path) {
|
|
3180
|
+
try {
|
|
3181
|
+
const { node } = fs.lookupPath?.(path, { follow: true }) ?? { node: { mode: 0 } };
|
|
3182
|
+
return (node.mode & S_IFMT_BITS) === S_IFIFO_BITS;
|
|
3183
|
+
} catch {
|
|
3184
|
+
return false;
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
function useFifoOpens(Fs, attach) {
|
|
3188
|
+
const fs = Fs;
|
|
3189
|
+
if (attach) fs.sliccOpenFifo = attach;
|
|
3190
|
+
const open = fs.open;
|
|
3191
|
+
if (typeof open !== "function" || typeof fs.lookupPath !== "function") return;
|
|
3192
|
+
fs.open = (path, flags, ...rest2) => {
|
|
3193
|
+
const truncates = typeof path === "string" && typeof flags === "number" && flags & O_TRUNC2;
|
|
3194
|
+
const kept = truncates && namesFifo(fs, path) ? flags & ~O_TRUNC2 : flags;
|
|
3195
|
+
return open.call(Fs, path, kept, ...rest2);
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3152
3198
|
function useDevRemoval(Fs) {
|
|
3153
3199
|
const fs = Fs;
|
|
3154
3200
|
for (const name2 of ["unlink", "rmdir"]) {
|
|
@@ -3463,7 +3509,7 @@ function linuxDevices(Fs) {
|
|
|
3463
3509
|
}
|
|
3464
3510
|
}
|
|
3465
3511
|
}
|
|
3466
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3512
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, 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_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3467
3513
|
var init_process_fds = __esm({
|
|
3468
3514
|
"src/process/process-fds.ts"() {
|
|
3469
3515
|
"use strict";
|
|
@@ -3521,6 +3567,9 @@ var init_process_fds = __esm({
|
|
|
3521
3567
|
DIR_MODE = 16749;
|
|
3522
3568
|
LINK_MODE = 41408;
|
|
3523
3569
|
CHAR_DEVICE = 8630;
|
|
3570
|
+
O_TRUNC2 = 512;
|
|
3571
|
+
S_IFMT_BITS = 61440;
|
|
3572
|
+
S_IFIFO_BITS = 4096;
|
|
3524
3573
|
O_ACCMODE3 = 3;
|
|
3525
3574
|
O_CREAT = 64;
|
|
3526
3575
|
O_EXCL = 128;
|
|
@@ -3673,7 +3722,7 @@ function datesOf(real) {
|
|
|
3673
3722
|
dates[key] = new Date(value2);
|
|
3674
3723
|
return dates;
|
|
3675
3724
|
}
|
|
3676
|
-
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, O_CREAT2, O_EXCL2, O_NOCTTY,
|
|
3725
|
+
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, O_CREAT2, O_EXCL2, O_NOCTTY, O_TRUNC3, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
|
|
3677
3726
|
var init_kernel_streams = __esm({
|
|
3678
3727
|
"src/process/kernel-streams.ts"() {
|
|
3679
3728
|
"use strict";
|
|
@@ -3705,7 +3754,7 @@ var init_kernel_streams = __esm({
|
|
|
3705
3754
|
O_CREAT2 = 64;
|
|
3706
3755
|
O_EXCL2 = 128;
|
|
3707
3756
|
O_NOCTTY = 256;
|
|
3708
|
-
|
|
3757
|
+
O_TRUNC3 = 512;
|
|
3709
3758
|
O_DIRECTORY = 65536;
|
|
3710
3759
|
KILLED_BY_SIGPIPE = 128 + 13;
|
|
3711
3760
|
ProcessExit = class extends Error {
|
|
@@ -3743,6 +3792,13 @@ var init_kernel_streams = __esm({
|
|
|
3743
3792
|
if (terminal ?? this.sys.isatty?.(kfd) ?? false) stream.tty = this.ttyOps(kfd);
|
|
3744
3793
|
else delete stream.tty;
|
|
3745
3794
|
}
|
|
3795
|
+
attachFifo(stream, path) {
|
|
3796
|
+
const kfd = this.call(
|
|
3797
|
+
() => this.restarting(() => this.sys.openVfs(path, stream.flags, 0, { fifo: true }))
|
|
3798
|
+
);
|
|
3799
|
+
this.attach(stream, kfd, false);
|
|
3800
|
+
stream.sliccKernelFifo = path;
|
|
3801
|
+
}
|
|
3746
3802
|
attachSocket(stream, kfd) {
|
|
3747
3803
|
this.attach(stream, kfd, false);
|
|
3748
3804
|
stream.sliccKernelSocket = true;
|
|
@@ -4052,7 +4108,7 @@ var init_kernel_streams = __esm({
|
|
|
4052
4108
|
vessel(open, kfd, at, terminal) {
|
|
4053
4109
|
let stream;
|
|
4054
4110
|
try {
|
|
4055
|
-
stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 |
|
|
4111
|
+
stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 | O_TRUNC3), at.mode);
|
|
4056
4112
|
} catch (e) {
|
|
4057
4113
|
this.sys.close(kfd);
|
|
4058
4114
|
throw e;
|
|
@@ -4298,7 +4354,8 @@ function kernelEntry(stream, kernel) {
|
|
|
4298
4354
|
const device2 = stream.path === void 0 ? void 0 : NAMED_DEVICES[stream.path];
|
|
4299
4355
|
const kind = stream.sliccKernelFile ? "file" : stream.tty ? "tty" : device2 ?? "stream";
|
|
4300
4356
|
const access = kind === "tty" ? O_RDWR : (stream.flags ?? O_RDWR) & O_ACCMODE4;
|
|
4301
|
-
|
|
4357
|
+
const fifo = stream.sliccKernelFifo ? { fifo: stream.sliccKernelFifo } : {};
|
|
4358
|
+
return { fd: stream.fd, kernel, kind, flags: access, ...cloexec, ...fifo };
|
|
4302
4359
|
}
|
|
4303
4360
|
function describeInherited(Fs, sys, streams2, livePath, actions = []) {
|
|
4304
4361
|
const table = /* @__PURE__ */ new Map();
|
|
@@ -4378,6 +4435,7 @@ function placeKernelStream(Fs, streams2, entry) {
|
|
|
4378
4435
|
if (entry.kind === "tty") streams2.nameTerminal(stream);
|
|
4379
4436
|
if (entry.kind === "stream") {
|
|
4380
4437
|
asFifo(stream, streams2, entry.desc !== void 0 ? `d${entry.desc}` : `k${entry.kernel}`);
|
|
4438
|
+
if (entry.fifo) stream.path = entry.fifo;
|
|
4381
4439
|
}
|
|
4382
4440
|
setCloseOnExec(stream, entry.cloexec === true);
|
|
4383
4441
|
return stream;
|
|
@@ -4391,7 +4449,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
4391
4449
|
} else {
|
|
4392
4450
|
const placed = place(
|
|
4393
4451
|
Fs,
|
|
4394
|
-
Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 |
|
|
4452
|
+
Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 | O_TRUNC4)),
|
|
4395
4453
|
entry.fd
|
|
4396
4454
|
);
|
|
4397
4455
|
setCloseOnExec(placed, (entry.flags & O_CLOEXEC) !== 0);
|
|
@@ -4400,7 +4458,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
4400
4458
|
}
|
|
4401
4459
|
}
|
|
4402
4460
|
}
|
|
4403
|
-
var O_RDWR, O_ACCMODE4, O_CREAT3, O_EXCL3,
|
|
4461
|
+
var O_RDWR, O_ACCMODE4, O_CREAT3, O_EXCL3, O_TRUNC4, PLACEHOLDER_DIR, NAMED_DEVICES, ACCESS, DEVICES, FIFO_MODE, nextStreamIno, streamInos;
|
|
4404
4462
|
var init_process_fork = __esm({
|
|
4405
4463
|
"src/process/process-fork.ts"() {
|
|
4406
4464
|
"use strict";
|
|
@@ -4409,7 +4467,7 @@ var init_process_fork = __esm({
|
|
|
4409
4467
|
O_ACCMODE4 = 3;
|
|
4410
4468
|
O_CREAT3 = 64;
|
|
4411
4469
|
O_EXCL3 = 128;
|
|
4412
|
-
|
|
4470
|
+
O_TRUNC4 = 512;
|
|
4413
4471
|
PLACEHOLDER_DIR = "/dev/slicc-fd";
|
|
4414
4472
|
NAMED_DEVICES = {
|
|
4415
4473
|
"/dev/sealed": "sealed",
|
|
@@ -5504,7 +5562,8 @@ function kernelSys(transport) {
|
|
|
5504
5562
|
...opts?.create ? { create: true } : {},
|
|
5505
5563
|
...opts?.created ? { created: true } : {},
|
|
5506
5564
|
...opts?.pin ? { pin: opts.pin } : {},
|
|
5507
|
-
...opts?.handle !== void 0 ? { handle: opts.handle } : {}
|
|
5565
|
+
...opts?.handle !== void 0 ? { handle: opts.handle } : {},
|
|
5566
|
+
...opts?.fifo ? { fifo: true } : {}
|
|
5508
5567
|
},
|
|
5509
5568
|
`fd-open-vfs ${path}`
|
|
5510
5569
|
)
|
|
@@ -5908,6 +5967,7 @@ async function runWasmProcess(init, port2, deps = {}) {
|
|
|
5908
5967
|
streams2.useKernelFdMetadata();
|
|
5909
5968
|
useDevFd(running.FS);
|
|
5910
5969
|
useDevRemoval(running.FS);
|
|
5970
|
+
useFifoOpens(running.FS, (stream, path) => streams2.attachFifo(stream, path));
|
|
5911
5971
|
useFileMmap(running.FS, {
|
|
5912
5972
|
sys,
|
|
5913
5973
|
memory: () => memory,
|
|
@@ -7709,6 +7769,7 @@ var init_wasi_fds = __esm({
|
|
|
7709
7769
|
return this.regular(path, s, oflags, rights, fdflags, mode);
|
|
7710
7770
|
}
|
|
7711
7771
|
regular(path, s, oflags, rights, fdflags, mode) {
|
|
7772
|
+
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
7712
7773
|
if (this.shared || this.kernelHolds(path, s)) {
|
|
7713
7774
|
return this.kernelFile(path, s, oflags, rights, fdflags, mode);
|
|
7714
7775
|
}
|
|
@@ -7803,6 +7864,28 @@ var init_wasi_fds = __esm({
|
|
|
7803
7864
|
this.bump(fd);
|
|
7804
7865
|
return fd;
|
|
7805
7866
|
}
|
|
7867
|
+
kernelFifo(path, existing, oflags, rights, fdflags) {
|
|
7868
|
+
const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
|
|
7869
|
+
const nonblock = (fdflags & FDFLAGS.NONBLOCK) !== 0;
|
|
7870
|
+
const access = writable2 ? readable3 ? O_RDWR4 : O_WRONLY4 : 0;
|
|
7871
|
+
const fd = this.restarting(
|
|
7872
|
+
() => this.kernel.sys.openVfs(path, access | (nonblock ? O_NONBLOCK2 : 0), 0, { fifo: true })
|
|
7873
|
+
);
|
|
7874
|
+
this.table.set(fd, { type: "kernel", kind: "stream", nonblock, append: false });
|
|
7875
|
+
if (nonblock) this.publishFlags(fd, { nonblock, append: false });
|
|
7876
|
+
this.bump(fd);
|
|
7877
|
+
return fd;
|
|
7878
|
+
}
|
|
7879
|
+
restartable;
|
|
7880
|
+
restarting(call2) {
|
|
7881
|
+
for (; ; ) {
|
|
7882
|
+
try {
|
|
7883
|
+
return call2();
|
|
7884
|
+
} catch (err) {
|
|
7885
|
+
if (err.code !== "EINTR" || !this.restartable?.()) throw err;
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
}
|
|
7806
7889
|
createNew(path, oflags, mode) {
|
|
7807
7890
|
if (!this.fs.create) {
|
|
7808
7891
|
this.fs.writeFile(path, new Uint8Array(0));
|
|
@@ -8784,7 +8867,7 @@ function wrap(table) {
|
|
|
8784
8867
|
}
|
|
8785
8868
|
return out;
|
|
8786
8869
|
}
|
|
8787
|
-
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE,
|
|
8870
|
+
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO2, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
8788
8871
|
var init_wasi_host = __esm({
|
|
8789
8872
|
"src/process/wasi/wasi-host.ts"() {
|
|
8790
8873
|
"use strict";
|
|
@@ -8818,11 +8901,12 @@ var init_wasi_host = __esm({
|
|
|
8818
8901
|
AT_EACCESS2 = 2;
|
|
8819
8902
|
ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
|
|
8820
8903
|
GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
|
|
8821
|
-
|
|
8904
|
+
S_IFIFO2 = 4096;
|
|
8822
8905
|
S_IFLNK2 = 40960;
|
|
8823
8906
|
DEFAULT_UMASK = 18;
|
|
8824
8907
|
MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS4;
|
|
8825
8908
|
MAX_READ = 1024 * 1024;
|
|
8909
|
+
SIGINFO_BYTES = 24;
|
|
8826
8910
|
FD_ALIAS = /^\/(?:dev\/(stdin|stdout|stderr)|dev\/fd\/(\d+)|proc\/(self|[1-9]\d*)\/fd\/(\d+))$/;
|
|
8827
8911
|
STDIO_FDS = { stdin: 0, stdout: 1, stderr: 2 };
|
|
8828
8912
|
SIGPIPE_EXIT = 128 + SIG.PIPE;
|
|
@@ -8940,7 +9024,7 @@ var init_wasi_host = __esm({
|
|
|
8940
9024
|
const fdMode = (fd) => {
|
|
8941
9025
|
const e = fds.get(fd);
|
|
8942
9026
|
const kind = e.type === "kernel" ? fds.kind(fd, e) : void 0;
|
|
8943
|
-
if (kind === "stream") return
|
|
9027
|
+
if (kind === "stream") return S_IFIFO2 | 384;
|
|
8944
9028
|
if (kind === "sealed" || kind === "clipboard") return SEALED_MODE;
|
|
8945
9029
|
return modeOf2(this.o.fs.stat(pathOf(fd)));
|
|
8946
9030
|
};
|
|
@@ -9015,7 +9099,7 @@ var init_wasi_host = __esm({
|
|
|
9015
9099
|
if (this.synthetic(path) && deviceOf(path) === void 0)
|
|
9016
9100
|
return void mem.view().setUint32(out, SEALED_MODE, true);
|
|
9017
9101
|
const st = flags & AT_SYMLINK_NOFOLLOW2 ? this.o.fs.lstat(path) : this.o.fs.stat(path);
|
|
9018
|
-
mem.view().setUint32(out, modeOf2(st), true);
|
|
9102
|
+
mem.view().setUint32(out, (st.isFifo ? S_IFIFO2 : 0) | modeOf2(st), true);
|
|
9019
9103
|
}
|
|
9020
9104
|
});
|
|
9021
9105
|
}
|
|
@@ -9118,6 +9202,23 @@ var init_wasi_host = __esm({
|
|
|
9118
9202
|
this.entered
|
|
9119
9203
|
);
|
|
9120
9204
|
},
|
|
9205
|
+
sigwait_info: (lo, _hi, timeout, info) => {
|
|
9206
|
+
const mask = this.sigmask;
|
|
9207
|
+
if (!mask) return E.NOSYS;
|
|
9208
|
+
let took = 0;
|
|
9209
|
+
const r = mask.sigwait(
|
|
9210
|
+
lo,
|
|
9211
|
+
timeout,
|
|
9212
|
+
(set) => void this.o.kernel.call({ op: "sig-waiting", tid: mask.tid, set }),
|
|
9213
|
+
(sig) => {
|
|
9214
|
+
took = sig;
|
|
9215
|
+
},
|
|
9216
|
+
this.entered
|
|
9217
|
+
);
|
|
9218
|
+
if (r === E.SUCCESS) this.writeSiginfo(info, took, mask.tid);
|
|
9219
|
+
return r;
|
|
9220
|
+
},
|
|
9221
|
+
siginfo_take: (sig, info) => this.writeSiginfo(info, sig, this.sigmask?.tid ?? this.tid, false) ? E.SUCCESS : E.NOENT,
|
|
9121
9222
|
sigaction_inherited: (out) => {
|
|
9122
9223
|
const bits = this.o.kernel.call({ op: "sig-inherited" });
|
|
9123
9224
|
mem.view().setBigUint64(out, BigInt(libcBits(bits) >>> 0), true);
|
|
@@ -9712,6 +9813,22 @@ var init_wasi_host = __esm({
|
|
|
9712
9813
|
return void 0;
|
|
9713
9814
|
}
|
|
9714
9815
|
}
|
|
9816
|
+
writeSiginfo(at, sig, tid, waited = true) {
|
|
9817
|
+
const taken = this.o.kernel.call({ op: "sig-info", sig, tid });
|
|
9818
|
+
if (!taken && !waited) return false;
|
|
9819
|
+
const info = taken ?? KERNEL_SIGINFO;
|
|
9820
|
+
const view = this.mem.view();
|
|
9821
|
+
const size = Math.min(view.getUint32(at, true), SIGINFO_BYTES);
|
|
9822
|
+
const fields = [sig, info.code, info.pid, info.uid, info.status];
|
|
9823
|
+
let filled = 4;
|
|
9824
|
+
for (const [i, value2] of fields.entries()) {
|
|
9825
|
+
if (4 + (i + 1) * 4 > size) break;
|
|
9826
|
+
view.setInt32(4 + at + i * 4, value2, true);
|
|
9827
|
+
filled = 4 + (i + 1) * 4;
|
|
9828
|
+
}
|
|
9829
|
+
view.setUint32(at, filled, true);
|
|
9830
|
+
return true;
|
|
9831
|
+
}
|
|
9715
9832
|
fdAlias(path) {
|
|
9716
9833
|
const m = FD_ALIAS.exec(path);
|
|
9717
9834
|
if (!m) return void 0;
|
|
@@ -12573,6 +12690,7 @@ function wireSignals(host, gate) {
|
|
|
12573
12690
|
host.interrupted = () => gate.interrupt();
|
|
12574
12691
|
host.raisedOnEntry = () => gate.raisedOnEntry();
|
|
12575
12692
|
host.quietly = (fn) => gate.quiet(fn);
|
|
12693
|
+
host.fds.restartable = () => gate.restartable();
|
|
12576
12694
|
}
|
|
12577
12695
|
function catchUpFirst(host, sync) {
|
|
12578
12696
|
return sync && (() => host.quietly(() => sync.current()));
|
|
@@ -13165,7 +13283,7 @@ var init_wasi_runtime = __esm({
|
|
|
13165
13283
|
UNDELIVERED = {
|
|
13166
13284
|
[PREVIEW1]: ["proc_exit", "clock_time_get"],
|
|
13167
13285
|
[WASIX]: ["proc_exit2", "thread_exit", "thread_spawn_v2", "callback_signal"],
|
|
13168
|
-
[SLICC]: ["sigaction_set"],
|
|
13286
|
+
[SLICC]: ["sigaction_set", "siginfo_take"],
|
|
13169
13287
|
wasi: ["thread-spawn"]
|
|
13170
13288
|
};
|
|
13171
13289
|
DELIVERED = [PREVIEW1, WASIX, SLICC, SLICC_FS, SLICC_TTY];
|