@ai-ecoverse/slicc-kernel 1.28.0 → 1.29.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 +3 -3
- package/dist/kernel-worker.js +62 -3
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +22 -7
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +62 -3
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +22 -7
- package/dist/process-worker.js.map +2 -2
- package/package.json +3 -3
|
@@ -3476,6 +3476,15 @@ function ownValue(module, name) {
|
|
|
3476
3476
|
const own = Object.getOwnPropertyDescriptor(module, name);
|
|
3477
3477
|
return own && "value" in own ? own.value : void 0;
|
|
3478
3478
|
}
|
|
3479
|
+
function identify(transport, init) {
|
|
3480
|
+
const r = transport.call({ op: "proc-identity" }, Number.POSITIVE_INFINITY, "proc-identity");
|
|
3481
|
+
const id = r.ok && r.kind === "json" ? r.json : null;
|
|
3482
|
+
return id ?? { pid: init.pid, ppid: init.ppid ?? 1 };
|
|
3483
|
+
}
|
|
3484
|
+
function liveParent(imports, parent) {
|
|
3485
|
+
const env = imports.env;
|
|
3486
|
+
if (env && typeof env.slicc_getppid_js === "function") env.slicc_getppid_js = parent;
|
|
3487
|
+
}
|
|
3479
3488
|
function signalMasks(m) {
|
|
3480
3489
|
const mask = m.sliccSigMask;
|
|
3481
3490
|
const caught = mask?.(0) ?? -1;
|
|
@@ -3519,11 +3528,12 @@ async function runWasmProcess(init, port2, deps = {}) {
|
|
|
3519
3528
|
ready = resolve;
|
|
3520
3529
|
failed2 = reject;
|
|
3521
3530
|
});
|
|
3531
|
+
const id = identify(transport, init);
|
|
3522
3532
|
const module = {
|
|
3523
3533
|
noInitialRun: true,
|
|
3524
3534
|
thisProgram: init.argv0,
|
|
3525
|
-
sliccPid:
|
|
3526
|
-
|
|
3535
|
+
sliccPid: id.pid,
|
|
3536
|
+
sliccPpid: id.ppid,
|
|
3527
3537
|
sliccEnv: init.env,
|
|
3528
3538
|
print: say(1),
|
|
3529
3539
|
printErr: say(2),
|
|
@@ -3543,6 +3553,7 @@ async function runWasmProcess(init, port2, deps = {}) {
|
|
|
3543
3553
|
}
|
|
3544
3554
|
}
|
|
3545
3555
|
});
|
|
3556
|
+
liveParent(imports, () => identify(transport, init).ppid);
|
|
3546
3557
|
const glue = ownValue(module, "sliccFdImports");
|
|
3547
3558
|
syncFsync(imports, () => ownValue(module, "FS"), glue);
|
|
3548
3559
|
positionalIo(imports, {
|
|
@@ -6750,7 +6761,7 @@ var init_wasix_host = __esm({
|
|
|
6750
6761
|
proc_id: (out) => void mem.view().setUint32(out, host.o.pid, true),
|
|
6751
6762
|
proc_parent: (pid, out) => {
|
|
6752
6763
|
if (pid !== 0 && pid !== host.o.pid) throw new WasiError("ESRCH");
|
|
6753
|
-
mem.view().setUint32(out, host.o.ppid ?? 1, true);
|
|
6764
|
+
mem.view().setUint32(out, host.o.parent?.() ?? host.o.ppid ?? 1, true);
|
|
6754
6765
|
},
|
|
6755
6766
|
getcwd: (buf, lenPtr) => {
|
|
6756
6767
|
const bytes = new TextEncoder().encode(host.cwd);
|
|
@@ -7286,6 +7297,7 @@ async function runWasiProcess(init, port2) {
|
|
|
7286
7297
|
});
|
|
7287
7298
|
const main = {};
|
|
7288
7299
|
const { transport, sys, call: kernelCall, say } = kernelOf(init, port2, signals, sizeOf(main));
|
|
7300
|
+
const id = identify(transport, init);
|
|
7289
7301
|
const stats = init.env.SLICC_WASI_STATS === "1" ? new WasiStats() : void 0;
|
|
7290
7302
|
const call2 = stats ? timedCalls(stats, kernelCall) : kernelCall;
|
|
7291
7303
|
const { module } = init.program;
|
|
@@ -7306,8 +7318,9 @@ async function runWasiProcess(init, port2) {
|
|
|
7306
7318
|
args: [init.argv0, ...init.args],
|
|
7307
7319
|
env: init.env,
|
|
7308
7320
|
cwd: fork?.cwd ?? init.cwd,
|
|
7309
|
-
pid:
|
|
7310
|
-
|
|
7321
|
+
pid: id.pid,
|
|
7322
|
+
ppid: id.ppid,
|
|
7323
|
+
parent: () => identify(transport, init).ppid,
|
|
7311
7324
|
kernel: { sys: traced(stats, "kernel", sys), call: call2 },
|
|
7312
7325
|
fs: cachingBridge(traced(stats, "fs", createSyncFsSabBridge(transport))),
|
|
7313
7326
|
...fork?.shared && threads ? { shared: threads.ids } : fork ? { forked: { fds: fork.fds, cloexec: fork.cloexec } } : { inherited: init.fds }
|
|
@@ -7381,12 +7394,14 @@ async function runWasiThread(init, port2) {
|
|
|
7381
7394
|
const { thread } = init;
|
|
7382
7395
|
const threads = new WasiThreads(port2, thread.memory, threadCap(init.env), thread.tid, thread.ids);
|
|
7383
7396
|
threads.received = thread.modules;
|
|
7397
|
+
const id = identify(transport, init);
|
|
7384
7398
|
const host = new WasiHost({
|
|
7385
7399
|
args: [init.argv0, ...init.args],
|
|
7386
7400
|
env: init.env,
|
|
7387
7401
|
cwd: init.cwd,
|
|
7388
|
-
pid:
|
|
7389
|
-
|
|
7402
|
+
pid: id.pid,
|
|
7403
|
+
ppid: id.ppid,
|
|
7404
|
+
parent: () => identify(transport, init).ppid,
|
|
7390
7405
|
kernel: { sys, call: call2 },
|
|
7391
7406
|
fs: cachingBridge(createSyncFsSabBridge(transport)),
|
|
7392
7407
|
shared: threads.ids
|