@ai-ecoverse/slicc-kernel 1.100.0 → 1.100.2

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.
@@ -4767,7 +4767,7 @@ var KERNEL_VERSION, OS_RELEASE;
4767
4767
  var init_version = __esm({
4768
4768
  "src/version.ts"() {
4769
4769
  "use strict";
4770
- KERNEL_VERSION = true ? "1.100.0" : "0.0.0-dev";
4770
+ KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
4771
4771
  OS_RELEASE = "6.0.0-slicc";
4772
4772
  }
4773
4773
  });
@@ -8731,11 +8731,11 @@ function pages(bytes) {
8731
8731
  function ticks(ms) {
8732
8732
  return Math.max(0, Math.floor(ms * HZ / 1e3));
8733
8733
  }
8734
- function pidStat(info, boot) {
8734
+ function pidStat(info, boot, state = info.state) {
8735
8735
  const fields = [
8736
8736
  info.pid,
8737
8737
  `(${commOf(info)})`,
8738
- info.state,
8738
+ state,
8739
8739
  info.ppid,
8740
8740
  info.pgid,
8741
8741
  info.sid,
@@ -8772,6 +8772,13 @@ function pidStat(info, boot) {
8772
8772
  return `${fields.join(" ")}
8773
8773
  `;
8774
8774
  }
8775
+ function taskStat(info, tid, boot) {
8776
+ const thread = (info.threads ?? [{ tid: 1, state: info.state }]).find((t) => t.tid === tid);
8777
+ return thread && pidStat({ ...info, pid: tid }, boot, thread.state);
8778
+ }
8779
+ function taskIds(info) {
8780
+ return (info.threads ?? [{ tid: 1 }]).map((t) => t.tid);
8781
+ }
8775
8782
  function pidStatus(info) {
8776
8783
  const state = STATES[info.state];
8777
8784
  const c = info.cred ?? ROOT;
@@ -9085,7 +9092,11 @@ var init_procfs = __esm({
9085
9092
  `, ostype: "Linux\n" }
9086
9093
  };
9087
9094
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
9088
- STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
9095
+ STATES = {
9096
+ S: "S (sleeping)",
9097
+ T: "T (stopped)",
9098
+ Z: "Z (zombie)"
9099
+ };
9089
9100
  tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
9090
9101
  }
9091
9102
  });
@@ -9376,8 +9387,10 @@ var init_wasi_procfs = __esm({
9376
9387
  content: () => systemFile(top, this.listing(), Date.now(), this.memory)
9377
9388
  };
9378
9389
  }
9379
- if (!/^[1-9]\d*$/.test(top) || rest2.length > 0 || !this.alive(Number(top))) return void 0;
9380
- if (leaf === void 0) return { kind: "dir", names: () => [...PID_NAMES] };
9390
+ if (!/^[1-9]\d*$/.test(top) || !this.alive(Number(top))) return void 0;
9391
+ if (leaf === "task") return this.task(Number(top), rest2);
9392
+ if (rest2.length > 0) return void 0;
9393
+ if (leaf === void 0) return { kind: "dir", names: () => [...PID_NAMES, "task"] };
9381
9394
  if (!PID_NAMES.includes(leaf)) return void 0;
9382
9395
  return {
9383
9396
  kind: "file",
@@ -9389,6 +9402,28 @@ var init_wasi_procfs = __esm({
9389
9402
  }
9390
9403
  };
9391
9404
  }
9405
+ info(pid) {
9406
+ return this.listing().processes.find((p) => p.pid === pid);
9407
+ }
9408
+ task(pid, rest2) {
9409
+ const [tid, leaf, ...more] = rest2;
9410
+ const tids = () => taskIds(this.info(pid));
9411
+ if (tid === void 0) return { kind: "dir", names: () => tids().map(String) };
9412
+ if (!/^[1-9]\d*$/.test(tid) || more.length > 0 || !tids().includes(Number(tid)))
9413
+ return void 0;
9414
+ if (leaf === void 0) return { kind: "dir", names: () => ["stat"] };
9415
+ if (leaf !== "stat") return void 0;
9416
+ return {
9417
+ kind: "file",
9418
+ content: () => {
9419
+ const listing = this.listing();
9420
+ const info = listing.processes.find((p) => p.pid === pid);
9421
+ const line = info && taskStat(info, Number(tid), listing.boot);
9422
+ if (line === void 0) throw syncError("ENOENT", `/proc/${pid}/task/${tid}/stat`);
9423
+ return line;
9424
+ }
9425
+ };
9426
+ }
9392
9427
  parts(path, follow2) {
9393
9428
  const parts = path.split("/").filter((p) => p !== "").slice(1);
9394
9429
  if (parts[0] === "self" && (follow2 || parts.length > 1)) parts[0] = String(this.pid);
@@ -13468,6 +13503,18 @@ function mutableGlobals(exports) {
13468
13503
  }
13469
13504
  return out;
13470
13505
  }
13506
+ function reseatTls(exports, bytes) {
13507
+ const init = exports.__wasm_init_tls;
13508
+ const base = exports.__tls_base;
13509
+ const size = exports.__tls_size;
13510
+ if (typeof init !== "function" || !(base instanceof WebAssembly.Global) || !(size instanceof WebAssembly.Global)) {
13511
+ return;
13512
+ }
13513
+ const at = base.value;
13514
+ const block = bytes(at, size.value).slice();
13515
+ init(at);
13516
+ bytes(at, block.length).set(block);
13517
+ }
13471
13518
  var STACK_POINTER, UNWINDING, REWINDING, AsyncifyDriver;
13472
13519
  var init_wasix_fork = __esm({
13473
13520
  "src/process/wasi/wasix-fork.ts"() {
@@ -13518,6 +13565,7 @@ var init_wasix_fork = __esm({
13518
13565
  for (const [id, snap] of state.setjmps?.snapshots ?? []) this.snapshots.set(id, snap);
13519
13566
  this.nextSnapshot = Math.max(this.nextSnapshot, state.setjmps?.next ?? 1);
13520
13567
  this.restoreGlobals(state.globals);
13568
+ reseatTls(this.exports, (at, length) => this.mem.bytes(at, length));
13521
13569
  this.answer = 0;
13522
13570
  this.exports.asyncify_start_rewind?.(state.asyncifyData);
13523
13571
  }
@@ -14166,6 +14214,7 @@ var init_wasix_linker = __esm({
14166
14214
  "use strict";
14167
14215
  init_dylink();
14168
14216
  init_wasi_files();
14217
+ init_wasix_fork();
14169
14218
  init_wasix_trampoline();
14170
14219
  init_wasm_functypes();
14171
14220
  TABLE_BASE2 = 1;
@@ -14347,6 +14396,10 @@ var init_wasix_linker = __esm({
14347
14396
  const global = linked.instance.exports.__tls_base;
14348
14397
  if (base === void 0 || !(global instanceof WebAssembly.Global)) return false;
14349
14398
  global.value = base;
14399
+ reseatTls(
14400
+ linked.instance.exports,
14401
+ (at, length) => new Uint8Array(this.memory.buffer, at, length)
14402
+ );
14350
14403
  return true;
14351
14404
  }
14352
14405
  replay(record) {