@ai-ecoverse/slicc-kernel 1.122.3 → 1.123.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.
@@ -253,13 +253,14 @@ var init_cpu_clock = __esm({
253
253
  });
254
254
 
255
255
  // src/kernel/protocol.ts
256
- var WASM_PROCESS_INIT, WASM_PROCESS_EXIT, WASM_PROCESS_ERROR, WASM_THREAD_SPAWN, WASM_THREAD_INIT, WASM_THREAD_EXIT, WASM_MAX_THREADS, WASM_DEFAULT_THREADS;
256
+ var WASM_PROCESS_INIT, WASM_PROCESS_EXIT, WASM_PROCESS_ERROR, WASM_PROCESS_READY, WASM_THREAD_SPAWN, WASM_THREAD_INIT, WASM_THREAD_EXIT, WASM_MAX_THREADS, WASM_DEFAULT_THREADS;
257
257
  var init_protocol = __esm({
258
258
  "src/kernel/protocol.ts"() {
259
259
  "use strict";
260
260
  WASM_PROCESS_INIT = "wasm-process-init";
261
261
  WASM_PROCESS_EXIT = "wasm-process-exit";
262
262
  WASM_PROCESS_ERROR = "wasm-process-error";
263
+ WASM_PROCESS_READY = "wasm-process-ready";
263
264
  WASM_THREAD_SPAWN = "wasm-thread-spawn";
264
265
  WASM_THREAD_INIT = "wasm-thread-init";
265
266
  WASM_THREAD_EXIT = "wasm-thread-exit";
@@ -2602,7 +2603,7 @@ var KERNEL_VERSION, OS_RELEASE;
2602
2603
  var init_version = __esm({
2603
2604
  "src/version.ts"() {
2604
2605
  "use strict";
2605
- KERNEL_VERSION = true ? "1.122.3" : "0.0.0-dev";
2606
+ KERNEL_VERSION = true ? "1.123.0" : "0.0.0-dev";
2606
2607
  OS_RELEASE = "6.0.0-slicc";
2607
2608
  }
2608
2609
  });
@@ -5191,14 +5192,20 @@ var init_cred = __esm({
5191
5192
  });
5192
5193
 
5193
5194
  // src/process/procfs.ts
5195
+ function isSysFile(at) {
5196
+ return typeof at === "string" || typeof at === "function";
5197
+ }
5194
5198
  function sysEntry(parts) {
5195
5199
  let at = SYS_TREE;
5196
5200
  for (const part of parts) {
5197
- if (typeof at !== "object" || !Object.hasOwn(at, part)) return void 0;
5201
+ if (isSysFile(at) || !Object.hasOwn(at, part)) return void 0;
5198
5202
  at = at[part];
5199
5203
  }
5200
5204
  return at;
5201
5205
  }
5206
+ function sysText(file, listing) {
5207
+ return typeof file === "string" ? file : file(listing());
5208
+ }
5202
5209
  function commOf(info) {
5203
5210
  const name2 = info.argv[0] ?? "";
5204
5211
  return name2.slice(name2.lastIndexOf("/") + 1).slice(0, 15);
@@ -5448,7 +5455,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
5448
5455
  dir.node_ops.lookup = (at, child) => {
5449
5456
  if (!Object.hasOwn(tree, child)) throw error();
5450
5457
  const next2 = tree[child];
5451
- return typeof next2 === "string" ? file(at, child, () => next2) : sysDir(at, child, next2);
5458
+ return isSysFile(next2) ? file(at, child, () => sysText(next2, procList)) : sysDir(at, child, next2);
5452
5459
  };
5453
5460
  dir.node_ops.readdir = () => [".", "..", ...Object.keys(tree)];
5454
5461
  return dir;
@@ -5572,8 +5579,13 @@ var init_procfs = __esm({
5572
5579
  PID_FILES = ["cmdline", "comm", "stat", "statm", "status"];
5573
5580
  SYSTEM_FILES = ["loadavg", "meminfo", "stat", "uptime", "version"];
5574
5581
  SYS_TREE = {
5575
- kernel: { osrelease: `${OS_RELEASE}
5576
- `, ostype: "Linux\n" }
5582
+ kernel: {
5583
+ osrelease: `${OS_RELEASE}
5584
+ `,
5585
+ ostype: "Linux\n",
5586
+ slicc_wasm_memories: (listing) => `${listing.wasm?.live ?? 0} ${listing.wasm?.ceiling ?? 0}
5587
+ `
5588
+ }
5577
5589
  };
5578
5590
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
5579
5591
  STATES = {
@@ -6009,6 +6021,7 @@ async function runWasmProcess(init, port2, deps = {}) {
6009
6021
  return WebAssembly.instantiate(init.program.module, imports);
6010
6022
  }).then((instance) => {
6011
6023
  memory = wasmMemory(instance, imports);
6024
+ port2.postMessage({ type: WASM_PROCESS_READY });
6012
6025
  exports = instance.exports;
6013
6026
  publishMemory(init.sab, memory?.buffer.byteLength ?? 0);
6014
6027
  done(
@@ -6179,6 +6192,7 @@ var init_process_runtime = __esm({
6179
6192
  "src/process/process-runtime.ts"() {
6180
6193
  "use strict";
6181
6194
  init_loopback_names();
6195
+ init_protocol();
6182
6196
  init_signals();
6183
6197
  init_emscripten_vfs_hook();
6184
6198
  init_live_vfs_fs();
@@ -10987,7 +11001,9 @@ var init_wasi_procfs = __esm({
10987
11001
  }
10988
11002
  if (top === "sys") {
10989
11003
  const entry = sysEntry(parts.slice(1));
10990
- if (typeof entry === "string") return { kind: "file", content: () => entry };
11004
+ if (typeof entry === "string" || typeof entry === "function") {
11005
+ return { kind: "file", content: () => sysText(entry, () => this.listing()) };
11006
+ }
10991
11007
  return entry && { kind: "dir", names: () => Object.keys(entry) };
10992
11008
  }
10993
11009
  if (top === "self") {
@@ -13301,6 +13317,7 @@ async function runWasiProcess(init, port2) {
13301
13317
  restoreExportedMemory(instance, memory, init);
13302
13318
  main.memory = memoryOf(instance, memory);
13303
13319
  publishMemory(init.sab, sizeOf2(main)());
13320
+ port2.postMessage({ type: WASM_PROCESS_READY });
13304
13321
  signals.bind(instance.exports);
13305
13322
  if (importsSigactionHook(module)) signals.useHook();
13306
13323
  if (fork?.signals) signals.restore(fork.signals);