@ai-ecoverse/slicc-kernel 1.125.2 → 1.125.3

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.
@@ -4829,7 +4829,11 @@ var init_wasi_host = __esm({
4829
4829
  }
4830
4830
  if (this.synthetic(path)) return ROOT_IDS;
4831
4831
  if (kernelDev(path)) return devSync(dev, devStat(path, follow3));
4832
- return follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
4832
+ return this.orDev(
4833
+ path,
4834
+ follow3,
4835
+ () => follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path)
4836
+ );
4833
4837
  };
4834
4838
  return wrap({
4835
4839
  fd_chown: (fd, uid, gid) => {
@@ -4908,7 +4912,16 @@ var init_wasi_host = __esm({
4908
4912
  const node = devSync(dev, devStat(path, (flags & AT_SYMLINK_NOFOLLOW) === 0));
4909
4913
  return void mem.view().setUint32(out, node.mode ?? DEVICE_MODE, true);
4910
4914
  }
4911
- const st = flags & AT_SYMLINK_NOFOLLOW ? this.o.fs.lstat(path) : this.o.fs.stat(path);
4915
+ const follow3 = (flags & AT_SYMLINK_NOFOLLOW) === 0;
4916
+ let st;
4917
+ try {
4918
+ st = follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
4919
+ } catch (err) {
4920
+ const device2 = this.orDev(path, follow3, () => {
4921
+ throw err;
4922
+ });
4923
+ return void mem.view().setUint32(out, device2.mode ?? DEVICE_MODE, true);
4924
+ }
4912
4925
  mem.view().setUint32(out, (st.isFifo ? S_IFIFO : 0) | modeOf2(st), true);
4913
4926
  }
4914
4927
  });
@@ -5618,6 +5631,21 @@ var init_wasi_host = __esm({
5618
5631
  synthetic(path) {
5619
5632
  return deviceOf(path) !== void 0 || path === SEALED_PATH && !!this.o.kernel.sys.openSealed || path === CLIPBOARD_PATH && !!this.o.kernel.sys.openClipboard;
5620
5633
  }
5634
+ linkedDev(path, follow3) {
5635
+ if (!follow3) return void 0;
5636
+ const real = physicalPath(this.o.fs, path);
5637
+ return real !== path && kernelDev(real) ? real : void 0;
5638
+ }
5639
+ orDev(path, follow3, stat) {
5640
+ try {
5641
+ return stat();
5642
+ } catch (err) {
5643
+ const device2 = err.code === "ENOENT" && this.linkedDev(path, follow3);
5644
+ if (!device2) throw err;
5645
+ const json2 = (req) => this.o.kernel.call(req);
5646
+ return devSync({ json: json2 }, devStat(device2, true));
5647
+ }
5648
+ }
5621
5649
  devChar(path, follow3) {
5622
5650
  try {
5623
5651
  const json2 = (req) => this.o.kernel.call(req);
@@ -5725,11 +5753,12 @@ var init_wasi_host = __esm({
5725
5753
  return filestatOf(path, follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path));
5726
5754
  } catch (err) {
5727
5755
  if (err.code !== "ENOENT") throw err;
5728
- if (kernelDev(path) && this.devChar(path, follow3)) {
5756
+ const device2 = kernelDev(path) ? path : this.linkedDev(path, follow3);
5757
+ if (device2 && this.devChar(device2, true)) {
5729
5758
  return this.local({
5730
5759
  filetype: FILETYPE.CHARACTER_DEVICE,
5731
5760
  size: 0n,
5732
- ino: pathInode(path),
5761
+ ino: pathInode(device2),
5733
5762
  mtimeNs: 0n
5734
5763
  });
5735
5764
  }
@@ -6295,7 +6324,7 @@ var KERNEL_VERSION, OS_RELEASE;
6295
6324
  var init_version = __esm({
6296
6325
  "src/version.ts"() {
6297
6326
  "use strict";
6298
- KERNEL_VERSION = true ? "1.125.2" : "0.0.0-dev";
6327
+ KERNEL_VERSION = true ? "1.125.3" : "0.0.0-dev";
6299
6328
  OS_RELEASE = "6.0.0-slicc";
6300
6329
  }
6301
6330
  });