@ai-ecoverse/slicc-kernel 1.60.1 → 1.61.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.
@@ -3061,6 +3061,7 @@ function processes(l, self) {
3061
3061
  const viewer = credOf(self);
3062
3062
  return l.list(viewer).map(({ tid: _, cred = viewer, umask: _umask, ...entry }) => ({
3063
3063
  ...entry,
3064
+ rss: entry.memory,
3064
3065
  uid: cred.euid,
3065
3066
  gid: cred.egid
3066
3067
  }));
@@ -7809,6 +7810,19 @@ function mkdirOptions(entry, mode = 511) {
7809
7810
  const parents = 511 & ~(entry.umask?.() ?? 18) | 192;
7810
7811
  return { recursive: true, owner: { ...owner, parents } };
7811
7812
  }
7813
+ async function mkdirExclusive(entry, path, mode) {
7814
+ const { fs } = entry;
7815
+ const { owner } = mkdirOptions(entry, mode);
7816
+ const own = owner ? { owner } : {};
7817
+ try {
7818
+ await fs.mkdir(path, own);
7819
+ } catch (err) {
7820
+ if (err?.code !== "ENOENT") throw err;
7821
+ const above = owner ? { owner: { ...owner, mode: owner.parents } } : {};
7822
+ await fs.mkdir(path.slice(0, path.lastIndexOf("/")) || "/", { recursive: true, ...above });
7823
+ await fs.mkdir(path, own);
7824
+ }
7825
+ }
7812
7826
  async function chown(entry, path, req) {
7813
7827
  const cred = entry.cred?.();
7814
7828
  if (!cred) {
@@ -7841,7 +7855,7 @@ async function run(entry, path, req) {
7841
7855
  case "readdir-stat":
7842
7856
  return json2(await readdirStat(fs, path));
7843
7857
  case "mkdir":
7844
- await fs.mkdir(path, mkdirOptions(entry, req.mode));
7858
+ await (req.exclusive ? mkdirExclusive(entry, path, req.mode) : fs.mkdir(path, mkdirOptions(entry, req.mode)));
7845
7859
  return done;
7846
7860
  case "rm":
7847
7861
  await fs.rm(path, { recursive: true });