@ai-ecoverse/slicc-kernel 1.73.3 → 1.74.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 +2 -2
- package/dist/kernel-worker.js +35 -5
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +15 -1
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +35 -5
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +15 -1
- package/dist/process-worker.js.map +3 -3
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -10939,7 +10939,14 @@ async function runChild(req, deps) {
|
|
|
10939
10939
|
];
|
|
10940
10940
|
try {
|
|
10941
10941
|
pid = await deps.children.spawn(
|
|
10942
|
-
{
|
|
10942
|
+
{
|
|
10943
|
+
file: req.file,
|
|
10944
|
+
argv: req.argv,
|
|
10945
|
+
env: req.env,
|
|
10946
|
+
cwd: req.cwd,
|
|
10947
|
+
...req.pgid !== void 0 ? { pgid: req.pgid } : {},
|
|
10948
|
+
...req.session ? { session: req.session } : {}
|
|
10949
|
+
},
|
|
10943
10950
|
stdio
|
|
10944
10951
|
);
|
|
10945
10952
|
} catch (e) {
|
|
@@ -11892,8 +11899,9 @@ var WasmProcess = class {
|
|
|
11892
11899
|
return "deliver";
|
|
11893
11900
|
}
|
|
11894
11901
|
async spawn(req) {
|
|
11895
|
-
const { file, argv, env, cwd, stdio, inherit: inherit2, exec } = req;
|
|
11896
|
-
const
|
|
11902
|
+
const { file, argv, env, cwd, stdio, inherit: inherit2, exec, pgid, session } = req;
|
|
11903
|
+
const group = { ...pgid !== void 0 ? { pgid } : {}, ...session ? { session } : {} };
|
|
11904
|
+
const spawned = { file, argv, env, cwd, ...group, ...exec ? { exec } : {} };
|
|
11897
11905
|
const pid = await this.children.spawn(spawned, stdio, inherit2);
|
|
11898
11906
|
if (!exec) return pid;
|
|
11899
11907
|
if (this.killed) void Promise.allSettled([this.options.kill?.(pid, SIG.KILL)]);
|
|
@@ -13187,6 +13195,9 @@ var JobTable = class {
|
|
|
13187
13195
|
member.pgid = pgid;
|
|
13188
13196
|
member.sid = sid;
|
|
13189
13197
|
}
|
|
13198
|
+
lead(pid) {
|
|
13199
|
+
this.member(pid).pgid = this.idOf(pid);
|
|
13200
|
+
}
|
|
13190
13201
|
pgidOf(pid) {
|
|
13191
13202
|
return this.members.get(pid)?.pgid;
|
|
13192
13203
|
}
|
|
@@ -16275,7 +16286,7 @@ var Launcher = class {
|
|
|
16275
16286
|
start(req) {
|
|
16276
16287
|
this.sampling();
|
|
16277
16288
|
if (req.pgid !== void 0 && this.jobs.sessionOf(req.pgid) === void 0) {
|
|
16278
|
-
throw
|
|
16289
|
+
throw new SpawnError("ESRCH");
|
|
16279
16290
|
}
|
|
16280
16291
|
const pid = this.nextPid++;
|
|
16281
16292
|
const stack = this.stackFor(req.tag);
|
|
@@ -16350,6 +16361,8 @@ var Launcher = class {
|
|
|
16350
16361
|
this.jobs.add(pid, req.ppid, (sig) => handle.signal(sig), terminal);
|
|
16351
16362
|
if (req.exec && req.ppid !== void 0) this.jobs.exec(req.ppid, pid, true);
|
|
16352
16363
|
if (req.pgid !== void 0) this.jobs.join(pid, req.pgid);
|
|
16364
|
+
if (req.group === "lead") this.jobs.lead(pid);
|
|
16365
|
+
if (req.group === "session") this.jobs.setsid(pid);
|
|
16353
16366
|
this.described.set(pid, {
|
|
16354
16367
|
argv: [req.argv0, ...req.args],
|
|
16355
16368
|
tty: terminal?.name ?? null,
|
|
@@ -16511,6 +16524,11 @@ var Launcher = class {
|
|
|
16511
16524
|
await fds.closeAll();
|
|
16512
16525
|
throw new SpawnError("EACCES");
|
|
16513
16526
|
}
|
|
16527
|
+
const group = this.childGroup(ppid, req);
|
|
16528
|
+
if (typeof group === "string") {
|
|
16529
|
+
await fds.closeAll();
|
|
16530
|
+
throw new SpawnError(group);
|
|
16531
|
+
}
|
|
16514
16532
|
const cred = grant ? grant.cred : this.credOf(ppid);
|
|
16515
16533
|
const scope = grant ? "" : await this.scopeOf(cred.euid);
|
|
16516
16534
|
const planned = await this.plan(req.file, req.argv, req.cwd, scope);
|
|
@@ -16537,6 +16555,7 @@ var Launcher = class {
|
|
|
16537
16555
|
umask: this.umaskOf(ppid),
|
|
16538
16556
|
cred,
|
|
16539
16557
|
tag: this.tagOf(ppid),
|
|
16558
|
+
...group,
|
|
16540
16559
|
...exec
|
|
16541
16560
|
});
|
|
16542
16561
|
deciding?.attach();
|
|
@@ -16544,6 +16563,17 @@ var Launcher = class {
|
|
|
16544
16563
|
return childHandle(handle);
|
|
16545
16564
|
};
|
|
16546
16565
|
}
|
|
16566
|
+
childGroup(ppid, req) {
|
|
16567
|
+
const { pgid, session } = req;
|
|
16568
|
+
if (pgid === void 0 && session === void 0) return {};
|
|
16569
|
+
const valid2 = pgid === void 0 || Number.isInteger(pgid) && pgid >= 0;
|
|
16570
|
+
if (req.exec || !valid2 || session !== void 0 && session !== true) return "EINVAL";
|
|
16571
|
+
if (session) return pgid === void 0 ? { group: "session" } : "EINVAL";
|
|
16572
|
+
if (pgid === 0) return { group: "lead" };
|
|
16573
|
+
const sid = this.jobs.sessionOf(pgid);
|
|
16574
|
+
if (sid === void 0) return "ESRCH";
|
|
16575
|
+
return sid === this.jobs.sidOf(ppid) ? { pgid } : "EPERM";
|
|
16576
|
+
}
|
|
16547
16577
|
undecided(ppid) {
|
|
16548
16578
|
const decided = Promise.withResolvers();
|
|
16549
16579
|
return {
|
|
@@ -16574,7 +16604,7 @@ var Launcher = class {
|
|
|
16574
16604
|
}, 0);
|
|
16575
16605
|
}
|
|
16576
16606
|
forker(ppid, parent) {
|
|
16577
|
-
const { exec: _exec, ...image } = parent;
|
|
16607
|
+
const { exec: _exec, pgid: _pgid, group: _group, ...image } = parent;
|
|
16578
16608
|
return async (state, fds) => childHandle(
|
|
16579
16609
|
this.start({
|
|
16580
16610
|
...image,
|