@ai-ecoverse/slicc-kernel 1.110.3 → 1.110.4

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.
package/dist/node.js CHANGED
@@ -6494,7 +6494,7 @@ function satisfies(version, range2) {
6494
6494
  }
6495
6495
 
6496
6496
  // src/version.ts
6497
- var KERNEL_VERSION = true ? "1.110.3" : "0.0.0-dev";
6497
+ var KERNEL_VERSION = true ? "1.110.4" : "0.0.0-dev";
6498
6498
  var OS_RELEASE = "6.0.0-slicc";
6499
6499
  function procVersion() {
6500
6500
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -2515,7 +2515,7 @@ var KERNEL_VERSION, OS_RELEASE;
2515
2515
  var init_version = __esm({
2516
2516
  "src/version.ts"() {
2517
2517
  "use strict";
2518
- KERNEL_VERSION = true ? "1.110.3" : "0.0.0-dev";
2518
+ KERNEL_VERSION = true ? "1.110.4" : "0.0.0-dev";
2519
2519
  OS_RELEASE = "6.0.0-slicc";
2520
2520
  }
2521
2521
  });
@@ -10082,6 +10082,14 @@ function importsContext({
10082
10082
  }
10083
10083
  return void 0;
10084
10084
  };
10085
+ const sizedOf = (fd) => {
10086
+ const e = host.fds.get(fd);
10087
+ if (e.type === "file") return { path: e.file.path, size: e.file.size() };
10088
+ if (e.type === "kernel" && host.fds.kind(fd, e) === "file") {
10089
+ return call2({ op: "fd-vfs-stat", fd });
10090
+ }
10091
+ return { path: pathOf(fd) };
10092
+ };
10085
10093
  const requirePath = (fd) => {
10086
10094
  const path = pathOf(fd);
10087
10095
  if (path === void 0) throw new WasiError("EBADF");
@@ -10112,19 +10120,19 @@ function importsContext({
10112
10120
  },
10113
10121
  fstat(fd) {
10114
10122
  const e = host.fds.get(fd);
10115
- const path = pathOf(fd);
10123
+ const { path, size } = sizedOf(fd);
10116
10124
  if (path === void 0) {
10117
10125
  const kind = e.type === "device" ? "device" : "stream";
10118
10126
  return { kind, mode: kind === "device" ? 8630 : 4480, ...live(), size: 0 };
10119
10127
  }
10120
- host.fds.flushPath(path);
10128
+ if (size === void 0) host.fds.flushPath(path);
10121
10129
  const s = fs.stat(path);
10122
10130
  return {
10123
10131
  kind: s.isDirectory ? "dir" : "file",
10124
10132
  path,
10125
10133
  mode: s.mode ?? (s.isDirectory ? 16877 : 33188),
10126
10134
  ...s.uid !== void 0 && s.gid !== void 0 ? { uid: s.uid, gid: s.gid } : live(),
10127
- size: s.size,
10135
+ size: size ?? s.size,
10128
10136
  ...s.ino !== void 0 ? { ino: s.ino } : {},
10129
10137
  ...s.mtimeMs !== void 0 ? { mtimeMs: s.mtimeMs } : {}
10130
10138
  };