@ai-ecoverse/slicc-kernel 1.47.0 → 1.47.1

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.
@@ -3126,7 +3126,14 @@ function createProcessKernel(deps) {
3126
3126
  getpgid: (pid) => number(call2({ op: "proc-getpgid", pid }, "getpgid")),
3127
3127
  getsid: (pid) => number(call2({ op: "proc-getsid", pid }, "getsid")),
3128
3128
  cred: () => credOf(call2({ op: "proc-cred" }, "cred")),
3129
- setcred: (change) => credOf(call2({ op: "proc-setcred", change }, "setcred")),
3129
+ setcred(change) {
3130
+ const cred = credOf(call2({ op: "proc-setcred", change }, "setcred"));
3131
+ if (typeof cred === "object" && deps.owner) {
3132
+ deps.owner.uid = cred.euid;
3133
+ deps.owner.gid = cred.egid;
3134
+ }
3135
+ return cred;
3136
+ },
3130
3137
  tcgetpgrp(fd) {
3131
3138
  const kfd = Fs.getStream(fd)?.sliccKernelFd;
3132
3139
  if (kfd === void 0) return -wasiErrno("ENOTTY");
@@ -3805,20 +3812,19 @@ var init_procfs = __esm({
3805
3812
  });
3806
3813
 
3807
3814
  // src/process/realm-user.ts
3808
- function ownByRealmUser(Fs) {
3815
+ function ownByCaller(Fs, cred) {
3816
+ const owner = { uid: cred?.euid ?? 0, gid: cred?.egid ?? 0 };
3809
3817
  const { stat, fstat } = Fs;
3810
- const owned = (attr2) => ({ ...attr2, uid: REALM_UID, gid: REALM_GID });
3818
+ const owned = (attr2) => ({ ...attr2, uid: owner.uid, gid: owner.gid });
3811
3819
  if (typeof stat === "function") {
3812
3820
  Fs.stat = (path, dontFollow) => owned(stat.call(Fs, path, dontFollow));
3813
3821
  }
3814
3822
  if (typeof fstat === "function") Fs.fstat = (fd) => owned(fstat.call(Fs, fd));
3823
+ return owner;
3815
3824
  }
3816
- var REALM_UID, REALM_GID;
3817
3825
  var init_realm_user = __esm({
3818
3826
  "src/process/realm-user.ts"() {
3819
3827
  "use strict";
3820
- REALM_UID = 1e3;
3821
- REALM_GID = 1e3;
3822
3828
  }
3823
3829
  });
3824
3830
 
@@ -4172,7 +4178,6 @@ async function runWasmProcess(init, port2, deps = {}) {
4172
4178
  memory: () => memory,
4173
4179
  memalign: () => exports?.emscripten_builtin_memalign
4174
4180
  });
4175
- ownByRealmUser(running.FS);
4176
4181
  const livePath = (s) => liveNodePath(s.node);
4177
4182
  running.sliccKernel = createProcessKernel({
4178
4183
  transport,
@@ -4187,7 +4192,8 @@ async function runWasmProcess(init, port2, deps = {}) {
4187
4192
  deliveries: () => signals.deliveries(),
4188
4193
  describeFork: () => describeForFork(running.FS, sys, streams, livePath),
4189
4194
  inherit: (actions) => describeInherited(running.FS, sys, streams, livePath, actions),
4190
- stdioPromoter: () => vfsPromoter(running.FS, sys, streams, livePath)
4195
+ stdioPromoter: () => vfsPromoter(running.FS, sys, streams, livePath),
4196
+ owner: ownByCaller(running.FS, init.cred)
4191
4197
  });
4192
4198
  running.sliccKernel.http = createHttpKernel(transport);
4193
4199
  running.sliccKernel.hostname = hostnameOf(init.env);