@ai-ecoverse/slicc-kernel 1.42.3 → 1.43.1
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 +2 -1
- package/dist/kernel-worker.js +11 -2
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +71 -12
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +11 -2
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +71 -12
- package/dist/process-worker.js.map +2 -2
- package/package.json +3 -3
package/dist/process-worker.js
CHANGED
|
@@ -3237,10 +3237,12 @@ var init_process_signals = __esm({
|
|
|
3237
3237
|
}
|
|
3238
3238
|
if (!masks) return;
|
|
3239
3239
|
this.restart = masks.restart;
|
|
3240
|
-
const { caught, ignored } = masks;
|
|
3241
|
-
|
|
3240
|
+
const { caught, ignored, defaults = 0 } = masks;
|
|
3241
|
+
const same = caught === this.reported.caught && ignored === this.reported.ignored;
|
|
3242
|
+
if (same && defaults === 0) return;
|
|
3242
3243
|
this.reported = { caught, ignored };
|
|
3243
|
-
|
|
3244
|
+
const req = { op: "sig-mask", caught, ignored, ...defaults ? { defaults } : {} };
|
|
3245
|
+
this.raw.call(req, Number.POSITIVE_INFINITY, "sig-mask");
|
|
3244
3246
|
}
|
|
3245
3247
|
quiet(fn) {
|
|
3246
3248
|
this.quieted++;
|
|
@@ -3518,8 +3520,8 @@ function pidStatus(info) {
|
|
|
3518
3520
|
"SigPnd: 0000000000000000",
|
|
3519
3521
|
"ShdPnd: 0000000000000000",
|
|
3520
3522
|
"SigBlk: 0000000000000000",
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
+
`SigIgn: ${sigMask(info.sigIgn)}`,
|
|
3524
|
+
`SigCgt: ${sigMask(info.sigCgt)}`,
|
|
3523
3525
|
""
|
|
3524
3526
|
].join("\n");
|
|
3525
3527
|
}
|
|
@@ -3724,7 +3726,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
3724
3726
|
readdir: (node) => pidNames(selfReaddir ? selfReaddir(node) : [".", ".."])
|
|
3725
3727
|
};
|
|
3726
3728
|
}
|
|
3727
|
-
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, ESRCH, EINVAL, UID, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES;
|
|
3729
|
+
var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, ESRCH, EINVAL, UID, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, sigMask;
|
|
3728
3730
|
var init_procfs = __esm({
|
|
3729
3731
|
"src/process/procfs.ts"() {
|
|
3730
3732
|
"use strict";
|
|
@@ -3741,6 +3743,7 @@ var init_procfs = __esm({
|
|
|
3741
3743
|
FALLBACK_MEMORY = 4 * KIB * KIB * KIB;
|
|
3742
3744
|
PID_FILES = ["cmdline", "comm", "stat", "statm", "status"];
|
|
3743
3745
|
SYSTEM_FILES = ["loadavg", "meminfo", "stat", "uptime"];
|
|
3746
|
+
sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
|
|
3744
3747
|
}
|
|
3745
3748
|
});
|
|
3746
3749
|
|
|
@@ -5481,6 +5484,7 @@ var init_wasi_host = __esm({
|
|
|
5481
5484
|
interruptWakes = false;
|
|
5482
5485
|
onRaise;
|
|
5483
5486
|
muted;
|
|
5487
|
+
signals;
|
|
5484
5488
|
listening;
|
|
5485
5489
|
o;
|
|
5486
5490
|
constructor(o) {
|
|
@@ -5562,7 +5566,8 @@ var init_wasi_host = __esm({
|
|
|
5562
5566
|
flags,
|
|
5563
5567
|
data: mem.string(dp, dl)
|
|
5564
5568
|
}),
|
|
5565
|
-
umount2: (tp, tl, flags) => void this.o.kernel.call({ op: "umount", target: path(tp, tl), flags })
|
|
5569
|
+
umount2: (tp, tl, flags) => void this.o.kernel.call({ op: "umount", target: path(tp, tl), flags }),
|
|
5570
|
+
sigaction_set: (sig, disposition, flags) => this.signals ? this.signals.disposition(sig, disposition, flags) : E.NOSYS
|
|
5566
5571
|
});
|
|
5567
5572
|
}
|
|
5568
5573
|
imports() {
|
|
@@ -6225,14 +6230,20 @@ var init_wasi_module = __esm({
|
|
|
6225
6230
|
});
|
|
6226
6231
|
|
|
6227
6232
|
// src/process/wasi/wasi-signals.ts
|
|
6228
|
-
var DELIVERED_MASK, LIBC_DEFAULT_EXIT, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
|
|
6233
|
+
var DELIVERED_MASK, STOP_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
|
|
6229
6234
|
var init_wasi_signals = __esm({
|
|
6230
6235
|
"src/process/wasi/wasi-signals.ts"() {
|
|
6231
6236
|
"use strict";
|
|
6232
6237
|
init_signals();
|
|
6238
|
+
init_wasi_abi();
|
|
6233
6239
|
init_wasi_host();
|
|
6234
6240
|
DELIVERED_MASK = Object.values(SIG).filter((sig) => sig !== SIG.KILL && sig !== SIG.STOP).reduce((m, sig) => m | sigbit(sig), 0);
|
|
6241
|
+
STOP_DEFAULTS = sigbit(SIG.TSTP) | sigbit(SIG.TTIN) | sigbit(SIG.TTOU);
|
|
6235
6242
|
LIBC_DEFAULT_EXIT = 127;
|
|
6243
|
+
SA_RESTART = 268435456;
|
|
6244
|
+
DISPOSITION_IGNORE = 1;
|
|
6245
|
+
DISPOSITION_HANDLER = 2;
|
|
6246
|
+
withBit = (mask, bit, on) => on ? mask | bit : mask & ~bit;
|
|
6236
6247
|
WASIX_LIBC_DEFAULT_LINE = /^Program recieved (?:stop|termination|fatal) signal: [^\n]+\n$/;
|
|
6237
6248
|
WasiSignals = class {
|
|
6238
6249
|
exports;
|
|
@@ -6241,6 +6252,11 @@ var init_wasi_signals = __esm({
|
|
|
6241
6252
|
delivering;
|
|
6242
6253
|
defaulted = false;
|
|
6243
6254
|
libcDefault = false;
|
|
6255
|
+
hooked = false;
|
|
6256
|
+
handlers = 0;
|
|
6257
|
+
ignoring = 0;
|
|
6258
|
+
restarting = 0;
|
|
6259
|
+
defaults = 0;
|
|
6244
6260
|
fallBack;
|
|
6245
6261
|
onKilled;
|
|
6246
6262
|
constructor(fallBack, onKilled) {
|
|
@@ -6256,9 +6272,45 @@ var init_wasi_signals = __esm({
|
|
|
6256
6272
|
register(name) {
|
|
6257
6273
|
if (typeof this.exports?.[name] === "function") this.callback = name;
|
|
6258
6274
|
}
|
|
6275
|
+
useHook() {
|
|
6276
|
+
this.hooked = true;
|
|
6277
|
+
}
|
|
6278
|
+
disposition(sig, disposition, flags) {
|
|
6279
|
+
if (sig < 1 || sig > 31 || (DELIVERED_MASK & sigbit(sig)) === 0) return E.INVAL;
|
|
6280
|
+
const bit = sigbit(sig);
|
|
6281
|
+
this.handlers = withBit(this.handlers, bit, disposition === DISPOSITION_HANDLER);
|
|
6282
|
+
this.ignoring = withBit(this.ignoring, bit, disposition === DISPOSITION_IGNORE);
|
|
6283
|
+
this.restarting = withBit(this.restarting, bit, (flags & SA_RESTART) !== 0);
|
|
6284
|
+
this.defaults = withBit(this.defaults, bit, disposition === 0);
|
|
6285
|
+
return E.SUCCESS;
|
|
6286
|
+
}
|
|
6287
|
+
snapshot() {
|
|
6288
|
+
return {
|
|
6289
|
+
...this.callback ? { callback: this.callback } : {},
|
|
6290
|
+
...this.hooked ? { hooked: true } : {},
|
|
6291
|
+
handlers: this.handlers,
|
|
6292
|
+
ignoring: this.ignoring,
|
|
6293
|
+
restarting: this.restarting,
|
|
6294
|
+
uncaught: this.uncaught
|
|
6295
|
+
};
|
|
6296
|
+
}
|
|
6297
|
+
restore(state) {
|
|
6298
|
+
if (state.callback) this.register(state.callback);
|
|
6299
|
+
if (state.hooked) this.hooked = true;
|
|
6300
|
+
this.handlers = state.handlers;
|
|
6301
|
+
this.ignoring = state.ignoring;
|
|
6302
|
+
this.restarting = state.restarting;
|
|
6303
|
+
this.uncaught = state.uncaught;
|
|
6304
|
+
}
|
|
6259
6305
|
masks() {
|
|
6306
|
+
if (this.hooked) {
|
|
6307
|
+
const caught = this.handler() ? this.handlers : 0;
|
|
6308
|
+
const defaults = this.defaults;
|
|
6309
|
+
this.defaults = 0;
|
|
6310
|
+
return { caught, ignored: this.ignoring, restart: this.restarting, defaults };
|
|
6311
|
+
}
|
|
6260
6312
|
if (!this.handler()) return null;
|
|
6261
|
-
return { caught: DELIVERED_MASK & ~this.uncaught, ignored: 0, restart: 0 };
|
|
6313
|
+
return { caught: DELIVERED_MASK & ~this.uncaught & ~STOP_DEFAULTS, ignored: 0, restart: 0 };
|
|
6262
6314
|
}
|
|
6263
6315
|
raise(sig) {
|
|
6264
6316
|
const handler = this.handler();
|
|
@@ -7100,7 +7152,8 @@ var init_wasix_process = __esm({
|
|
|
7100
7152
|
cloexec: [...fds.cloexec],
|
|
7101
7153
|
cwd: this.host.cwd,
|
|
7102
7154
|
...fds.isShared ? { shared: true } : {},
|
|
7103
|
-
setjmps: this.driver.setjmps()
|
|
7155
|
+
setjmps: this.driver.setjmps(),
|
|
7156
|
+
...this.host.signals ? { signals: this.host.signals.snapshot() } : {}
|
|
7104
7157
|
};
|
|
7105
7158
|
return this.call({
|
|
7106
7159
|
op: "proc-fork",
|
|
@@ -8133,6 +8186,9 @@ async function runWasiProcess(init, port2) {
|
|
|
8133
8186
|
main.memory = memoryOf(instance, memory);
|
|
8134
8187
|
publishMemory(init.sab, sizeOf(main)());
|
|
8135
8188
|
signals.bind(instance.exports);
|
|
8189
|
+
if (importsSigactionHook(module)) signals.useHook();
|
|
8190
|
+
if (fork?.signals) signals.restore(fork.signals);
|
|
8191
|
+
host.signals = signals;
|
|
8136
8192
|
host.onRaise = (sig) => signals.raised(sig);
|
|
8137
8193
|
host.muted = (fd, data) => signals.muted(fd, data);
|
|
8138
8194
|
const exports = instance.exports;
|
|
@@ -8229,7 +8285,7 @@ async function runWasiThread(init, port2) {
|
|
|
8229
8285
|
throw e;
|
|
8230
8286
|
}
|
|
8231
8287
|
}
|
|
8232
|
-
var TRAPPED, PREVIEW1, WASIX, SLICC, SLICC_FS, RESERVED2, noErrno, FALLBACK_MAXIMUM_PAGES, LinkSync, DL_GEN, BACKTRACE_FRAMES;
|
|
8288
|
+
var TRAPPED, PREVIEW1, WASIX, SLICC, SLICC_FS, RESERVED2, importsSigactionHook, noErrno, FALLBACK_MAXIMUM_PAGES, LinkSync, DL_GEN, BACKTRACE_FRAMES;
|
|
8233
8289
|
var init_wasi_runtime = __esm({
|
|
8234
8290
|
"src/process/wasi/wasi-runtime.ts"() {
|
|
8235
8291
|
"use strict";
|
|
@@ -8258,6 +8314,7 @@ var init_wasi_runtime = __esm({
|
|
|
8258
8314
|
SLICC = "slicc";
|
|
8259
8315
|
SLICC_FS = "slicc_fs";
|
|
8260
8316
|
RESERVED2 = RESERVED_NAMESPACES;
|
|
8317
|
+
importsSigactionHook = (module) => WebAssembly.Module.imports(module).some((i) => i.module === SLICC && i.name === "sigaction_set");
|
|
8261
8318
|
noErrno = (key) => `imports ${key}: its result cannot carry ENOSYS, and this host does not provide it`;
|
|
8262
8319
|
FALLBACK_MAXIMUM_PAGES = 32768;
|
|
8263
8320
|
LinkSync = class {
|
|
@@ -8841,9 +8898,11 @@ function netOps(kernel, io) {
|
|
|
8841
8898
|
connect: async (options) => {
|
|
8842
8899
|
const signal = options.signal ?? NEVER;
|
|
8843
8900
|
signal.throwIfAborted();
|
|
8901
|
+
const host = options.host ?? "127.0.0.1";
|
|
8902
|
+
if (host.includes(":")) throw new JsCallError("EADDRNOTAVAIL", host);
|
|
8844
8903
|
const addr = {
|
|
8845
8904
|
family: "inet",
|
|
8846
|
-
host: await resolve(
|
|
8905
|
+
host: await resolve(host, signal),
|
|
8847
8906
|
port: port(options.port)
|
|
8848
8907
|
};
|
|
8849
8908
|
return opened(async (fd) => {
|