@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.
@@ -10147,6 +10147,7 @@ function pidStat(info, boot) {
10147
10147
  }
10148
10148
  var sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
10149
10149
  var STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
10150
+ var tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
10150
10151
  function pidStatus(info) {
10151
10152
  const state = STATES[info.state];
10152
10153
  const c = info.cred ?? ROOT;
@@ -10162,6 +10163,7 @@ function pidStatus(info) {
10162
10163
  "TracerPid: 0",
10163
10164
  `Uid: ${ids(c.ruid, c.euid, c.suid)}`,
10164
10165
  `Gid: ${ids(c.rgid, c.egid, c.sgid)}`,
10166
+ ...info.tag !== void 0 ? [tagLine(info.tag)] : [],
10165
10167
  "FDSize: 64",
10166
10168
  `VmSize: ${Math.ceil(info.memory / KIB)} kB`,
10167
10169
  `VmRSS: ${Math.ceil(info.memory / KIB)} kB`,
@@ -17132,6 +17134,7 @@ var Launcher = class {
17132
17134
  const cred = this.credOf(member.pid);
17133
17135
  if (!maySee(viewer, cred)) continue;
17134
17136
  const root = rootOf(member);
17137
+ const tag = this.tagOf(member.pid) ?? this.tagOf(root.pid);
17135
17138
  listed.push({
17136
17139
  pid: root.pid,
17137
17140
  tid: member.pid,
@@ -17146,7 +17149,8 @@ var Launcher = class {
17146
17149
  ...this.childrenOf(root.pid),
17147
17150
  umask: this.umaskOf(member.pid),
17148
17151
  cred,
17149
- ...this.signalMasksOf(member.pid)
17152
+ ...this.signalMasksOf(member.pid),
17153
+ ...tag !== void 0 && maySee(viewer, cred) ? { tag } : {}
17150
17154
  });
17151
17155
  }
17152
17156
  return listed;
@@ -17319,10 +17323,7 @@ var Launcher = class {
17319
17323
  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;
17320
17324
  if (pid === -1) {
17321
17325
  const sender2 = from === void 0 ? void 0 : this.imageOf(from);
17322
- return this.killAll(
17323
- sig,
17324
- (member) => this.imageOf(member) !== sender2 && may(this.imageOf(member))
17325
- );
17326
+ return this.killAll(sig, (member) => this.imageOf(member) !== sender2, may);
17326
17327
  }
17327
17328
  if (pid < 0) return this.jobs.killGroup(-pid, sig, (member) => may(this.imageOf(member)));
17328
17329
  const handle = this.processes.get(pid);
@@ -17331,14 +17332,17 @@ var Launcher = class {
17331
17332
  if (sig !== 0) handle.signal(sig);
17332
17333
  return true;
17333
17334
  }
17334
- killAll(sig, may) {
17335
- let any = false;
17336
- for (const [pid, handle] of [...this.processes]) {
17337
- if (pid === 1 || !may(pid)) continue;
17338
- any = true;
17339
- if (sig !== 0) handle.signal(sig);
17335
+ killAll(sig, other, may) {
17336
+ const candidates = [...this.processes].filter(([pid]) => pid !== 1 && other(pid));
17337
+ const targets = candidates.filter(([pid]) => may(this.imageOf(pid)));
17338
+ if (targets.length === 0 && candidates.length > 0) throw fsError("EPERM", "kill -1");
17339
+ const pids = new Set(targets.map(([pid]) => pid));
17340
+ const parents = new Map(this.jobs.list().map((m) => [m.pid, m.execParent]));
17341
+ for (const [pid, handle] of targets) {
17342
+ const parent = parents.get(pid);
17343
+ if (sig !== 0 && (parent === void 0 || !pids.has(parent))) handle.signal(sig);
17340
17344
  }
17341
- return any;
17345
+ return targets.length > 0;
17342
17346
  }
17343
17347
  async driver(type, spec) {
17344
17348
  if (type === "fsa") return this.fsaDriver(spec);