@ai-ecoverse/slicc-kernel 1.110.2 → 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.
@@ -4918,6 +4918,14 @@ function importsContext({
4918
4918
  }
4919
4919
  return void 0;
4920
4920
  };
4921
+ const sizedOf = (fd) => {
4922
+ const e = host.fds.get(fd);
4923
+ if (e.type === "file") return { path: e.file.path, size: e.file.size() };
4924
+ if (e.type === "kernel" && host.fds.kind(fd, e) === "file") {
4925
+ return call2({ op: "fd-vfs-stat", fd });
4926
+ }
4927
+ return { path: pathOf(fd) };
4928
+ };
4921
4929
  const requirePath = (fd) => {
4922
4930
  const path = pathOf(fd);
4923
4931
  if (path === void 0) throw new WasiError("EBADF");
@@ -4948,19 +4956,19 @@ function importsContext({
4948
4956
  },
4949
4957
  fstat(fd) {
4950
4958
  const e = host.fds.get(fd);
4951
- const path = pathOf(fd);
4959
+ const { path, size } = sizedOf(fd);
4952
4960
  if (path === void 0) {
4953
4961
  const kind = e.type === "device" ? "device" : "stream";
4954
4962
  return { kind, mode: kind === "device" ? 8630 : 4480, ...live(), size: 0 };
4955
4963
  }
4956
- host.fds.flushPath(path);
4964
+ if (size === void 0) host.fds.flushPath(path);
4957
4965
  const s = fs.stat(path);
4958
4966
  return {
4959
4967
  kind: s.isDirectory ? "dir" : "file",
4960
4968
  path,
4961
4969
  mode: s.mode ?? (s.isDirectory ? 16877 : 33188),
4962
4970
  ...s.uid !== void 0 && s.gid !== void 0 ? { uid: s.uid, gid: s.gid } : live(),
4963
- size: s.size,
4971
+ size: size ?? s.size,
4964
4972
  ...s.ino !== void 0 ? { ino: s.ino } : {},
4965
4973
  ...s.mtimeMs !== void 0 ? { mtimeMs: s.mtimeMs } : {}
4966
4974
  };
@@ -5204,7 +5212,7 @@ var KERNEL_VERSION, OS_RELEASE;
5204
5212
  var init_version = __esm({
5205
5213
  "src/version.ts"() {
5206
5214
  "use strict";
5207
- KERNEL_VERSION = true ? "1.110.2" : "0.0.0-dev";
5215
+ KERNEL_VERSION = true ? "1.110.4" : "0.0.0-dev";
5208
5216
  OS_RELEASE = "6.0.0-slicc";
5209
5217
  }
5210
5218
  });