@ai-ecoverse/slicc-kernel 1.61.2 → 1.62.0

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.
@@ -7180,6 +7180,12 @@ function importsContext({
7180
7180
  if (path === void 0) throw new WasiError("EBADF");
7181
7181
  return path;
7182
7182
  };
7183
+ const owners = fs.owners === true;
7184
+ const live = () => {
7185
+ if (!owners) return { uid: UID2, gid: UID2 };
7186
+ const cred = call2({ op: "proc-cred" });
7187
+ return { uid: cred.euid, gid: cred.egid };
7188
+ };
7183
7189
  const fds = {
7184
7190
  open(path, o = {}) {
7185
7191
  const abs = host.fds.resolve(3, path);
@@ -7200,7 +7206,7 @@ function importsContext({
7200
7206
  const path = pathOf(fd);
7201
7207
  if (path === void 0) {
7202
7208
  const kind = e.type === "device" ? "device" : "stream";
7203
- return { kind, mode: kind === "device" ? 8630 : 4480, uid: UID2, gid: UID2, size: 0 };
7209
+ return { kind, mode: kind === "device" ? 8630 : 4480, ...live(), size: 0 };
7204
7210
  }
7205
7211
  host.fds.flushPath(path);
7206
7212
  const s = fs.stat(path);
@@ -7208,8 +7214,7 @@ function importsContext({
7208
7214
  kind: s.isDirectory ? "dir" : "file",
7209
7215
  path,
7210
7216
  mode: s.mode ?? (s.isDirectory ? 16877 : 33188),
7211
- uid: UID2,
7212
- gid: UID2,
7217
+ ...s.uid !== void 0 && s.gid !== void 0 ? { uid: s.uid, gid: s.gid } : live(),
7213
7218
  size: s.size,
7214
7219
  ...s.ino !== void 0 ? { ino: s.ino } : {},
7215
7220
  ...s.mtimeMs !== void 0 ? { mtimeMs: s.mtimeMs } : {}
@@ -7232,7 +7237,7 @@ function importsContext({
7232
7237
  call2({ op: "unlock", path: requirePath(fd) });
7233
7238
  }
7234
7239
  };
7235
- return {
7240
+ const ctx = {
7236
7241
  memory,
7237
7242
  instance,
7238
7243
  tid,
@@ -7271,6 +7276,11 @@ function importsContext({
7271
7276
  },
7272
7277
  errno: (err) => wasiErrnoOf(code(err))
7273
7278
  };
7279
+ if (!owners) return ctx;
7280
+ return Object.defineProperties(ctx, {
7281
+ uid: { get: () => live().uid, enumerable: true },
7282
+ gid: { get: () => live().gid, enumerable: true }
7283
+ });
7274
7284
  }
7275
7285
  function processes(host, call2, inThread) {
7276
7286
  const close = (fd) => void call2({ op: "fd-close", fd });