@ai-ecoverse/slicc-kernel 1.47.2 → 1.47.3
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 +31 -3
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +1 -0
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +31 -3
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +1 -0
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -7886,9 +7886,9 @@ var KernelTty = class {
|
|
|
7886
7886
|
this.line = [];
|
|
7887
7887
|
} else if (byte === 10) {
|
|
7888
7888
|
this.line.push(byte);
|
|
7889
|
-
if (echo) this.output(encoder2.encode("\n"));
|
|
7890
7889
|
this.readable.push(Uint8Array.from(this.line));
|
|
7891
7890
|
this.line = [];
|
|
7891
|
+
if (echo) this.output(encoder2.encode("\n"));
|
|
7892
7892
|
} else {
|
|
7893
7893
|
this.line.push(byte);
|
|
7894
7894
|
if (echo) this.echo(byte);
|
|
@@ -9629,7 +9629,7 @@ var WasmProcess = class {
|
|
|
9629
9629
|
case "tty-pgrp-get":
|
|
9630
9630
|
return { ok: true, kind: "json", json: jobs ? jobs.tcgetpgrp(tty, this.sid()) : this.pid };
|
|
9631
9631
|
case "tty-pgrp-set":
|
|
9632
|
-
if (jobs) jobs.tcsetpgrp(this.pid, tty, req.pgrp);
|
|
9632
|
+
if (jobs) jobs.tcsetpgrp(this.pid, tty, req.pgrp, this.options.settling?.() ?? false);
|
|
9633
9633
|
else if (req.pgrp !== this.pid) throw new KernelError("EPERM");
|
|
9634
9634
|
return { ok: true, kind: "void" };
|
|
9635
9635
|
}
|
|
@@ -10014,6 +10014,7 @@ function processOptions(opts, header3, hooks) {
|
|
|
10014
10014
|
...inherited(opts),
|
|
10015
10015
|
...opts.identity ? { identity: opts.identity } : {},
|
|
10016
10016
|
...opts.onSyscall ? { onSyscall: opts.onSyscall } : {},
|
|
10017
|
+
...opts.settling ? { settling: opts.settling } : {},
|
|
10017
10018
|
spawner: opts.spawner,
|
|
10018
10019
|
forker: opts.forker,
|
|
10019
10020
|
fs: opts.fs,
|
|
@@ -10186,6 +10187,7 @@ function spawnWasmProcess(opts) {
|
|
|
10186
10187
|
// src/kernel/jobs.ts
|
|
10187
10188
|
var JobTable = class {
|
|
10188
10189
|
members = /* @__PURE__ */ new Map();
|
|
10190
|
+
handoffs = /* @__PURE__ */ new Map();
|
|
10189
10191
|
foreground = /* @__PURE__ */ new Map();
|
|
10190
10192
|
terminals = /* @__PURE__ */ new Map();
|
|
10191
10193
|
add(pid, parentPid, signal, terminal) {
|
|
@@ -10205,7 +10207,12 @@ var JobTable = class {
|
|
|
10205
10207
|
return [...this.members.values()];
|
|
10206
10208
|
}
|
|
10207
10209
|
remove(pid) {
|
|
10210
|
+
const member = this.members.get(pid);
|
|
10208
10211
|
this.members.delete(pid);
|
|
10212
|
+
if (member) this.prune(member.pgid);
|
|
10213
|
+
}
|
|
10214
|
+
prune(pgid) {
|
|
10215
|
+
if (![...this.members.values()].some((m) => m.pgid === pgid)) this.handoffs.delete(pgid);
|
|
10209
10216
|
}
|
|
10210
10217
|
exec(pid, child, adopt = false) {
|
|
10211
10218
|
const member = this.members.get(child);
|
|
@@ -10269,7 +10276,12 @@ var JobTable = class {
|
|
|
10269
10276
|
if (id2 === target.sid) throw new KernelError("EPERM");
|
|
10270
10277
|
const exists = [...this.members.values()].some((m) => m.pgid === group && m.sid === target.sid);
|
|
10271
10278
|
if (group !== id2 && !exists) throw new KernelError("EPERM");
|
|
10279
|
+
const left = target.pgid;
|
|
10272
10280
|
target.pgid = group;
|
|
10281
|
+
this.prune(left);
|
|
10282
|
+
}
|
|
10283
|
+
get handoffCount() {
|
|
10284
|
+
return this.handoffs.size;
|
|
10273
10285
|
}
|
|
10274
10286
|
getpgid(caller, pid) {
|
|
10275
10287
|
return this.byId(pid || this.idOf(caller)).pgid;
|
|
@@ -10322,12 +10334,24 @@ var JobTable = class {
|
|
|
10322
10334
|
tcgetpgrp(tty, fallback) {
|
|
10323
10335
|
return this.foreground.get(tty) ?? fallback;
|
|
10324
10336
|
}
|
|
10325
|
-
tcsetpgrp(caller, tty, pgid) {
|
|
10337
|
+
tcsetpgrp(caller, tty, pgid, settling = false) {
|
|
10326
10338
|
const self = this.member(caller);
|
|
10327
10339
|
const inSession = [...this.members.values()].some((m) => m.pgid === pgid && m.sid === self.sid);
|
|
10328
10340
|
if (!inSession) throw new KernelError("EPERM");
|
|
10341
|
+
const current = this.foreground.get(tty);
|
|
10342
|
+
if (settling && pgid === self.pgid && current !== pgid && this.reclaimed(pgid, self.ppid))
|
|
10343
|
+
return;
|
|
10344
|
+
if (pgid !== self.pgid) this.handoffs.set(pgid, { by: caller, reclaimed: false });
|
|
10345
|
+
else if (current !== void 0) {
|
|
10346
|
+
const handoff = this.handoffs.get(current);
|
|
10347
|
+
if (handoff?.by === caller) handoff.reclaimed = true;
|
|
10348
|
+
}
|
|
10329
10349
|
this.foreground.set(tty, pgid);
|
|
10330
10350
|
}
|
|
10351
|
+
reclaimed(pgid, parent) {
|
|
10352
|
+
const handoff = this.handoffs.get(pgid);
|
|
10353
|
+
return handoff?.reclaimed === true && handoff.by === parent;
|
|
10354
|
+
}
|
|
10331
10355
|
signalOwnedForeground(tty, sig) {
|
|
10332
10356
|
const pgid = this.foreground.get(tty);
|
|
10333
10357
|
if (pgid !== void 0) this.killGroup(pgid, sig);
|
|
@@ -10371,6 +10395,9 @@ var SettlingChildren = class {
|
|
|
10371
10395
|
this.parked = this.parked.filter((p) => p.pgid !== pgid);
|
|
10372
10396
|
this.held = this.held.filter((h) => !(h.copy && h.pgid === pgid));
|
|
10373
10397
|
}
|
|
10398
|
+
isSettling(pid) {
|
|
10399
|
+
return this.children.has(pid);
|
|
10400
|
+
}
|
|
10374
10401
|
syscall(pid, op) {
|
|
10375
10402
|
const child = this.children.get(pid);
|
|
10376
10403
|
if (!child) return;
|
|
@@ -11986,6 +12013,7 @@ var Launcher = class {
|
|
|
11986
12013
|
this.decide(pid);
|
|
11987
12014
|
this.settling.syscall(pid, call.op);
|
|
11988
12015
|
},
|
|
12016
|
+
settling: () => this.settling.isSettling(pid),
|
|
11989
12017
|
...req.ignored ? { ignored: req.ignored } : {},
|
|
11990
12018
|
...req.umask !== void 0 ? { umask: req.umask } : {},
|
|
11991
12019
|
cred: req.cred,
|