@ai-ecoverse/slicc-kernel 1.78.0 → 1.79.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/dist/node.js CHANGED
@@ -8565,6 +8565,7 @@ function pidStat(info, boot) {
8565
8565
  }
8566
8566
  var sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
8567
8567
  var STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
8568
+ var tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
8568
8569
  function pidStatus(info) {
8569
8570
  const state = STATES[info.state];
8570
8571
  const c = info.cred ?? ROOT;
@@ -8580,6 +8581,7 @@ function pidStatus(info) {
8580
8581
  "TracerPid: 0",
8581
8582
  `Uid: ${ids(c.ruid, c.euid, c.suid)}`,
8582
8583
  `Gid: ${ids(c.rgid, c.egid, c.sgid)}`,
8584
+ ...info.tag !== void 0 ? [tagLine(info.tag)] : [],
8583
8585
  "FDSize: 64",
8584
8586
  `VmSize: ${Math.ceil(info.memory / KIB)} kB`,
8585
8587
  `VmRSS: ${Math.ceil(info.memory / KIB)} kB`,
@@ -16974,6 +16976,7 @@ var Launcher = class {
16974
16976
  const cred = this.credOf(member.pid);
16975
16977
  if (!maySee(viewer, cred)) continue;
16976
16978
  const root = rootOf(member);
16979
+ const tag = this.tagOf(member.pid) ?? this.tagOf(root.pid);
16977
16980
  listed.push({
16978
16981
  pid: root.pid,
16979
16982
  tid: member.pid,
@@ -16988,7 +16991,8 @@ var Launcher = class {
16988
16991
  ...this.childrenOf(root.pid),
16989
16992
  umask: this.umaskOf(member.pid),
16990
16993
  cred,
16991
- ...this.signalMasksOf(member.pid)
16994
+ ...this.signalMasksOf(member.pid),
16995
+ ...tag !== void 0 && maySee(viewer, cred) ? { tag } : {}
16992
16996
  });
16993
16997
  }
16994
16998
  return listed;
@@ -17161,10 +17165,7 @@ var Launcher = class {
17161
17165
  const may = (target) => !sender || maySignal(sender, this.credOf(target)) || sig === SIG.CONT && session !== void 0 && this.jobs.sidOf(target) === session || from !== void 0 && this.imageOf(from) === this.imageOf(target) || from !== void 0 && this.granted.get(this.jobs.shown(target)) === from;
17162
17166
  if (pid === -1) {
17163
17167
  const sender2 = from === void 0 ? void 0 : this.imageOf(from);
17164
- return this.killAll(
17165
- sig,
17166
- (member) => this.imageOf(member) !== sender2 && may(this.imageOf(member))
17167
- );
17168
+ return this.killAll(sig, (member) => this.imageOf(member) !== sender2, may);
17168
17169
  }
17169
17170
  if (pid < 0) return this.jobs.killGroup(-pid, sig, (member) => may(this.imageOf(member)));
17170
17171
  const handle = this.processes.get(pid);
@@ -17173,14 +17174,17 @@ var Launcher = class {
17173
17174
  if (sig !== 0) handle.signal(sig);
17174
17175
  return true;
17175
17176
  }
17176
- killAll(sig, may) {
17177
- let any = false;
17178
- for (const [pid, handle] of [...this.processes]) {
17179
- if (pid === 1 || !may(pid)) continue;
17180
- any = true;
17181
- if (sig !== 0) handle.signal(sig);
17177
+ killAll(sig, other, may) {
17178
+ const candidates = [...this.processes].filter(([pid]) => pid !== 1 && other(pid));
17179
+ const targets = candidates.filter(([pid]) => may(this.imageOf(pid)));
17180
+ if (targets.length === 0 && candidates.length > 0) throw fsError("EPERM", "kill -1");
17181
+ const pids = new Set(targets.map(([pid]) => pid));
17182
+ const parents = new Map(this.jobs.list().map((m) => [m.pid, m.execParent]));
17183
+ for (const [pid, handle] of targets) {
17184
+ const parent = parents.get(pid);
17185
+ if (sig !== 0 && (parent === void 0 || !pids.has(parent))) handle.signal(sig);
17182
17186
  }
17183
- return any;
17187
+ return targets.length > 0;
17184
17188
  }
17185
17189
  async driver(type, spec) {
17186
17190
  if (type === "fsa") return this.fsaDriver(spec);