@ai-ecoverse/slicc-kernel 1.112.0 → 1.114.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.
@@ -328,7 +328,7 @@ function signalsIn(mask) {
328
328
  for (let sig = 1; sig <= 31; sig++) if (mask & sigbit(sig)) out.push(sig);
329
329
  return out;
330
330
  }
331
- var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME;
331
+ var SIG, IGNORED_BY_DEFAULT, STOPPING, SIGNAL_BY_NAME, SI, KERNEL_SIGINFO;
332
332
  var init_signals = __esm({
333
333
  "src/kernel/signals.ts"() {
334
334
  "use strict";
@@ -374,6 +374,13 @@ var init_signals = __esm({
374
374
  SIGSTOP: SIG.STOP,
375
375
  SIGCONT: SIG.CONT
376
376
  };
377
+ SI = { USER: 0, QUEUE: -1, TIMER: -2, TKILL: -6, KERNEL: 128 };
378
+ KERNEL_SIGINFO = Object.freeze({
379
+ code: SI.KERNEL,
380
+ pid: 0,
381
+ uid: 0,
382
+ status: 0
383
+ });
377
384
  }
378
385
  });
379
386
 
@@ -2515,7 +2522,7 @@ var KERNEL_VERSION, OS_RELEASE;
2515
2522
  var init_version = __esm({
2516
2523
  "src/version.ts"() {
2517
2524
  "use strict";
2518
- KERNEL_VERSION = true ? "1.112.0" : "0.0.0-dev";
2525
+ KERNEL_VERSION = true ? "1.114.0" : "0.0.0-dev";
2519
2526
  OS_RELEASE = "6.0.0-slicc";
2520
2527
  }
2521
2528
  });
@@ -8784,7 +8791,7 @@ function wrap(table) {
8784
8791
  }
8785
8792
  return out;
8786
8793
  }
8787
- var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
8794
+ var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
8788
8795
  var init_wasi_host = __esm({
8789
8796
  "src/process/wasi/wasi-host.ts"() {
8790
8797
  "use strict";
@@ -8823,6 +8830,7 @@ var init_wasi_host = __esm({
8823
8830
  DEFAULT_UMASK = 18;
8824
8831
  MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS4;
8825
8832
  MAX_READ = 1024 * 1024;
8833
+ SIGINFO_BYTES = 24;
8826
8834
  FD_ALIAS = /^\/(?:dev\/(stdin|stdout|stderr)|dev\/fd\/(\d+)|proc\/(self|[1-9]\d*)\/fd\/(\d+))$/;
8827
8835
  STDIO_FDS = { stdin: 0, stdout: 1, stderr: 2 };
8828
8836
  SIGPIPE_EXIT = 128 + SIG.PIPE;
@@ -9118,6 +9126,23 @@ var init_wasi_host = __esm({
9118
9126
  this.entered
9119
9127
  );
9120
9128
  },
9129
+ sigwait_info: (lo, _hi, timeout, info) => {
9130
+ const mask = this.sigmask;
9131
+ if (!mask) return E.NOSYS;
9132
+ let took = 0;
9133
+ const r = mask.sigwait(
9134
+ lo,
9135
+ timeout,
9136
+ (set) => void this.o.kernel.call({ op: "sig-waiting", tid: mask.tid, set }),
9137
+ (sig) => {
9138
+ took = sig;
9139
+ },
9140
+ this.entered
9141
+ );
9142
+ if (r === E.SUCCESS) this.writeSiginfo(info, took, mask.tid);
9143
+ return r;
9144
+ },
9145
+ siginfo_take: (sig, info) => this.writeSiginfo(info, sig, this.sigmask?.tid ?? this.tid, false) ? E.SUCCESS : E.NOENT,
9121
9146
  sigaction_inherited: (out) => {
9122
9147
  const bits = this.o.kernel.call({ op: "sig-inherited" });
9123
9148
  mem.view().setBigUint64(out, BigInt(libcBits(bits) >>> 0), true);
@@ -9712,6 +9737,22 @@ var init_wasi_host = __esm({
9712
9737
  return void 0;
9713
9738
  }
9714
9739
  }
9740
+ writeSiginfo(at, sig, tid, waited = true) {
9741
+ const taken = this.o.kernel.call({ op: "sig-info", sig, tid });
9742
+ if (!taken && !waited) return false;
9743
+ const info = taken ?? KERNEL_SIGINFO;
9744
+ const view = this.mem.view();
9745
+ const size = Math.min(view.getUint32(at, true), SIGINFO_BYTES);
9746
+ const fields = [sig, info.code, info.pid, info.uid, info.status];
9747
+ let filled = 4;
9748
+ for (const [i, value2] of fields.entries()) {
9749
+ if (4 + (i + 1) * 4 > size) break;
9750
+ view.setInt32(4 + at + i * 4, value2, true);
9751
+ filled = 4 + (i + 1) * 4;
9752
+ }
9753
+ view.setUint32(at, filled, true);
9754
+ return true;
9755
+ }
9715
9756
  fdAlias(path) {
9716
9757
  const m = FD_ALIAS.exec(path);
9717
9758
  if (!m) return void 0;
@@ -13165,7 +13206,7 @@ var init_wasi_runtime = __esm({
13165
13206
  UNDELIVERED = {
13166
13207
  [PREVIEW1]: ["proc_exit", "clock_time_get"],
13167
13208
  [WASIX]: ["proc_exit2", "thread_exit", "thread_spawn_v2", "callback_signal"],
13168
- [SLICC]: ["sigaction_set"],
13209
+ [SLICC]: ["sigaction_set", "siginfo_take"],
13169
13210
  wasi: ["thread-spawn"]
13170
13211
  };
13171
13212
  DELIVERED = [PREVIEW1, WASIX, SLICC, SLICC_FS, SLICC_TTY];
@@ -14914,7 +14955,23 @@ function netOps(kernel, io) {
14914
14955
  }
14915
14956
  };
14916
14957
  };
14958
+ const lookup2 = async (name3, options = {}) => {
14959
+ const family = options.family ?? 0;
14960
+ if (family !== 0 && family !== 4 && family !== 6) {
14961
+ throw new JsCallError("EAI_FAMILY", `resolve ${name3}`);
14962
+ }
14963
+ const signal = options.signal ?? NEVER;
14964
+ signal.throwIfAborted();
14965
+ const req = { op: "sock-resolve", name: String(name3), family };
14966
+ const r = await kernel.blocking(req, signal).catch((err) => {
14967
+ signal.throwIfAborted();
14968
+ if (err.code !== "ENOENT") throw err;
14969
+ throw new JsCallError("ENOTFOUND", `resolve ${name3}`);
14970
+ });
14971
+ return [...r.ok && r.kind === "json" ? r.json : []];
14972
+ };
14917
14973
  return {
14974
+ resolve: lookup2,
14918
14975
  listen: (options = {}) => opened2(async (fd) => {
14919
14976
  const addr = {
14920
14977
  family: "inet",