@ai-ecoverse/slicc-kernel 1.41.2 → 1.41.4
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 +1 -1
- package/dist/kernel-worker.js +26 -13
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node.js +26 -13
- package/dist/node.js.map +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -429,7 +429,7 @@ An exec'd program takes over the pid of the process it replaces, as on Linux: `g
|
|
|
429
429
|
|
|
430
430
|
### File modes and the umask
|
|
431
431
|
|
|
432
|
-
Every process has a umask in the kernel, `022` for a process the embedder starts, inherited across fork, spawn and exec and shown in `/proc/<pid>/status` (`Umask:`). The kernel applies it when a program creates a file or directory, whatever its libc does: an Emscripten program's `open` with `O_CREAT`, `mkdir` and `mknod` (so `umask 077; touch f` gives `600` in a child too), and a WASI program's `path_open` with `O_CREAT` and `path_create_directory` (`0666` and `0777` less the umask).
|
|
432
|
+
Every process has a umask in the kernel, `022` for a process the embedder starts, inherited across fork, spawn and exec and shown in `/proc/<pid>/status` (`Umask:`). The kernel applies it when a program creates a file or directory, whatever its libc does: an Emscripten program's `open` with `O_CREAT`, `mkdir` and `mknod` (so `umask 077; touch f` gives `600` in a child too), and a WASI program's `path_open` with `O_CREAT` and `path_create_directory` (`0666` and `0777` less the umask). An Emscripten program's `umask()` sets and reads the kernel's umask through the glue's `__syscall_umask` import, so `umask 077` in bash shows in `/proc` and reaches every child. A build that resolves `umask` inside its wasm, as wasm-bash 5.3.0-8 to 5.3.0-10 do, keeps a umask of its own that the kernel never sees.
|
|
433
433
|
|
|
434
434
|
WASI and WASIX have no call for file modes, so the kernel adds the import module `slicc_fs`, whose functions return a preview1 errno (kernels without them answer `ENOSYS`):
|
|
435
435
|
|
package/dist/kernel-worker.js
CHANGED
|
@@ -5705,6 +5705,7 @@ var ChildTable = class {
|
|
|
5705
5705
|
});
|
|
5706
5706
|
handle.onState?.((state, sig) => {
|
|
5707
5707
|
child.stopReport = state === "stopped" ? sig : void 0;
|
|
5708
|
+
child.stoppedBy = child.stopReport;
|
|
5708
5709
|
child.continueReport = state === "continued";
|
|
5709
5710
|
this.watchers.get(handle.pid)?.(state, sig);
|
|
5710
5711
|
const waiters = this.stateChanged;
|
|
@@ -5716,7 +5717,10 @@ var ChildTable = class {
|
|
|
5716
5717
|
return handle.pid;
|
|
5717
5718
|
}
|
|
5718
5719
|
watch(pid, listener) {
|
|
5719
|
-
|
|
5720
|
+
const child = this.children.get(pid);
|
|
5721
|
+
if (!child) return;
|
|
5722
|
+
this.watchers.set(pid, listener);
|
|
5723
|
+
if (child.stoppedBy !== void 0) listener("stopped", child.stoppedBy);
|
|
5720
5724
|
}
|
|
5721
5725
|
openSlot(slot, n, captured) {
|
|
5722
5726
|
if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
|
|
@@ -8985,6 +8989,7 @@ var WasmProcess = class {
|
|
|
8985
8989
|
dying = false;
|
|
8986
8990
|
umask = DEFAULT_UMASK;
|
|
8987
8991
|
execChild;
|
|
8992
|
+
killed = false;
|
|
8988
8993
|
execTermsig;
|
|
8989
8994
|
stopped = 0;
|
|
8990
8995
|
stops = 0;
|
|
@@ -9022,7 +9027,10 @@ var WasmProcess = class {
|
|
|
9022
9027
|
this.wake?.();
|
|
9023
9028
|
return "forward";
|
|
9024
9029
|
}
|
|
9025
|
-
if (sig === SIG.KILL)
|
|
9030
|
+
if (sig === SIG.KILL) {
|
|
9031
|
+
this.killed = true;
|
|
9032
|
+
return "terminate";
|
|
9033
|
+
}
|
|
9026
9034
|
if (sig === SIG.CONT) this.cont();
|
|
9027
9035
|
if (sig === SIG.STOP) return this.stop(sig);
|
|
9028
9036
|
const bit = sigbit(sig);
|
|
@@ -9040,6 +9048,19 @@ var WasmProcess = class {
|
|
|
9040
9048
|
blocked.abort();
|
|
9041
9049
|
return "deliver";
|
|
9042
9050
|
}
|
|
9051
|
+
async spawn(req) {
|
|
9052
|
+
const { file, argv, env, cwd, stdio, inherit, exec } = req;
|
|
9053
|
+
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
9054
|
+
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
9055
|
+
if (!exec) return pid;
|
|
9056
|
+
if (this.killed) void Promise.allSettled([this.options.kill?.(pid, SIG.KILL)]);
|
|
9057
|
+
else this.adoptExec(pid);
|
|
9058
|
+
return pid;
|
|
9059
|
+
}
|
|
9060
|
+
adoptExec(pid) {
|
|
9061
|
+
this.execChild = pid;
|
|
9062
|
+
this.children.watch(pid, (state, sig) => state === "stopped" ? this.stop(sig) : this.cont());
|
|
9063
|
+
}
|
|
9043
9064
|
onState(listener) {
|
|
9044
9065
|
this.stateListeners.push(listener);
|
|
9045
9066
|
}
|
|
@@ -9445,12 +9466,8 @@ var WasmProcess = class {
|
|
|
9445
9466
|
switch (req.op) {
|
|
9446
9467
|
case "proc-fork":
|
|
9447
9468
|
return { ok: true, kind: "json", json: await this.children.fork(req.state) };
|
|
9448
|
-
case "proc-spawn":
|
|
9449
|
-
|
|
9450
|
-
const spawned = { file, argv, env, cwd, ...exec ? { exec } : {} };
|
|
9451
|
-
const pid = await this.children.spawn(spawned, stdio, inherit);
|
|
9452
|
-
return { ok: true, kind: "json", json: pid };
|
|
9453
|
-
}
|
|
9469
|
+
case "proc-spawn":
|
|
9470
|
+
return { ok: true, kind: "json", json: await this.spawn(req) };
|
|
9454
9471
|
case "proc-wait": {
|
|
9455
9472
|
const signal = req.nohang ? this.interrupt.signal : this.blockingSignal();
|
|
9456
9473
|
const flags = {
|
|
@@ -9464,12 +9481,8 @@ var WasmProcess = class {
|
|
|
9464
9481
|
case "proc-identity":
|
|
9465
9482
|
return { ok: true, kind: "json", json: await this.options.identity?.() ?? null };
|
|
9466
9483
|
case "proc-exec": {
|
|
9467
|
-
this.
|
|
9484
|
+
this.adoptExec(req.pid);
|
|
9468
9485
|
this.options.jobs?.exec(this.pid, req.pid);
|
|
9469
|
-
this.children.watch(
|
|
9470
|
-
req.pid,
|
|
9471
|
-
(state, sig) => state === "stopped" ? this.stop(sig) : this.cont()
|
|
9472
|
-
);
|
|
9473
9486
|
await this.fds.closeAll();
|
|
9474
9487
|
try {
|
|
9475
9488
|
const waited = await this.children.wait(req.pid, false);
|