@ai-ecoverse/slicc-kernel 1.99.2 → 1.100.1

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.
@@ -1484,6 +1484,69 @@ var init_cred = __esm({
1484
1484
  }
1485
1485
  });
1486
1486
 
1487
+ // src/process/wasi/slicc-lock.ts
1488
+ function kindOf(type) {
1489
+ if (type === F_RDLCK) return "read";
1490
+ if (type === F_WRLCK) return "write";
1491
+ if (type === F_UNLCK) return "unlock";
1492
+ throw new WasiError("EINVAL");
1493
+ }
1494
+ function baseOf(file, whence) {
1495
+ if (whence === SEEK_SET) return 0;
1496
+ if (whence === SEEK_CUR) return file.offset();
1497
+ if (whence === SEEK_END) return file.size();
1498
+ throw new WasiError("EINVAL");
1499
+ }
1500
+ function writeHolder(view, at, found) {
1501
+ if (!found) {
1502
+ view.setInt16(at, F_UNLCK, true);
1503
+ return;
1504
+ }
1505
+ view.setInt16(at, found.kind === "read" ? F_RDLCK : F_WRLCK, true);
1506
+ view.setInt16(at + 2, SEEK_SET, true);
1507
+ view.setBigInt64(at + 8, BigInt(found.start), true);
1508
+ view.setBigInt64(at + 16, BigInt(found.len), true);
1509
+ view.setInt32(at + 24, found.pid, true);
1510
+ }
1511
+ function lockImports(host) {
1512
+ return {
1513
+ fcntl_lock: (fd, cmd, at) => {
1514
+ if (cmd !== F_GETLK && cmd !== F_SETLK && cmd !== F_SETLKW) throw new WasiError("EINVAL");
1515
+ const file = host.file(fd);
1516
+ const view = host.mem.view();
1517
+ const kind = kindOf(view.getInt16(at, true));
1518
+ const start2 = baseOf(file, view.getInt16(at + 2, true)) + Number(view.getBigInt64(at + 8, true));
1519
+ const len = Number(view.getBigInt64(at + 16, true));
1520
+ if (cmd === F_GETLK) {
1521
+ if (kind === "unlock") throw new WasiError("EINVAL");
1522
+ writeHolder(view, at, host.calls.get(file.target, kind, start2, len));
1523
+ return;
1524
+ }
1525
+ if (kind === "read" && file.readable === false || kind === "write" && file.writable === false)
1526
+ throw new WasiError("EBADF");
1527
+ if (kind !== "write") host.flush(file);
1528
+ host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW);
1529
+ if (kind !== "unlock") host.locked();
1530
+ }
1531
+ };
1532
+ }
1533
+ var F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_WRLCK, F_UNLCK, SEEK_SET, SEEK_CUR, SEEK_END;
1534
+ var init_slicc_lock = __esm({
1535
+ "src/process/wasi/slicc-lock.ts"() {
1536
+ "use strict";
1537
+ init_wasi_files();
1538
+ F_GETLK = 12;
1539
+ F_SETLK = 13;
1540
+ F_SETLKW = 14;
1541
+ F_RDLCK = 0;
1542
+ F_WRLCK = 1;
1543
+ F_UNLCK = 2;
1544
+ SEEK_SET = 0;
1545
+ SEEK_CUR = 1;
1546
+ SEEK_END = 2;
1547
+ }
1548
+ });
1549
+
1487
1550
  // src/process/wasi/slicc-sem.ts
1488
1551
  function remainingMs(deadline, now) {
1489
1552
  if (deadline <= now) return 0;
@@ -2029,6 +2092,17 @@ var init_wasi_fds = __esm({
2029
2092
  }
2030
2093
  return out;
2031
2094
  }
2095
+ locking = false;
2096
+ holdLocks() {
2097
+ this.locking = true;
2098
+ }
2099
+ dropLocks(e) {
2100
+ if (!this.locking || e?.type !== "file") return;
2101
+ try {
2102
+ this.kernel.call({ op: "lk-close", path: e.file.path });
2103
+ } catch {
2104
+ }
2105
+ }
2032
2106
  close(fd) {
2033
2107
  const e = this.get(fd);
2034
2108
  this.table.delete(fd);
@@ -2037,6 +2111,7 @@ var init_wasi_fds = __esm({
2037
2111
  this.kernel.sys.close(fd);
2038
2112
  } finally {
2039
2113
  this.release(e);
2114
+ this.dropLocks(e);
2040
2115
  this.bump();
2041
2116
  }
2042
2117
  }
@@ -2055,6 +2130,7 @@ var init_wasi_fds = __esm({
2055
2130
  if (this.cloexec.delete(from)) this.cloexec.add(to);
2056
2131
  }
2057
2132
  if (old) this.release(old);
2133
+ this.dropLocks(old);
2058
2134
  this.bump();
2059
2135
  }
2060
2136
  release(e) {
@@ -3171,6 +3247,7 @@ var init_wasi_host = __esm({
3171
3247
  init_physical_path();
3172
3248
  init_cpu_clock();
3173
3249
  init_cred();
3250
+ init_slicc_lock();
3174
3251
  init_slicc_sem();
3175
3252
  init_wasi_abi();
3176
3253
  init_wasi_fds();
@@ -3393,6 +3470,26 @@ var init_wasi_host = __esm({
3393
3470
  void this.o.kernel.call({ op: "proc-setcred", change });
3394
3471
  },
3395
3472
  ...semImports(this),
3473
+ ...lockImports({
3474
+ mem,
3475
+ file: (fd) => this.lockedFile(fd),
3476
+ flush: (file) => {
3477
+ if (file.path !== void 0) this.fds.flushPath(file.path);
3478
+ else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
3479
+ },
3480
+ locked: () => this.fds.holdLocks(),
3481
+ calls: {
3482
+ set: (target, kind, start2, len, wait2) => void this.o.kernel.call({
3483
+ op: "lk-set",
3484
+ ...target,
3485
+ kind,
3486
+ start: start2,
3487
+ len,
3488
+ ...wait2 ? { wait: wait2 } : {}
3489
+ }),
3490
+ get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
3491
+ }
3492
+ }),
3396
3493
  groups_get: (buf, cap, count) => {
3397
3494
  const { groups } = this.o.kernel.call({ op: "proc-cred" });
3398
3495
  if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");
@@ -3785,6 +3882,26 @@ var init_wasi_host = __esm({
3785
3882
  }
3786
3883
  e.path = path;
3787
3884
  }
3885
+ lockedFile(fd) {
3886
+ const e = this.fds.get(fd);
3887
+ if (e.type === "file") {
3888
+ const { file } = e;
3889
+ return {
3890
+ target: { path: file.path },
3891
+ path: file.path,
3892
+ readable: file.readable,
3893
+ writable: file.writable,
3894
+ offset: () => file.offset,
3895
+ size: () => file.size()
3896
+ };
3897
+ }
3898
+ if (e.type !== "kernel" || this.fds.kind(fd, e) !== "file") throw new WasiError("EBADF");
3899
+ return {
3900
+ target: { fd },
3901
+ offset: () => this.o.kernel.sys.seek(fd, 0, WHENCE.CUR),
3902
+ size: () => this.kernelStat(fd).size
3903
+ };
3904
+ }
3788
3905
  kernelStat(fd) {
3789
3906
  return this.o.kernel.call({ op: "fd-vfs-stat", fd });
3790
3907
  }
@@ -4650,7 +4767,7 @@ var KERNEL_VERSION, OS_RELEASE;
4650
4767
  var init_version = __esm({
4651
4768
  "src/version.ts"() {
4652
4769
  "use strict";
4653
- KERNEL_VERSION = true ? "1.99.2" : "0.0.0-dev";
4770
+ KERNEL_VERSION = true ? "1.100.1" : "0.0.0-dev";
4654
4771
  OS_RELEASE = "6.0.0-slicc";
4655
4772
  }
4656
4773
  });
@@ -7246,8 +7363,8 @@ function createStreamOps(h) {
7246
7363
  },
7247
7364
  llseek(stream, offset, whence) {
7248
7365
  let pos = offset;
7249
- if (whence === SEEK_CUR) pos += stream.position;
7250
- else if (whence === SEEK_END && Fs.isFile(stream.node.mode)) {
7366
+ if (whence === SEEK_CUR2) pos += stream.position;
7367
+ else if (whence === SEEK_END2 && Fs.isFile(stream.node.mode)) {
7251
7368
  const s = stream.node.live;
7252
7369
  pos += rangedOf(stream.node)?.size() ?? (s.loaded ? s.len : statOf(stream.node).size);
7253
7370
  }
@@ -7607,7 +7724,7 @@ function readingLinks(Fs) {
7607
7724
  }
7608
7725
  };
7609
7726
  }
7610
- var S_IFDIR, S_IFREG, S_IFLNK, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR, SEEK_END, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
7727
+ var S_IFDIR, S_IFREG, S_IFLNK, PERM_MASK, DEFAULT_DIR_PERM, UMASK, SEEK_CUR2, SEEK_END2, EARLY_WHOLE_FILE, O_APPEND4, O_ACCMODE, O_TRUNC, O_PATH, stale, opening;
7611
7728
  var init_live_vfs_fs = __esm({
7612
7729
  "src/realm/live-vfs-fs.ts"() {
7613
7730
  "use strict";
@@ -7623,8 +7740,8 @@ var init_live_vfs_fs = __esm({
7623
7740
  PERM_MASK = 4095;
7624
7741
  DEFAULT_DIR_PERM = 493;
7625
7742
  UMASK = 18;
7626
- SEEK_CUR = 1;
7627
- SEEK_END = 2;
7743
+ SEEK_CUR2 = 1;
7744
+ SEEK_END2 = 2;
7628
7745
  EARLY_WHOLE_FILE = 64 * 1024;
7629
7746
  O_APPEND4 = 1024;
7630
7747
  O_ACCMODE = 3;
@@ -7653,23 +7770,23 @@ function sizeOf(Fs, stream) {
7653
7770
  const st = Fs.fstat?.(stream.fd);
7654
7771
  return st?.size ?? 0;
7655
7772
  }
7656
- function kindOf(type) {
7657
- if (type === F_RDLCK) return "read";
7658
- if (type === F_WRLCK) return "write";
7659
- return type === F_UNLCK ? "unlock" : void 0;
7773
+ function kindOf2(type) {
7774
+ if (type === F_RDLCK2) return "read";
7775
+ if (type === F_WRLCK2) return "write";
7776
+ return type === F_UNLCK2 ? "unlock" : void 0;
7660
7777
  }
7661
7778
  function readFlock(view, at, base) {
7662
- const kind = kindOf(view.getInt16(at, true));
7779
+ const kind = kindOf2(view.getInt16(at, true));
7663
7780
  if (kind === void 0) return void 0;
7664
7781
  const start2 = base(view.getInt16(at + 2, true)) + Number(view.getBigInt64(at + 8, true));
7665
7782
  return { kind, start: start2, len: Number(view.getBigInt64(at + 16, true)) };
7666
7783
  }
7667
- function writeHolder(view, at, found) {
7784
+ function writeHolder2(view, at, found) {
7668
7785
  if (!found) {
7669
- view.setInt16(at, F_UNLCK, true);
7786
+ view.setInt16(at, F_UNLCK2, true);
7670
7787
  return;
7671
7788
  }
7672
- view.setInt16(at, found.kind === "read" ? F_RDLCK : F_WRLCK, true);
7789
+ view.setInt16(at, found.kind === "read" ? F_RDLCK2 : F_WRLCK2, true);
7673
7790
  view.setInt16(at + 2, 0, true);
7674
7791
  view.setBigInt64(at + 8, BigInt(found.start), true);
7675
7792
  view.setBigInt64(at + 16, BigInt(found.len), true);
@@ -7679,12 +7796,12 @@ function refused2(kind, flags) {
7679
7796
  const access = flags & O_ACCMODE2;
7680
7797
  return kind === "write" && access === O_RDONLY || kind === "read" && access === O_WRONLY4;
7681
7798
  }
7682
- function baseOf(Fs, stream) {
7683
- return (whence) => whence === SEEK_CUR2 ? stream.position : whence === SEEK_END2 ? sizeOf(Fs, stream) : 0;
7799
+ function baseOf2(Fs, stream) {
7800
+ return (whence) => whence === SEEK_CUR3 ? stream.position : whence === SEEK_END3 ? sizeOf(Fs, stream) : 0;
7684
7801
  }
7685
7802
  function recordLock(fcntl, deps) {
7686
7803
  return (fd, cmd, varargs) => {
7687
- if (cmd !== F_GETLK && cmd !== F_SETLK && cmd !== F_SETLKW) return fcntl(fd, cmd, varargs);
7804
+ if (cmd !== F_GETLK2 && cmd !== F_SETLK2 && cmd !== F_SETLKW2) return fcntl(fd, cmd, varargs);
7688
7805
  const Fs = deps.fs();
7689
7806
  const buffer = deps.memory();
7690
7807
  const stream = Fs?.getStream(fd);
@@ -7692,11 +7809,11 @@ function recordLock(fcntl, deps) {
7692
7809
  if (!Fs || !buffer || !stream || !target) return fcntl(fd, cmd, varargs);
7693
7810
  const view = new DataView(buffer);
7694
7811
  const at = view.getUint32(varargs, true);
7695
- const lock = readFlock(view, at, baseOf(Fs, stream));
7696
- if (!lock || cmd === F_GETLK && lock.kind === "unlock") return -wasiErrno("EINVAL");
7812
+ const lock = readFlock(view, at, baseOf2(Fs, stream));
7813
+ if (!lock || cmd === F_GETLK2 && lock.kind === "unlock") return -wasiErrno("EINVAL");
7697
7814
  try {
7698
- if (cmd === F_GETLK) {
7699
- writeHolder(
7815
+ if (cmd === F_GETLK2) {
7816
+ writeHolder2(
7700
7817
  view,
7701
7818
  at,
7702
7819
  deps.kernel.getLock(target, lock.kind, lock.start, lock.len)
@@ -7705,7 +7822,7 @@ function recordLock(fcntl, deps) {
7705
7822
  }
7706
7823
  if (refused2(lock.kind, stream.flags)) return -wasiErrno("EBADF");
7707
7824
  if (lock.kind !== "write") deps.flush();
7708
- deps.kernel.setLock(target, lock.kind, lock.start, lock.len, cmd === F_SETLKW);
7825
+ deps.kernel.setLock(target, lock.kind, lock.start, lock.len, cmd === F_SETLKW2);
7709
7826
  if (lock.kind !== "unlock") held.set(Fs, true);
7710
7827
  return 0;
7711
7828
  } catch (err) {
@@ -7726,20 +7843,20 @@ function closeDropsLocks(Fs, kernel) {
7726
7843
  }
7727
7844
  };
7728
7845
  }
7729
- var F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_WRLCK, F_UNLCK, SEEK_CUR2, SEEK_END2, O_ACCMODE2, O_RDONLY, O_WRONLY4, held;
7846
+ var F_GETLK2, F_SETLK2, F_SETLKW2, F_RDLCK2, F_WRLCK2, F_UNLCK2, SEEK_CUR3, SEEK_END3, O_ACCMODE2, O_RDONLY, O_WRONLY4, held;
7730
7847
  var init_process_locks = __esm({
7731
7848
  "src/process/process-locks.ts"() {
7732
7849
  "use strict";
7733
7850
  init_live_vfs_fs();
7734
7851
  init_wasi_errno();
7735
- F_GETLK = 12;
7736
- F_SETLK = 13;
7737
- F_SETLKW = 14;
7738
- F_RDLCK = 0;
7739
- F_WRLCK = 1;
7740
- F_UNLCK = 2;
7741
- SEEK_CUR2 = 1;
7742
- SEEK_END2 = 2;
7852
+ F_GETLK2 = 12;
7853
+ F_SETLK2 = 13;
7854
+ F_SETLKW2 = 14;
7855
+ F_RDLCK2 = 0;
7856
+ F_WRLCK2 = 1;
7857
+ F_UNLCK2 = 2;
7858
+ SEEK_CUR3 = 1;
7859
+ SEEK_END3 = 2;
7743
7860
  O_ACCMODE2 = 3;
7744
7861
  O_RDONLY = 0;
7745
7862
  O_WRONLY4 = 1;
@@ -8387,14 +8504,14 @@ function cString(memory, at) {
8387
8504
  const bytes = new Uint8Array(memory.buffer, at);
8388
8505
  return new TextDecoder().decode(bytes.subarray(0, bytes.indexOf(0)));
8389
8506
  }
8390
- function baseOf2(Fs, dirfd) {
8507
+ function baseOf3(Fs, dirfd) {
8391
8508
  return dirfd === AT_FDCWD ? Fs.cwd?.() ?? "/" : Fs.getStream?.(dirfd)?.path ?? "/";
8392
8509
  }
8393
8510
  function readonlyRefusal(Fs, memory, call2) {
8394
8511
  if (!(call2.amode & W_ACCESS)) return 0;
8395
8512
  try {
8396
8513
  const name2 = cString(memory, call2.path);
8397
- const abs = name2.startsWith("/") ? name2 : `${baseOf2(Fs, call2.dirfd)}/${name2}`;
8514
+ const abs = name2.startsWith("/") ? name2 : `${baseOf3(Fs, call2.dirfd)}/${name2}`;
8398
8515
  const follow2 = (call2.flags & AT_SYMLINK_NOFOLLOW2) === 0;
8399
8516
  const { node } = Fs.lookupPath.call(Fs, abs, {
8400
8517
  follow: follow2
@@ -8409,7 +8526,7 @@ function readonlyRefusal(Fs, memory, call2) {
8409
8526
  }
8410
8527
  function kernelChecks(Fs, memory, call2) {
8411
8528
  const name2 = cString(memory, call2.path);
8412
- const abs = name2.startsWith("/") ? name2 : `${baseOf2(Fs, call2.dirfd)}/${name2}`;
8529
+ const abs = name2.startsWith("/") ? name2 : `${baseOf3(Fs, call2.dirfd)}/${name2}`;
8413
8530
  const lookupPath = Fs.lookupPath;
8414
8531
  const { node } = lookupPath.call(Fs, abs, { follow: (call2.flags & AT_SYMLINK_NOFOLLOW2) === 0 });
8415
8532
  const bridge = node.live ? node.mount.opts.bridge : void 0;
@@ -8445,7 +8562,7 @@ function kernelLink(imports, fs, memory, glue) {
8445
8562
  if (!Fs?.lookupPath || !heap) return own(olddirfd, oldpath, newdirfd, newpath, flags);
8446
8563
  const at = (dirfd, ptr) => {
8447
8564
  const name2 = cString(heap, ptr);
8448
- return name2.startsWith("/") ? name2 : `${baseOf2(Fs, dirfd)}/${name2}`;
8565
+ return name2.startsWith("/") ? name2 : `${baseOf3(Fs, dirfd)}/${name2}`;
8449
8566
  };
8450
8567
  try {
8451
8568
  const from = at(olddirfd, oldpath);
@@ -8614,11 +8731,11 @@ function pages(bytes) {
8614
8731
  function ticks(ms) {
8615
8732
  return Math.max(0, Math.floor(ms * HZ / 1e3));
8616
8733
  }
8617
- function pidStat(info, boot) {
8734
+ function pidStat(info, boot, state = info.state) {
8618
8735
  const fields = [
8619
8736
  info.pid,
8620
8737
  `(${commOf(info)})`,
8621
- info.state,
8738
+ state,
8622
8739
  info.ppid,
8623
8740
  info.pgid,
8624
8741
  info.sid,
@@ -8655,6 +8772,13 @@ function pidStat(info, boot) {
8655
8772
  return `${fields.join(" ")}
8656
8773
  `;
8657
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
+ }
8658
8782
  function pidStatus(info) {
8659
8783
  const state = STATES[info.state];
8660
8784
  const c = info.cred ?? ROOT;
@@ -8968,7 +9092,11 @@ var init_procfs = __esm({
8968
9092
  `, ostype: "Linux\n" }
8969
9093
  };
8970
9094
  sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
8971
- 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
+ };
8972
9100
  tagLine = (tag) => `Tag: ${tag.replaceAll("\n", "\\n").replaceAll(" ", "\\t").replaceAll("\r", "\\r")}`;
8973
9101
  }
8974
9102
  });
@@ -9259,8 +9387,10 @@ var init_wasi_procfs = __esm({
9259
9387
  content: () => systemFile(top, this.listing(), Date.now(), this.memory)
9260
9388
  };
9261
9389
  }
9262
- if (!/^[1-9]\d*$/.test(top) || rest2.length > 0 || !this.alive(Number(top))) return void 0;
9263
- 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"] };
9264
9394
  if (!PID_NAMES.includes(leaf)) return void 0;
9265
9395
  return {
9266
9396
  kind: "file",
@@ -9272,6 +9402,28 @@ var init_wasi_procfs = __esm({
9272
9402
  }
9273
9403
  };
9274
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
+ }
9275
9427
  parts(path, follow2) {
9276
9428
  const parts = path.split("/").filter((p) => p !== "").slice(1);
9277
9429
  if (parts[0] === "self" && (follow2 || parts.length > 1)) parts[0] = String(this.pid);
@@ -13351,6 +13503,18 @@ function mutableGlobals(exports) {
13351
13503
  }
13352
13504
  return out;
13353
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
+ }
13354
13518
  var STACK_POINTER, UNWINDING, REWINDING, AsyncifyDriver;
13355
13519
  var init_wasix_fork = __esm({
13356
13520
  "src/process/wasi/wasix-fork.ts"() {
@@ -13401,6 +13565,7 @@ var init_wasix_fork = __esm({
13401
13565
  for (const [id, snap] of state.setjmps?.snapshots ?? []) this.snapshots.set(id, snap);
13402
13566
  this.nextSnapshot = Math.max(this.nextSnapshot, state.setjmps?.next ?? 1);
13403
13567
  this.restoreGlobals(state.globals);
13568
+ reseatTls(this.exports, (at, length) => this.mem.bytes(at, length));
13404
13569
  this.answer = 0;
13405
13570
  this.exports.asyncify_start_rewind?.(state.asyncifyData);
13406
13571
  }
@@ -14049,6 +14214,7 @@ var init_wasix_linker = __esm({
14049
14214
  "use strict";
14050
14215
  init_dylink();
14051
14216
  init_wasi_files();
14217
+ init_wasix_fork();
14052
14218
  init_wasix_trampoline();
14053
14219
  init_wasm_functypes();
14054
14220
  TABLE_BASE2 = 1;
@@ -14230,6 +14396,10 @@ var init_wasix_linker = __esm({
14230
14396
  const global = linked.instance.exports.__tls_base;
14231
14397
  if (base === void 0 || !(global instanceof WebAssembly.Global)) return false;
14232
14398
  global.value = base;
14399
+ reseatTls(
14400
+ linked.instance.exports,
14401
+ (at, length) => new Uint8Array(this.memory.buffer, at, length)
14402
+ );
14233
14403
  return true;
14234
14404
  }
14235
14405
  replay(record) {