@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.
@@ -2475,7 +2475,7 @@ var KERNEL_VERSION, OS_RELEASE;
2475
2475
  var init_version = __esm({
2476
2476
  "src/version.ts"() {
2477
2477
  "use strict";
2478
- KERNEL_VERSION = true ? "1.100.0" : "0.0.0-dev";
2478
+ KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
2479
2479
  OS_RELEASE = "6.0.0-slicc";
2480
2480
  }
2481
2481
  });
@@ -4958,11 +4958,11 @@ function pages(bytes) {
4958
4958
  function ticks(ms) {
4959
4959
  return Math.max(0, Math.floor(ms * HZ / 1e3));
4960
4960
  }
4961
- function pidStat(info, boot) {
4961
+ function pidStat(info, boot, state = info.state) {
4962
4962
  const fields = [
4963
4963
  info.pid,
4964
4964
  `(${commOf(info)})`,
4965
- info.state,
4965
+ state,
4966
4966
  info.ppid,
4967
4967
  info.pgid,
4968
4968
  info.sid,
@@ -4999,6 +4999,13 @@ function pidStat(info, boot) {
4999
4999
  return `${fields.join(" ")}
5000
5000
  `;
5001
5001
  }
5002
+ function taskStat(info, tid, boot) {
5003
+ const thread = (info.threads ?? [{ tid: 1, state: info.state }]).find((t) => t.tid === tid);
5004
+ return thread && pidStat({ ...info, pid: tid }, boot, thread.state);
5005
+ }
5006
+ function taskIds(info) {
5007
+ return (info.threads ?? [{ tid: 1 }]).map((t) => t.tid);
5008
+ }
5002
5009
  function pidStatus(info) {
5003
5010
  const state = STATES[info.state];
5004
5011
  const c = info.cred ?? ROOT;
@@ -5312,7 +5319,11 @@ var init_procfs = __esm({
5312
5319
  `, ostype: "Linux\n" }
5313
5320
  };
5314
5321
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
5315
- STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
5322
+ STATES = {
5323
+ S: "S (sleeping)",
5324
+ T: "T (stopped)",
5325
+ Z: "Z (zombie)"
5326
+ };
5316
5327
  tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
5317
5328
  }
5318
5329
  });
@@ -10067,8 +10078,10 @@ var init_wasi_procfs = __esm({
10067
10078
  content: () => systemFile(top, this.listing(), Date.now(), this.memory)
10068
10079
  };
10069
10080
  }
10070
- if (!/^[1-9]\d*$/.test(top) || rest2.length > 0 || !this.alive(Number(top))) return void 0;
10071
- if (leaf === void 0) return { kind: "dir", names: () => [...PID_NAMES] };
10081
+ if (!/^[1-9]\d*$/.test(top) || !this.alive(Number(top))) return void 0;
10082
+ if (leaf === "task") return this.task(Number(top), rest2);
10083
+ if (rest2.length > 0) return void 0;
10084
+ if (leaf === void 0) return { kind: "dir", names: () => [...PID_NAMES, "task"] };
10072
10085
  if (!PID_NAMES.includes(leaf)) return void 0;
10073
10086
  return {
10074
10087
  kind: "file",
@@ -10080,6 +10093,28 @@ var init_wasi_procfs = __esm({
10080
10093
  }
10081
10094
  };
10082
10095
  }
10096
+ info(pid) {
10097
+ return this.listing().processes.find((p) => p.pid === pid);
10098
+ }
10099
+ task(pid, rest2) {
10100
+ const [tid, leaf, ...more] = rest2;
10101
+ const tids = () => taskIds(this.info(pid));
10102
+ if (tid === void 0) return { kind: "dir", names: () => tids().map(String) };
10103
+ if (!/^[1-9]\d*$/.test(tid) || more.length > 0 || !tids().includes(Number(tid)))
10104
+ return void 0;
10105
+ if (leaf === void 0) return { kind: "dir", names: () => ["stat"] };
10106
+ if (leaf !== "stat") return void 0;
10107
+ return {
10108
+ kind: "file",
10109
+ content: () => {
10110
+ const listing = this.listing();
10111
+ const info = listing.processes.find((p) => p.pid === pid);
10112
+ const line = info && taskStat(info, Number(tid), listing.boot);
10113
+ if (line === void 0) throw syncError("ENOENT", `/proc/${pid}/task/${tid}/stat`);
10114
+ return line;
10115
+ }
10116
+ };
10117
+ }
10083
10118
  parts(path, follow2) {
10084
10119
  const parts = path.split("/").filter((p) => p !== "").slice(1);
10085
10120
  if (parts[0] === "self" && (follow2 || parts.length > 1)) parts[0] = String(this.pid);
@@ -10415,6 +10450,18 @@ function mutableGlobals(exports) {
10415
10450
  }
10416
10451
  return out;
10417
10452
  }
10453
+ function reseatTls(exports, bytes) {
10454
+ const init = exports.__wasm_init_tls;
10455
+ const base = exports.__tls_base;
10456
+ const size = exports.__tls_size;
10457
+ if (typeof init !== "function" || !(base instanceof WebAssembly.Global) || !(size instanceof WebAssembly.Global)) {
10458
+ return;
10459
+ }
10460
+ const at = base.value;
10461
+ const block = bytes(at, size.value).slice();
10462
+ init(at);
10463
+ bytes(at, block.length).set(block);
10464
+ }
10418
10465
  var STACK_POINTER, UNWINDING, REWINDING, AsyncifyDriver;
10419
10466
  var init_wasix_fork = __esm({
10420
10467
  "src/process/wasi/wasix-fork.ts"() {
@@ -10465,6 +10512,7 @@ var init_wasix_fork = __esm({
10465
10512
  for (const [id, snap] of state.setjmps?.snapshots ?? []) this.snapshots.set(id, snap);
10466
10513
  this.nextSnapshot = Math.max(this.nextSnapshot, state.setjmps?.next ?? 1);
10467
10514
  this.restoreGlobals(state.globals);
10515
+ reseatTls(this.exports, (at, length) => this.mem.bytes(at, length));
10468
10516
  this.answer = 0;
10469
10517
  this.exports.asyncify_start_rewind?.(state.asyncifyData);
10470
10518
  }
@@ -11113,6 +11161,7 @@ var init_wasix_linker = __esm({
11113
11161
  "use strict";
11114
11162
  init_dylink();
11115
11163
  init_wasi_files();
11164
+ init_wasix_fork();
11116
11165
  init_wasix_trampoline();
11117
11166
  init_wasm_functypes();
11118
11167
  TABLE_BASE2 = 1;
@@ -11294,6 +11343,10 @@ var init_wasix_linker = __esm({
11294
11343
  const global = linked.instance.exports.__tls_base;
11295
11344
  if (base === void 0 || !(global instanceof WebAssembly.Global)) return false;
11296
11345
  global.value = base;
11346
+ reseatTls(
11347
+ linked.instance.exports,
11348
+ (at, length) => new Uint8Array(this.memory.buffer, at, length)
11349
+ );
11297
11350
  return true;
11298
11351
  }
11299
11352
  replay(record) {