@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.
@@ -2655,7 +2655,7 @@ var KERNEL_VERSION, OS_RELEASE;
2655
2655
  var init_version = __esm({
2656
2656
  "src/version.ts"() {
2657
2657
  "use strict";
2658
- KERNEL_VERSION = true ? "1.125.2" : "0.0.0-dev";
2658
+ KERNEL_VERSION = true ? "1.125.3" : "0.0.0-dev";
2659
2659
  OS_RELEASE = "6.0.0-slicc";
2660
2660
  }
2661
2661
  });
@@ -10206,7 +10206,11 @@ var init_wasi_host = __esm({
10206
10206
  }
10207
10207
  if (this.synthetic(path)) return ROOT_IDS;
10208
10208
  if (kernelDev(path)) return devSync(dev, devStat(path, follow3));
10209
- return follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
10209
+ return this.orDev(
10210
+ path,
10211
+ follow3,
10212
+ () => follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path)
10213
+ );
10210
10214
  };
10211
10215
  return wrap({
10212
10216
  fd_chown: (fd, uid, gid) => {
@@ -10285,7 +10289,16 @@ var init_wasi_host = __esm({
10285
10289
  const node = devSync(dev, devStat(path, (flags & AT_SYMLINK_NOFOLLOW2) === 0));
10286
10290
  return void mem.view().setUint32(out, node.mode ?? DEVICE_MODE, true);
10287
10291
  }
10288
- const st = flags & AT_SYMLINK_NOFOLLOW2 ? this.o.fs.lstat(path) : this.o.fs.stat(path);
10292
+ const follow3 = (flags & AT_SYMLINK_NOFOLLOW2) === 0;
10293
+ let st;
10294
+ try {
10295
+ st = follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
10296
+ } catch (err) {
10297
+ const device2 = this.orDev(path, follow3, () => {
10298
+ throw err;
10299
+ });
10300
+ return void mem.view().setUint32(out, device2.mode ?? DEVICE_MODE, true);
10301
+ }
10289
10302
  mem.view().setUint32(out, (st.isFifo ? S_IFIFO2 : 0) | modeOf2(st), true);
10290
10303
  }
10291
10304
  });
@@ -10995,6 +11008,21 @@ var init_wasi_host = __esm({
10995
11008
  synthetic(path) {
10996
11009
  return deviceOf(path) !== void 0 || path === SEALED_PATH2 && !!this.o.kernel.sys.openSealed || path === CLIPBOARD_PATH2 && !!this.o.kernel.sys.openClipboard;
10997
11010
  }
11011
+ linkedDev(path, follow3) {
11012
+ if (!follow3) return void 0;
11013
+ const real = physicalPath(this.o.fs, path);
11014
+ return real !== path && kernelDev(real) ? real : void 0;
11015
+ }
11016
+ orDev(path, follow3, stat) {
11017
+ try {
11018
+ return stat();
11019
+ } catch (err) {
11020
+ const device2 = err.code === "ENOENT" && this.linkedDev(path, follow3);
11021
+ if (!device2) throw err;
11022
+ const json2 = (req) => this.o.kernel.call(req);
11023
+ return devSync({ json: json2 }, devStat(device2, true));
11024
+ }
11025
+ }
10998
11026
  devChar(path, follow3) {
10999
11027
  try {
11000
11028
  const json2 = (req) => this.o.kernel.call(req);
@@ -11102,11 +11130,12 @@ var init_wasi_host = __esm({
11102
11130
  return filestatOf(path, follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path));
11103
11131
  } catch (err) {
11104
11132
  if (err.code !== "ENOENT") throw err;
11105
- if (kernelDev(path) && this.devChar(path, follow3)) {
11133
+ const device2 = kernelDev(path) ? path : this.linkedDev(path, follow3);
11134
+ if (device2 && this.devChar(device2, true)) {
11106
11135
  return this.local({
11107
11136
  filetype: FILETYPE.CHARACTER_DEVICE,
11108
11137
  size: 0n,
11109
- ino: pathInode(path),
11138
+ ino: pathInode(device2),
11110
11139
  mtimeNs: 0n
11111
11140
  });
11112
11141
  }