@ai-ecoverse/slicc-kernel 1.86.0 → 1.88.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.
@@ -830,9 +830,9 @@ var init_wasi_files = __esm({
830
830
  readable;
831
831
  writable;
832
832
  append;
833
- constructor(buffer, readable2, writable2, append) {
833
+ constructor(buffer, readable3, writable2, append) {
834
834
  this.buffer = buffer;
835
- this.readable = readable2;
835
+ this.readable = readable3;
836
836
  this.writable = writable2;
837
837
  this.append = append;
838
838
  }
@@ -1015,6 +1015,7 @@ var init_wasi_threads = __esm({
1015
1015
  beforeSpawn;
1016
1016
  modules;
1017
1017
  received;
1018
+ blocked;
1018
1019
  port;
1019
1020
  memory;
1020
1021
  cap;
@@ -1035,6 +1036,7 @@ var init_wasi_threads = __esm({
1035
1036
  this.beforeSpawn?.();
1036
1037
  const tid = Atomics.add(this.ids, LAST_TID, 1) + 1;
1037
1038
  const modules = this.modules?.();
1039
+ const blocked = this.blocked?.() ?? 0;
1038
1040
  this.port.postMessage({
1039
1041
  type: WASM_THREAD_SPAWN,
1040
1042
  thread: {
@@ -1042,7 +1044,8 @@ var init_wasi_threads = __esm({
1042
1044
  arg,
1043
1045
  memory: this.memory,
1044
1046
  ids: this.ids.buffer,
1045
- ...modules ? { modules } : {}
1047
+ ...modules ? { modules } : {},
1048
+ ...blocked ? { blocked } : {}
1046
1049
  }
1047
1050
  });
1048
1051
  return tid;
@@ -1160,11 +1163,11 @@ function sabViews(sab) {
1160
1163
  window: new Uint8Array(sab, SAB_HEADER_BYTES)
1161
1164
  };
1162
1165
  }
1163
- var SAB_HEADER_I32, SAB_CLOCK_OFFSET, SAB_CLOCK_I64, SAB_HEADER_BYTES, SAB_I_STATE, SAB_I_SEQ, SAB_I_STATUS, SAB_I_TOTAL, SAB_I_CHUNK, SAB_I_OFFSET, SAB_I_REQ, SAB_I_PUB, SAB_I_SIGNALS, SAB_I_TIMERS, SAB_I_MEMORY, SAB_I_TOTAL_HI, SAB_I_OFFSET_HI, SAB_I_KILLED, SAB_I_ASYNC, SAB_I_STOP, U32, SAB_STATE_IDLE, SAB_STATE_PENDING, SAB_STATE_READY, SAB_STATUS_BYTES, SAB_STATUS_JSON, SAB_STATUS_VOID, SAB_STATUS_ERRNO, SAB_DEFAULT_WINDOW_BYTES, SAB_MIN_BYTES, SYNC_SAB_REQ_MSG, SYNC_SAB_NEXT_MSG, encoder, decoder;
1166
+ var SAB_HEADER_I32, SAB_CLOCK_OFFSET, SAB_CLOCK_I64, SAB_HEADER_BYTES, SAB_I_STATE, SAB_I_SEQ, SAB_I_STATUS, SAB_I_TOTAL, SAB_I_CHUNK, SAB_I_OFFSET, SAB_I_REQ, SAB_I_PUB, SAB_I_SIGNALS, SAB_I_TIMERS, SAB_I_MEMORY, SAB_I_TOTAL_HI, SAB_I_OFFSET_HI, SAB_I_KILLED, SAB_I_ASYNC, SAB_I_STOP, SAB_I_BLOCKED, U32, SAB_STATE_IDLE, SAB_STATE_PENDING, SAB_STATE_READY, SAB_STATUS_BYTES, SAB_STATUS_JSON, SAB_STATUS_VOID, SAB_STATUS_ERRNO, SAB_DEFAULT_WINDOW_BYTES, SAB_MIN_BYTES, SYNC_SAB_REQ_MSG, SYNC_SAB_NEXT_MSG, encoder, decoder;
1164
1167
  var init_sync_sab_wire = __esm({
1165
1168
  "src/realm/sync-sab-wire.ts"() {
1166
1169
  "use strict";
1167
- SAB_HEADER_I32 = 16;
1170
+ SAB_HEADER_I32 = 18;
1168
1171
  SAB_CLOCK_OFFSET = SAB_HEADER_I32 * 4;
1169
1172
  SAB_CLOCK_I64 = 3;
1170
1173
  SAB_HEADER_BYTES = SAB_CLOCK_OFFSET + SAB_CLOCK_I64 * 8;
@@ -1184,6 +1187,7 @@ var init_sync_sab_wire = __esm({
1184
1187
  SAB_I_KILLED = 13;
1185
1188
  SAB_I_ASYNC = 14;
1186
1189
  SAB_I_STOP = 15;
1190
+ SAB_I_BLOCKED = 16;
1187
1191
  U32 = 2 ** 32;
1188
1192
  SAB_STATE_IDLE = 0;
1189
1193
  SAB_STATE_PENDING = 1;
@@ -1984,12 +1988,10 @@ var init_wasi_fds = __esm({
1984
1988
  let fd;
1985
1989
  let kind;
1986
1990
  if (path === SEALED_PATH && openSealed) {
1987
- if (oflags & OFLAGS.DIRECTORY) throw new WasiError("ENOTDIR");
1988
- if (oflags & OFLAGS.CREAT && oflags & OFLAGS.EXCL) throw new WasiError("EEXIST");
1989
- fd = openSealed.call(this.kernel.sys);
1991
+ fd = this.openCharDevice(openSealed, oflags, rights);
1990
1992
  kind = "sealed";
1991
1993
  } else if (path === CLIPBOARD_PATH && openClipboard) {
1992
- fd = this.openClipboard(openClipboard, oflags, rights);
1994
+ fd = this.openCharDevice(openClipboard, oflags, rights);
1993
1995
  kind = "clipboard";
1994
1996
  } else if (path === "/dev/tty" || /^\/dev\/tty\d+$/.test(path)) {
1995
1997
  fd = openTty?.call(this.kernel.sys, path === "/dev/tty" ? void 0 : path);
@@ -2000,12 +2002,12 @@ var init_wasi_fds = __esm({
2000
2002
  this.bump();
2001
2003
  return fd;
2002
2004
  }
2003
- openClipboard(openClipboard, oflags, rights) {
2005
+ openCharDevice(openDevice2, oflags, rights) {
2004
2006
  if (oflags & OFLAGS.DIRECTORY) throw new WasiError("ENOTDIR");
2005
2007
  if (oflags & OFLAGS.CREAT && oflags & OFLAGS.EXCL) throw new WasiError("EEXIST");
2006
2008
  const want = wantOf(oflags, rights);
2007
2009
  const flags = want === 6 ? O_RDWR : want === 2 ? O_WRONLY : 0;
2008
- return openClipboard.call(this.kernel.sys, flags);
2010
+ return openDevice2.call(this.kernel.sys, flags);
2009
2011
  }
2010
2012
  open(path, oflags, rights, fdflags) {
2011
2013
  const device2 = deviceOf(path);
@@ -2057,7 +2059,7 @@ var init_wasi_fds = __esm({
2057
2059
  }
2058
2060
  }
2059
2061
  file(path, existing, oflags, rights, fdflags) {
2060
- const { readable: readable2, writable: writable2 } = openAccess(existing, oflags, rights);
2062
+ const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
2061
2063
  let buffer = this.buffers.get(path);
2062
2064
  if (buffer?.handle !== void 0 && this.fs.kept?.(buffer.handle)) {
2063
2065
  this.buffers.delete(path);
@@ -2072,7 +2074,7 @@ var init_wasi_fds = __esm({
2072
2074
  buffer = this.freshBuffer(path, existing, oflags, want);
2073
2075
  }
2074
2076
  buffer.opens++;
2075
- return new LocalFile(buffer, readable2, writable2, (fdflags & FDFLAGS.APPEND) !== 0);
2077
+ return new LocalFile(buffer, readable3, writable2, (fdflags & FDFLAGS.APPEND) !== 0);
2076
2078
  }
2077
2079
  freshBuffer(path, existing, oflags, want) {
2078
2080
  const made = !existing && this.createNew(path, oflags);
@@ -2091,9 +2093,9 @@ var init_wasi_fds = __esm({
2091
2093
  return buffer;
2092
2094
  }
2093
2095
  kernelFile(path, existing, oflags, rights, fdflags) {
2094
- const { readable: readable2, writable: writable2 } = openAccess(existing, oflags, rights);
2096
+ const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
2095
2097
  const append = (fdflags & FDFLAGS.APPEND) !== 0;
2096
- const flags = (writable2 ? readable2 ? O_RDWR : O_WRONLY : 0) | (append ? O_APPEND : 0);
2098
+ const flags = (writable2 ? readable3 ? O_RDWR : O_WRONLY : 0) | (append ? O_APPEND : 0);
2097
2099
  const made = !existing && this.createNew(path, oflags);
2098
2100
  const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
2099
2101
  const fd = this.kernel.sys.openVfs(path, flags, 0, {
@@ -2494,7 +2496,7 @@ function wrap(table) {
2494
2496
  }
2495
2497
  return out;
2496
2498
  }
2497
- var WasiExit, IDS, NS_PER_MS, AT_SYMLINK_NOFOLLOW, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGPIPE_EXIT, SEALED_MODE, WasiHost;
2499
+ var WasiExit, IDS, NS_PER_MS, AT_SYMLINK_NOFOLLOW, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
2498
2500
  var init_wasi_host = __esm({
2499
2501
  "src/process/wasi/wasi-host.ts"() {
2500
2502
  "use strict";
@@ -2525,6 +2527,7 @@ var init_wasi_host = __esm({
2525
2527
  MONOTONIC_BASE = BigInt(Math.round(performance.timeOrigin)) * NS_PER_MS;
2526
2528
  MAX_READ = 1024 * 1024;
2527
2529
  SIGPIPE_EXIT = 141;
2530
+ SIG_IGN = 1;
2528
2531
  SEALED_MODE = 8630;
2529
2532
  WasiHost = class {
2530
2533
  mem = new WasiMemory();
@@ -2536,6 +2539,7 @@ var init_wasi_host = __esm({
2536
2539
  onRaise;
2537
2540
  muted;
2538
2541
  signals;
2542
+ sigmask;
2539
2543
  interrupted;
2540
2544
  quietly = (fn) => fn();
2541
2545
  listening;
@@ -2727,7 +2731,23 @@ var init_wasi_host = __esm({
2727
2731
  const groups = Array.from({ length: n }, (_, i) => view.getUint32(buf + i * 4, true));
2728
2732
  void this.o.kernel.call({ op: "proc-setcred", change: { groups } });
2729
2733
  },
2730
- sigaction_set: (sig, disposition, flags) => this.signals ? this.signals.disposition(sig, disposition, flags) : E.NOSYS
2734
+ sigaction_set: (sig, disposition, flags) => {
2735
+ if (!this.signals) return E.NOSYS;
2736
+ const errno2 = this.signals.disposition(sig, disposition, flags);
2737
+ if (errno2 === E.SUCCESS && disposition === SIG_IGN) this.sigmask?.discard(sig);
2738
+ return errno2;
2739
+ },
2740
+ sigmask_set: (how, lo, hi, old) => this.sigmask ? this.sigmask.set(how, lo, hi, (oldLo, oldHi) => {
2741
+ if (old === 0) return;
2742
+ const view = mem.view();
2743
+ view.setUint32(old, oldLo, true);
2744
+ view.setUint32(old + 4, oldHi, true);
2745
+ }) : E.NOSYS,
2746
+ sigpending_get: (out) => {
2747
+ if (!this.sigmask) return E.NOSYS;
2748
+ mem.view().setBigUint64(out, BigInt(this.sigmask.pending()), true);
2749
+ return E.SUCCESS;
2750
+ }
2731
2751
  });
2732
2752
  }
2733
2753
  imports() {
@@ -3621,7 +3641,7 @@ function importsContext({
3621
3641
  }
3622
3642
  function processes(host, call2, inThread) {
3623
3643
  const close = (fd) => void call2({ op: "fd-close", fd });
3624
- const slot = (n, how, mine, theirs) => {
3644
+ const slot2 = (n, how, mine, theirs) => {
3625
3645
  if (how === "inherit") return { fd: n };
3626
3646
  if (how === "null") return { none: true };
3627
3647
  const [read2, write2] = call2({ op: "fd-pipe" });
@@ -3635,7 +3655,7 @@ function processes(host, call2, inThread) {
3635
3655
  const theirs = [];
3636
3656
  host.fds.promoteFiles();
3637
3657
  try {
3638
- const stdio = STDIO.map((name2, n) => slot(n, o[name2] ?? "inherit", mine, theirs));
3658
+ const stdio = STDIO.map((name2, n) => slot2(n, o[name2] ?? "inherit", mine, theirs));
3639
3659
  const req = {
3640
3660
  op: "proc-spawn",
3641
3661
  file: o.argv[0],
@@ -3821,6 +3841,20 @@ var init_signals = __esm({
3821
3841
  }
3822
3842
  });
3823
3843
 
3844
+ // src/version.ts
3845
+ function procVersion() {
3846
+ return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
3847
+ `;
3848
+ }
3849
+ var KERNEL_VERSION, OS_RELEASE;
3850
+ var init_version = __esm({
3851
+ "src/version.ts"() {
3852
+ "use strict";
3853
+ KERNEL_VERSION = true ? "1.88.0" : "0.0.0-dev";
3854
+ OS_RELEASE = "6.0.0-slicc";
3855
+ }
3856
+ });
3857
+
3824
3858
  // src/process/js/js-kernel.ts
3825
3859
  function modeOf(mode) {
3826
3860
  if (!Number.isInteger(mode) || mode < 0 || mode > 4095) {
@@ -4081,7 +4115,7 @@ function writable(io, fd) {
4081
4115
  abort: () => io.close(fd)
4082
4116
  });
4083
4117
  }
4084
- function childOps(kernel, io, defaults) {
4118
+ function childOps(kernel, io, defaults, sync) {
4085
4119
  const wait2 = async (pid) => {
4086
4120
  const r = await kernel.blocking({ op: "proc-wait", pid, nohang: false });
4087
4121
  const [, status2] = r.ok && r.kind === "json" ? r.json : [0, 0];
@@ -4101,25 +4135,45 @@ function childOps(kernel, io, defaults) {
4101
4135
  kill: (signal) => kill(pid, signal)
4102
4136
  };
4103
4137
  };
4104
- const spawn = async (o) => {
4138
+ const request = (o) => {
4105
4139
  const [file] = o.argv;
4106
4140
  if (file === void 0) throw new JsCallError("EINVAL", "spawn");
4107
4141
  const group = groupOf(o, "spawn");
4108
4142
  const named = argv0Of(o.argv0, "spawn");
4143
+ const death = deathOf(o.parentDeathSignal, defaults);
4144
+ return (stdio) => ({
4145
+ op: "proc-spawn",
4146
+ file,
4147
+ argv: [...o.argv],
4148
+ ...named,
4149
+ env: { ...o.env ?? defaults.env },
4150
+ cwd: o.cwd ?? defaults.cwd,
4151
+ stdio,
4152
+ ...group,
4153
+ ...death
4154
+ });
4155
+ };
4156
+ const spawnSync = (o) => {
4157
+ const spawning = request(o);
4158
+ const mine = [];
4159
+ const theirs = [];
4160
+ try {
4161
+ const stdio = slotsSync(sync, o, mine, theirs);
4162
+ return childOf(sync.json(spawning(stdio)), mine);
4163
+ } catch (err) {
4164
+ closeAllSync(sync, mine);
4165
+ throw err;
4166
+ } finally {
4167
+ closeAllSync(sync, theirs);
4168
+ }
4169
+ };
4170
+ const spawn = async (o) => {
4171
+ const spawning = request(o);
4109
4172
  const mine = [];
4110
4173
  const theirs = [];
4111
4174
  try {
4112
4175
  const stdio = await slots2(kernel, o, mine, theirs);
4113
- const pid = await kernel.json({
4114
- op: "proc-spawn",
4115
- file,
4116
- argv: [...o.argv],
4117
- ...named,
4118
- env: { ...o.env ?? defaults.env },
4119
- cwd: o.cwd ?? defaults.cwd,
4120
- stdio,
4121
- ...group
4122
- });
4176
+ const pid = await kernel.json(spawning(stdio));
4123
4177
  return childOf(pid, mine);
4124
4178
  } catch (err) {
4125
4179
  await closeAll(io, mine);
@@ -4128,7 +4182,7 @@ function childOps(kernel, io, defaults) {
4128
4182
  await closeAll(io, theirs);
4129
4183
  }
4130
4184
  };
4131
- return { spawn, wait: wait2, kill };
4185
+ return { spawn, wait: wait2, kill, spawnSync };
4132
4186
  }
4133
4187
  function groupOf(o, call2) {
4134
4188
  const { pgid, session } = o;
@@ -4139,6 +4193,13 @@ function groupOf(o, call2) {
4139
4193
  if (session && pgid !== void 0) throw new JsCallError("EINVAL", call2);
4140
4194
  return session ? { session: true } : pgid !== void 0 ? { pgid } : {};
4141
4195
  }
4196
+ function deathOf(signal, defaults) {
4197
+ if (signal === void 0) return {};
4198
+ if (typeof signal !== "number" && typeof signal !== "string") {
4199
+ throw new JsCallError("EINVAL", "spawn");
4200
+ }
4201
+ return { deathSignal: defaults.signal(signal) };
4202
+ }
4142
4203
  function argv0Of(argv0, call2) {
4143
4204
  if (argv0 === void 0) return {};
4144
4205
  if (typeof argv0 !== "string") throw new JsCallError("EINVAL", call2);
@@ -4147,27 +4208,43 @@ function argv0Of(argv0, call2) {
4147
4208
  async function closeAll(io, fds) {
4148
4209
  for (const fd of fds) if (fd !== void 0) await io.close(fd).catch(() => void 0);
4149
4210
  }
4150
- async function preflight(kernel, hows) {
4211
+ function closeAllSync(sync, fds) {
4212
+ for (const fd of fds) if (fd !== void 0) sync.raw({ op: "fd-close", fd });
4213
+ }
4214
+ function checked(hows) {
4215
+ const fds = [];
4151
4216
  for (const [n, how] of hows.entries()) {
4152
4217
  if (how === "pipe" || how === "null") continue;
4153
4218
  if (how !== "inherit" && typeof how !== "number") throw new JsCallError("EINVAL", "spawn");
4154
- await kernel.json({ op: "fd-info", fd: how === "inherit" ? n : how });
4219
+ fds.push(how === "inherit" ? n : how);
4155
4220
  }
4221
+ return fds;
4222
+ }
4223
+ async function preflight(kernel, hows) {
4224
+ for (const fd of checked(hows)) await kernel.json({ op: "fd-info", fd });
4225
+ }
4226
+ function slot(n, how, pipe, mine, theirs) {
4227
+ if (how === "inherit") return { fd: n };
4228
+ if (how === "null") return { none: true };
4229
+ if (typeof how === "number") return { fd: how };
4230
+ const [read2, write2] = pipe();
4231
+ mine[n] = n === 0 ? write2 : read2;
4232
+ theirs.push(n === 0 ? read2 : write2);
4233
+ return { fd: n === 0 ? read2 : write2 };
4234
+ }
4235
+ function slotsSync(sync, o, mine, theirs) {
4236
+ const hows = STDIO2.map((name2) => o[name2] ?? "inherit");
4237
+ for (const fd of checked(hows)) sync.json({ op: "fd-info", fd });
4238
+ const pipe = () => sync.json({ op: "fd-pipe" });
4239
+ return hows.map((how, n) => slot(n, how, pipe, mine, theirs));
4156
4240
  }
4157
4241
  async function slots2(kernel, o, mine, theirs) {
4158
4242
  const hows = STDIO2.map((name2) => o[name2] ?? "inherit");
4159
4243
  await preflight(kernel, hows);
4160
4244
  const stdio = [];
4161
4245
  for (const [n, how] of hows.entries()) {
4162
- if (how === "inherit") stdio.push({ fd: n });
4163
- else if (how === "null") stdio.push({ none: true });
4164
- else if (typeof how === "number") stdio.push({ fd: how });
4165
- else {
4166
- const [read2, write2] = await kernel.json({ op: "fd-pipe" });
4167
- mine[n] = n === 0 ? write2 : read2;
4168
- theirs.push(n === 0 ? read2 : write2);
4169
- stdio.push({ fd: n === 0 ? read2 : write2 });
4170
- }
4246
+ const pair = how === "pipe" ? await kernel.json({ op: "fd-pipe" }) : [];
4247
+ stdio.push(slot(n, how, () => pair, mine, theirs));
4171
4248
  }
4172
4249
  return stdio;
4173
4250
  }
@@ -4433,6 +4510,10 @@ function* aliasOf(fd, abs, o) {
4433
4510
  }
4434
4511
  return { fd: copy2, file };
4435
4512
  }
4513
+ function accessFlags(o) {
4514
+ const write2 = o.write === true || o.append === true || o.truncate === true;
4515
+ return write2 ? o.read === true ? 2 : 1 : 0;
4516
+ }
4436
4517
  function* opened(abs, o) {
4437
4518
  const node = yield* lookup(abs);
4438
4519
  if (isExclusive(o)) throw new JsCallError("EEXIST", abs);
@@ -4441,13 +4522,13 @@ function* opened(abs, o) {
4441
4522
  return { fd: yield openRequest(abs, { ...o, create: false }), file: false };
4442
4523
  case "tty":
4443
4524
  return { fd: yield { op: "fd-open-tty" }, file: false };
4444
- case "clipboard": {
4445
- const write2 = o.write === true || o.append === true || o.truncate === true;
4446
- const flags = write2 ? o.read === true ? 2 : 1 : 0;
4447
- return { fd: yield { op: "fd-open-clipboard", flags }, file: false };
4448
- }
4525
+ case "clipboard":
4526
+ return {
4527
+ fd: yield { op: "fd-open-clipboard", flags: accessFlags(o) },
4528
+ file: false
4529
+ };
4449
4530
  case "sealed":
4450
- return { fd: yield { op: "fd-open-sealed" }, file: false };
4531
+ return { fd: yield { op: "fd-open-sealed", flags: accessFlags(o) }, file: false };
4451
4532
  case "terminal": {
4452
4533
  const req = node.pts === void 0 ? { op: "fd-open-tty", name: node.name } : { op: "pty-slave-open", n: node.pts, noctty: true };
4453
4534
  return { fd: yield req, file: false };
@@ -5078,7 +5159,7 @@ function netOps(kernel, io) {
5078
5159
  return closed;
5079
5160
  };
5080
5161
  const shut = (how) => kernel.raw({ op: "sock-shutdown", fd, how });
5081
- const readable2 = new ReadableStream(
5162
+ const readable3 = new ReadableStream(
5082
5163
  {
5083
5164
  async pull(controller) {
5084
5165
  const chunk = await io.read(fd, void 0, stop.signal);
@@ -5094,7 +5175,7 @@ function netOps(kernel, io) {
5094
5175
  close: async () => void await shut(SHUT_WR),
5095
5176
  abort: () => close()
5096
5177
  });
5097
- return { fd, local: local2, remote, readable: readable2, writable: writable2, close };
5178
+ return { fd, local: local2, remote, readable: readable3, writable: writable2, close };
5098
5179
  };
5099
5180
  const resolve = async (host, signal) => {
5100
5181
  if (IPV4.test(host)) return host;
@@ -5928,7 +6009,7 @@ function websocketOp(kernel) {
5928
6009
  reason: closeReason(how.reason)
5929
6010
  });
5930
6011
  };
5931
- const readable2 = new ReadableStream(
6012
+ const readable3 = new ReadableStream(
5932
6013
  {
5933
6014
  async pull(controller) {
5934
6015
  let r;
@@ -5978,7 +6059,7 @@ function websocketOp(kernel) {
5978
6059
  close: () => close(),
5979
6060
  abort: () => close({ code: 1e3, reason: "" })
5980
6061
  });
5981
- return { url, protocol, readable: readable2, writable: writable2, closed, close };
6062
+ return { url, protocol, readable: readable3, writable: writable2, closed, close };
5982
6063
  };
5983
6064
  }
5984
6065
  var SEND_BUFFER, MAX_REASON, NEVER2, wait;
@@ -6011,9 +6092,11 @@ function signalNumber(signal) {
6011
6092
  if (Number.isInteger(signal) && signal >= 1 && signal <= 31) return signal;
6012
6093
  throw new JsCallError("EINVAL", `signal ${signal}`);
6013
6094
  }
6014
- const n = SIG[signal.slice(3)];
6015
- if (n === void 0) throw new JsCallError("EINVAL", `signal ${signal}`);
6016
- return n;
6095
+ const name2 = signal.slice(3);
6096
+ if (!signal.startsWith("SIG") || !Object.hasOwn(SIG, name2)) {
6097
+ throw new JsCallError("EINVAL", `signal ${signal}`);
6098
+ }
6099
+ return SIG[name2];
6017
6100
  }
6018
6101
  function resolvePath(cwd, path) {
6019
6102
  const parts = [];
@@ -6083,6 +6166,18 @@ function writer(kernel, info, pid) {
6083
6166
  };
6084
6167
  return { writes, writeAll };
6085
6168
  }
6169
+ function readable2(read2) {
6170
+ return new ReadableStream(
6171
+ {
6172
+ async pull(controller) {
6173
+ const chunk = await read2(0);
6174
+ if (chunk.length === 0) controller.close();
6175
+ else controller.enqueue(chunk);
6176
+ }
6177
+ },
6178
+ { highWaterMark: 0 }
6179
+ );
6180
+ }
6086
6181
  function createContext(o) {
6087
6182
  const { kernel } = o;
6088
6183
  const infos = /* @__PURE__ */ new Map();
@@ -6163,8 +6258,10 @@ function createContext(o) {
6163
6258
  const syncKernel = new JsSyncKernel(lane, kernel, unwind);
6164
6259
  const terminal = ttyOps(kernel);
6165
6260
  const sync = {
6261
+ kernel: KERNEL_INFO,
6166
6262
  ...syncOps(syncKernel, { pid: o.pid, resolve, random, infos, handles }),
6167
6263
  run: (options) => runSync(syncKernel, { env: o.env, cwd: o.cwd, resolve, signal: signalNumber }, options),
6264
+ spawn: (options) => spawnSync(options),
6168
6265
  exit: (status2 = 0) => {
6169
6266
  exiting ??= status2 & 255;
6170
6267
  return exitAtOnce(lane, [...writes], terminal.modes(), exiting);
@@ -6179,9 +6276,11 @@ function createContext(o) {
6179
6276
  }
6180
6277
  };
6181
6278
  const io = { read: read2, send: writeAll, close: (fd) => ctx.close(fd) };
6182
- const children = childOps(kernel, io, { env: o.env, cwd: o.cwd, signal: signalNumber });
6279
+ const defaults = { env: o.env, cwd: o.cwd, signal: signalNumber };
6280
+ const { spawnSync, ...children } = childOps(kernel, io, defaults, syncKernel);
6183
6281
  const strays = o.strays ?? { exception: /* @__PURE__ */ new Set(), rejection: /* @__PURE__ */ new Set() };
6184
6282
  const ctx = {
6283
+ kernel: KERNEL_INFO,
6185
6284
  argv: o.argv,
6186
6285
  env: o.env,
6187
6286
  pid: o.pid,
@@ -6189,16 +6288,7 @@ function createContext(o) {
6189
6288
  return identityOf(await kernel.json({ op: "proc-identity" }), o).ppid;
6190
6289
  },
6191
6290
  cwd: o.cwd,
6192
- stdin: new ReadableStream(
6193
- {
6194
- async pull(controller) {
6195
- const chunk = await read2(0);
6196
- if (chunk.length === 0) controller.close();
6197
- else controller.enqueue(chunk);
6198
- }
6199
- },
6200
- { highWaterMark: 0 }
6201
- ),
6291
+ stdin: readable2(read2),
6202
6292
  stdout: writable2(1),
6203
6293
  stderr: writable2(2),
6204
6294
  read: read2,
@@ -6407,12 +6497,13 @@ function pathOps(kernel, resolve, statOf, open) {
6407
6497
  }
6408
6498
  };
6409
6499
  }
6410
- var JsExit, encoder4;
6500
+ var KERNEL_INFO, JsExit, encoder4;
6411
6501
  var init_js_context = __esm({
6412
6502
  "src/process/js/js-context.ts"() {
6413
6503
  "use strict";
6414
6504
  init_signals();
6415
6505
  init_sync_fs_wire();
6506
+ init_version();
6416
6507
  init_js_children();
6417
6508
  init_js_dev();
6418
6509
  init_js_exit();
@@ -6424,6 +6515,7 @@ var init_js_context = __esm({
6424
6515
  init_js_sync();
6425
6516
  init_js_tty();
6426
6517
  init_js_websocket();
6518
+ KERNEL_INFO = Object.freeze({ version: KERNEL_VERSION });
6427
6519
  JsExit = class extends Error {
6428
6520
  status;
6429
6521
  constructor(status2) {
@@ -7901,7 +7993,7 @@ var init_kernel_streams = __esm({
7901
7993
  openSealed(open, path, flags, mode) {
7902
7994
  const { openSealed } = this.sys;
7903
7995
  if (path !== SEALED_PATH2 || !openSealed) return void 0;
7904
- const kfd = this.call(() => openSealed.call(this.sys));
7996
+ const kfd = this.call(() => openSealed.call(this.sys, flags & 3));
7905
7997
  return this.vessel(open, kfd, { path, flags, mode }, false);
7906
7998
  }
7907
7999
  openClipboard(open, path, flags, mode) {
@@ -8953,8 +9045,8 @@ function describeInherited(Fs, sys, streams, livePath, actions = []) {
8953
9045
  const out = [];
8954
9046
  for (const [fd, stream] of slots3) {
8955
9047
  promote(stream);
8956
- const slot = inheritedSlot(fd, stream);
8957
- if (slot) out.push(slot);
9048
+ const slot2 = inheritedSlot(fd, stream);
9049
+ if (slot2) out.push(slot2);
8958
9050
  }
8959
9051
  return out;
8960
9052
  }
@@ -9172,7 +9264,7 @@ function createProcessKernel(deps) {
9172
9264
  const reaped = /* @__PURE__ */ new Map();
9173
9265
  const call2 = (req, label) => transport.call(req, Infinity, label);
9174
9266
  const at = (path) => path === "" || path.startsWith("/") ? path : `${Fs.cwd()}/${path}`;
9175
- const slot = (fd, n, promote) => {
9267
+ const slot2 = (fd, n, promote) => {
9176
9268
  const stream = fd >= 0 ? Fs.getStream(fd) : null;
9177
9269
  if (!stream) return { none: true };
9178
9270
  promote?.(stream);
@@ -9221,7 +9313,7 @@ function createProcessKernel(deps) {
9221
9313
  const unflushed = flushed(deps.beforeSpawn);
9222
9314
  if (unflushed < 0) return unflushed;
9223
9315
  const promote = deps.stdioPromoter?.();
9224
- const stdio = [0, 1, 2].map((n) => slot(fds[n] ?? -1, n, promote));
9316
+ const stdio = [0, 1, 2].map((n) => slot2(fds[n] ?? -1, n, promote));
9225
9317
  const inherit = deps.inherit?.(actions) ?? [];
9226
9318
  const req = {
9227
9319
  op: "proc-spawn",
@@ -9460,7 +9552,7 @@ var init_process_signals = __esm({
9460
9552
  interrupt() {
9461
9553
  this.report();
9462
9554
  const header = this.header;
9463
- const pending = Atomics.load(header, SAB_I_SIGNALS) | Atomics.load(header, SAB_I_TIMERS) | Atomics.load(header, SAB_I_KILLED);
9555
+ const pending = Atomics.load(header, SAB_I_SIGNALS) & ~Atomics.load(header, SAB_I_BLOCKED) | Atomics.load(header, SAB_I_TIMERS) | Atomics.load(header, SAB_I_KILLED);
9464
9556
  if (pending === 0) return false;
9465
9557
  this.deliver();
9466
9558
  return true;
@@ -9473,7 +9565,8 @@ var init_process_signals = __esm({
9473
9565
  this.hooks.killed(killed);
9474
9566
  }
9475
9567
  const timers = Atomics.exchange(this.header, SAB_I_TIMERS, 0);
9476
- const pending = Atomics.exchange(this.header, SAB_I_SIGNALS, 0);
9568
+ const blocked = Atomics.load(this.header, SAB_I_BLOCKED);
9569
+ const pending = blocked === 0 ? Atomics.exchange(this.header, SAB_I_SIGNALS, 0) : Atomics.and(this.header, SAB_I_SIGNALS, blocked) & ~blocked;
9477
9570
  if (this.depth <= 1) this.lastDelivered = pending | (timers & 1 ? sigbit(SIG.ALRM) : 0);
9478
9571
  if (pending !== 0 || timers !== 0) this.delivered++;
9479
9572
  for (let which = 0; which < 3; which++) {
@@ -9651,6 +9744,14 @@ var init_process_sockets = __esm({
9651
9744
  });
9652
9745
 
9653
9746
  // src/process/procfs.ts
9747
+ function sysEntry(parts) {
9748
+ let at = SYS_TREE;
9749
+ for (const part of parts) {
9750
+ if (typeof at !== "object" || !Object.hasOwn(at, part)) return void 0;
9751
+ at = at[part];
9752
+ }
9753
+ return at;
9754
+ }
9654
9755
  function commOf(info) {
9655
9756
  const name2 = info.argv[0] ?? "";
9656
9757
  return name2.slice(name2.lastIndexOf("/") + 1).slice(0, 15);
@@ -9735,7 +9836,7 @@ function pidStatus(info) {
9735
9836
  "SigQ: 0/0",
9736
9837
  "SigPnd: 0000000000000000",
9737
9838
  "ShdPnd: 0000000000000000",
9738
- "SigBlk: 0000000000000000",
9839
+ `SigBlk: ${sigMask(info.sigBlk)}`,
9739
9840
  `SigIgn: ${sigMask(info.sigIgn)}`,
9740
9841
  `SigCgt: ${sigMask(info.sigCgt)}`,
9741
9842
  ""
@@ -9771,6 +9872,7 @@ function memoryInfo(source, used = 0) {
9771
9872
  ].map(([key, value2]) => `${`${key}:`.padEnd(16)}${value2.padStart(12)}`).concat("").join("\n");
9772
9873
  }
9773
9874
  function systemFile(name2, listing, now, memory) {
9875
+ if (name2 === "version") return procVersion();
9774
9876
  const up = Math.max(0, now - listing.boot) / 1e3;
9775
9877
  if (name2 === "uptime") return `${up.toFixed(2)} ${up.toFixed(2)}
9776
9878
  `;
@@ -9887,6 +9989,16 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
9887
9989
  if (!info) throw error();
9888
9990
  return pidFile(name2, info, listing.boot);
9889
9991
  };
9992
+ const sysDir = (parent, name2, tree) => {
9993
+ const dir = fresh(parent, name2, DIR_MODE2);
9994
+ dir.node_ops.lookup = (at, child) => {
9995
+ if (!Object.hasOwn(tree, child)) throw error();
9996
+ const next2 = tree[child];
9997
+ return typeof next2 === "string" ? file(at, child, () => next2) : sysDir(at, child, next2);
9998
+ };
9999
+ dir.node_ops.readdir = () => [".", "..", ...Object.keys(tree)];
10000
+ return dir;
10001
+ };
9890
10002
  const pidNames = (names) => [.../* @__PURE__ */ new Set([...names, ...PID_FILES])];
9891
10003
  const pidDir = (name2, target) => {
9892
10004
  const dir = fresh(proc, name2, DIR_MODE2);
@@ -9911,7 +10023,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
9911
10023
  const readdir = procOps.readdir?.bind(procOps);
9912
10024
  const listAll = (node) => {
9913
10025
  const names = new Set(readdir ? readdir(node) : [".", ".."]);
9914
- for (const name2 of [...SYSTEM_FILES, "mounts"]) names.add(name2);
10026
+ for (const name2 of [...SYSTEM_FILES, "mounts", "sys"]) names.add(name2);
9915
10027
  for (const p of procList().processes) names.add(String(p.pid));
9916
10028
  return [...names];
9917
10029
  };
@@ -9923,6 +10035,7 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
9923
10035
  return pidDir(name2, Number(name2));
9924
10036
  }
9925
10037
  if (name2 === "mounts") return file(parent, name2, () => mountTable(sys.mountList?.() ?? []));
10038
+ if (name2 === "sys") return sysDir(parent, name2, SYS_TREE);
9926
10039
  if (SYSTEM_FILES.includes(name2)) {
9927
10040
  return file(
9928
10041
  parent,
@@ -9986,11 +10099,12 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
9986
10099
  readdir: (node) => pidNames(selfReaddir ? selfReaddir(node) : [".", ".."])
9987
10100
  };
9988
10101
  }
9989
- var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, UID2, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, sigMask, STATES, tagLine;
10102
+ var HZ, DIR_MODE2, FILE_MODE, LINK_MODE2, ENOENT, EINVAL, UID2, KIB, FALLBACK_MEMORY, PID_FILES, SYSTEM_FILES, SYS_TREE, sigMask, STATES, tagLine;
9990
10103
  var init_procfs = __esm({
9991
10104
  "src/process/procfs.ts"() {
9992
10105
  "use strict";
9993
10106
  init_cred();
10107
+ init_version();
9994
10108
  init_process_fds();
9995
10109
  HZ = 100;
9996
10110
  DIR_MODE2 = 16749;
@@ -10002,7 +10116,11 @@ var init_procfs = __esm({
10002
10116
  KIB = 1024;
10003
10117
  FALLBACK_MEMORY = 4 * KIB * KIB * KIB;
10004
10118
  PID_FILES = ["cmdline", "comm", "stat", "statm", "status"];
10005
- SYSTEM_FILES = ["loadavg", "meminfo", "stat", "uptime"];
10119
+ SYSTEM_FILES = ["loadavg", "meminfo", "stat", "uptime", "version"];
10120
+ SYS_TREE = {
10121
+ kernel: { osrelease: `${OS_RELEASE}
10122
+ `, ostype: "Linux\n" }
10123
+ };
10006
10124
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
10007
10125
  STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
10008
10126
  tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
@@ -10146,8 +10264,8 @@ function kernelSys(transport) {
10146
10264
  openPts(n, noctty) {
10147
10265
  return json2(call2({ op: "pty-slave-open", n, noctty }, `pty-slave-open ${n}`));
10148
10266
  },
10149
- openSealed() {
10150
- return json2(call2({ op: "fd-open-sealed" }, "fd-open-sealed"));
10267
+ openSealed(flags) {
10268
+ return json2(call2({ op: "fd-open-sealed", flags }, "fd-open-sealed"));
10151
10269
  },
10152
10270
  openClipboard(flags) {
10153
10271
  return json2(call2({ op: "fd-open-clipboard", flags }, "fd-open-clipboard"));
@@ -10976,11 +11094,17 @@ var init_wasi_procfs = __esm({
10976
11094
  names: () => [
10977
11095
  ...SYSTEM_NAMES,
10978
11096
  "mounts",
11097
+ "sys",
10979
11098
  "self",
10980
11099
  ...this.listing().processes.map((p) => String(p.pid))
10981
11100
  ]
10982
11101
  };
10983
11102
  }
11103
+ if (top === "sys") {
11104
+ const entry = sysEntry(parts.slice(1));
11105
+ if (typeof entry === "string") return { kind: "file", content: () => entry };
11106
+ return entry && { kind: "dir", names: () => Object.keys(entry) };
11107
+ }
10984
11108
  if (top === "self") {
10985
11109
  return leaf === void 0 ? { kind: "link", target: String(this.pid) } : void 0;
10986
11110
  }
@@ -11064,6 +11188,63 @@ var init_wasi_procfs = __esm({
11064
11188
  }
11065
11189
  });
11066
11190
 
11191
+ // src/process/wasi/wasi-sigmask.ts
11192
+ var UNBLOCKABLE, LIBC_UNBLOCKABLE, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK, kernelBits, libcBits, apply, WasiSigmask;
11193
+ var init_wasi_sigmask = __esm({
11194
+ "src/process/wasi/wasi-sigmask.ts"() {
11195
+ "use strict";
11196
+ init_signals();
11197
+ init_sync_sab_wire();
11198
+ init_wasi_abi();
11199
+ UNBLOCKABLE = sigbit(SIG.KILL) | sigbit(SIG.STOP);
11200
+ LIBC_UNBLOCKABLE = 1 << SIG.KILL - 1 | 1 << SIG.STOP - 1;
11201
+ SIG_BLOCK = 0;
11202
+ SIG_UNBLOCK = 1;
11203
+ SIG_SETMASK = 2;
11204
+ kernelBits = (lo) => lo << 1 & ~UNBLOCKABLE;
11205
+ libcBits = (bits) => bits >>> 1 & ~LIBC_UNBLOCKABLE;
11206
+ apply = (how, mask, set) => {
11207
+ if (how === SIG_BLOCK) return mask | set;
11208
+ if (how === SIG_UNBLOCK) return mask & ~set;
11209
+ return set;
11210
+ };
11211
+ WasiSigmask = class {
11212
+ lo;
11213
+ hi = 0;
11214
+ header;
11215
+ deliver;
11216
+ process;
11217
+ constructor(header, deliver, process) {
11218
+ this.header = header;
11219
+ this.deliver = deliver;
11220
+ this.process = process;
11221
+ this.lo = libcBits(Atomics.load(header, SAB_I_BLOCKED));
11222
+ }
11223
+ static unsupported(header) {
11224
+ Atomics.store(header, SAB_I_BLOCKED, 0);
11225
+ }
11226
+ set(how, setLo, setHi, old) {
11227
+ if (how !== SIG_BLOCK && how !== SIG_UNBLOCK && how !== SIG_SETMASK) return E.INVAL;
11228
+ old(this.lo >>> 0, this.hi >>> 0);
11229
+ this.lo = apply(how, this.lo, setLo | 0) & ~LIBC_UNBLOCKABLE;
11230
+ this.hi = apply(how, this.hi, setHi | 0);
11231
+ const now = kernelBits(this.lo);
11232
+ Atomics.store(this.header, SAB_I_BLOCKED, now);
11233
+ if ((Atomics.load(this.header, SAB_I_SIGNALS) & ~now) !== 0) this.deliver();
11234
+ return E.SUCCESS;
11235
+ }
11236
+ discard(sig) {
11237
+ Atomics.and(this.header, SAB_I_SIGNALS, ~sigbit(sig));
11238
+ if (this.process) Atomics.and(this.process, SAB_I_SIGNALS, ~sigbit(sig));
11239
+ }
11240
+ pending() {
11241
+ const own = Atomics.load(this.header, SAB_I_SIGNALS);
11242
+ return libcBits(own | (this.process ? Atomics.load(this.process, SAB_I_SIGNALS) : 0));
11243
+ }
11244
+ };
11245
+ }
11246
+ });
11247
+
11067
11248
  // src/process/wasi/wasi-signals.ts
11068
11249
  var DELIVERED_MASK, KERNEL_DEFAULTS, LIBC_DEFAULT_EXIT, SA_RESTART, DISPOSITION_IGNORE, DISPOSITION_HANDLER, withBit, WASIX_LIBC_DEFAULT_LINE, WasiSignals;
11069
11250
  var init_wasi_signals = __esm({
@@ -11149,7 +11330,11 @@ var init_wasi_signals = __esm({
11149
11330
  }
11150
11331
  raise(sig) {
11151
11332
  const handler = this.handler();
11152
- if (!handler) return;
11333
+ if (!handler && !this.hooked) return;
11334
+ if (!handler || this.hooked && (this.handlers & sigbit(sig)) === 0) {
11335
+ if ((this.ignoring & sigbit(sig)) === 0) this.defaultAction(sig);
11336
+ return;
11337
+ }
11153
11338
  const outer = { sig: this.delivering, defaulted: this.defaulted, libc: this.libcDefault };
11154
11339
  this.delivering = sig;
11155
11340
  this.defaulted = false;
@@ -13026,6 +13211,7 @@ __export(wasi_runtime_exports, {
13026
13211
  delivering: () => delivering,
13027
13212
  runWasiProcess: () => runWasiProcess,
13028
13213
  runWasiThread: () => runWasiThread,
13214
+ sigmaskOf: () => sigmaskOf,
13029
13215
  trapMessage: () => trapMessage,
13030
13216
  unsupportedImport: () => unsupportedImport,
13031
13217
  wireSignals: () => wireSignals
@@ -13062,6 +13248,16 @@ function delivering(ns, table, host, driver, before) {
13062
13248
  }
13063
13249
  return out;
13064
13250
  }
13251
+ function sigmaskOf(module, sab, gate, threads, process) {
13252
+ const header = new Int32Array(sab, 0, SAB_HEADER_I32);
13253
+ if (!importsSlicc(module, "sigmask_set")) {
13254
+ WasiSigmask.unsupported(header);
13255
+ return void 0;
13256
+ }
13257
+ if (threads) threads.blocked = () => Atomics.load(header, SAB_I_BLOCKED);
13258
+ const shared = process && new Int32Array(process, 0, SAB_HEADER_I32);
13259
+ return new WasiSigmask(header, () => gate.deliver(), shared);
13260
+ }
13065
13261
  function enosys(module, name2, foreign) {
13066
13262
  const type = foreign?.[module]?.[name2];
13067
13263
  if (type === "other") throw new Error(noErrno(`${module}.${name2}`));
@@ -13375,6 +13571,7 @@ async function runWasiProcess(init, port3) {
13375
13571
  ),
13376
13572
  ...descriptors(init, fork, threads)
13377
13573
  });
13574
+ host.sigmask = sigmaskOf(module, init.sab, gate, threads);
13378
13575
  if (threads) {
13379
13576
  threads.beforeSpawn = () => {
13380
13577
  if (!host.fds.isShared) host.fds.share(threads.ids, false);
@@ -13469,6 +13666,7 @@ async function runWasiThread(init, port3) {
13469
13666
  ),
13470
13667
  shared: threads.ids
13471
13668
  });
13669
+ host.sigmask = sigmaskOf(init.program.module, init.sab, gate, threads, init.signals);
13472
13670
  const program = await programImports(init.program, host, transport, thread.tid);
13473
13671
  const { instance } = await instantiate(host, init.program.module, thread.memory, threads, {
13474
13672
  thread: true,
@@ -13504,7 +13702,7 @@ async function runWasiThread(init, port3) {
13504
13702
  throw e;
13505
13703
  }
13506
13704
  }
13507
- var TRAPPED, PREVIEW1, WASIX, SLICC, SIGNAL_CALLBACK, takeDefault, SLICC_FS, SLICC_TTY, RESERVED2, UNDELIVERED, DELIVERED, importsSigactionHook, noErrno, FALLBACK_MAXIMUM_PAGES, LinkSync, DL_GEN, BACKTRACE_FRAMES;
13705
+ var TRAPPED, PREVIEW1, WASIX, SLICC, SIGNAL_CALLBACK, takeDefault, SLICC_FS, SLICC_TTY, RESERVED2, UNDELIVERED, DELIVERED, importsSlicc, importsSigactionHook, noErrno, FALLBACK_MAXIMUM_PAGES, LinkSync, DL_GEN, BACKTRACE_FRAMES;
13508
13706
  var init_wasi_runtime = __esm({
13509
13707
  "src/process/wasi/wasi-runtime.ts"() {
13510
13708
  "use strict";
@@ -13522,6 +13720,7 @@ var init_wasi_runtime = __esm({
13522
13720
  init_wasi_imports();
13523
13721
  init_wasi_module();
13524
13722
  init_wasi_procfs();
13723
+ init_wasi_sigmask();
13525
13724
  init_wasi_signals();
13526
13725
  init_wasi_stats();
13527
13726
  init_wasi_threads();
@@ -13548,7 +13747,8 @@ var init_wasi_runtime = __esm({
13548
13747
  wasi: ["thread-spawn"]
13549
13748
  };
13550
13749
  DELIVERED = [PREVIEW1, WASIX, SLICC, SLICC_FS, SLICC_TTY];
13551
- importsSigactionHook = (module) => WebAssembly.Module.imports(module).some((i) => i.module === SLICC && i.name === "sigaction_set");
13750
+ importsSlicc = (module, name2) => WebAssembly.Module.imports(module).some((i) => i.module === SLICC && i.name === name2);
13751
+ importsSigactionHook = (module) => importsSlicc(module, "sigaction_set");
13552
13752
  noErrno = (key) => `imports ${key}: its result cannot carry ENOSYS, and this host does not provide it`;
13553
13753
  FALLBACK_MAXIMUM_PAGES = 32768;
13554
13754
  LinkSync = class {