@ai-ecoverse/slicc-kernel 1.93.1 → 1.93.3

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
@@ -8279,7 +8279,7 @@ function statOf(attr2, path, mount) {
8279
8279
  size: attr2.size,
8280
8280
  mode: attr2.mode ?? fallback,
8281
8281
  mtime,
8282
- atime: mtime,
8282
+ atime: attr2.atime === void 0 ? mtime : new Date(attr2.atime),
8283
8283
  ctime: mtime,
8284
8284
  ino: attr2.ino ?? inodeOf(path),
8285
8285
  ...!inodeless(mount, attr2) && attr2.nlink !== void 0 ? { nlink: attr2.nlink } : {},
@@ -9324,7 +9324,7 @@ var MountFs = class _MountFs {
9324
9324
  ([to], n) => this.utimes(to, atime, mtime, n)
9325
9325
  );
9326
9326
  }
9327
- await this.setMtime(found, real, mtime);
9327
+ await this.setTimes(found, real, atime, mtime);
9328
9328
  }
9329
9329
  async lutimes(path, atime, mtime, redirects = 0) {
9330
9330
  const found = this.at(path);
@@ -9341,12 +9341,13 @@ var MountFs = class _MountFs {
9341
9341
  if (!found.mount.caps.linkTimes && (await this.lstat(real)).isSymbolicLink) {
9342
9342
  throw errnoError("EOPNOTSUPP", path);
9343
9343
  }
9344
- await this.setMtime(found, real, mtime);
9344
+ await this.setTimes(found, real, atime, mtime);
9345
9345
  }
9346
- async setMtime(found, real, mtime) {
9346
+ async setTimes(found, real, atime, mtime) {
9347
9347
  this.writable(found.mount, real);
9348
9348
  this.table.forget(found.mount, real);
9349
- await found.mount.conn.call({ op: "setattr", path: found.rel, mtime: mtime.getTime() });
9349
+ const times = { mtime: mtime.getTime(), atime: atime.getTime() };
9350
+ await found.mount.conn.call({ op: "setattr", path: found.rel, ...times });
9350
9351
  }
9351
9352
  noLinks() {
9352
9353
  const noLinkBase = this.base.noLinks.call(this.base);
@@ -10500,7 +10501,7 @@ function mountTable(mounts = []) {
10500
10501
  }
10501
10502
 
10502
10503
  // src/version.ts
10503
- var KERNEL_VERSION = true ? "1.93.1" : "0.0.0-dev";
10504
+ var KERNEL_VERSION = true ? "1.93.3" : "0.0.0-dev";
10504
10505
  var OS_RELEASE = "6.0.0-slicc";
10505
10506
  function procVersion() {
10506
10507
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14073,6 +14074,7 @@ var WasmProcess = class {
14073
14074
  this.nodes = options.nodes ?? new VfsNodes(options.fs);
14074
14075
  if (!options.nodes) options.openFiles?.add(this.nodes);
14075
14076
  this.children.onChildState = () => this.signal(SIG.CHLD);
14077
+ this.seedDl(options.dl);
14076
14078
  this.children.onReap = (pid2) => {
14077
14079
  this.deathSignals.delete(pid2);
14078
14080
  options.onReap?.(pid2);
@@ -14907,7 +14909,7 @@ var WasmProcess = class {
14907
14909
  switch (req.op) {
14908
14910
  case "proc-fork":
14909
14911
  this.refuseIfPending(req.restart);
14910
- return { ok: true, kind: "json", json: await this.children.fork(req.state) };
14912
+ return { ok: true, kind: "json", json: await this.children.fork(this.withDl(req.state)) };
14911
14913
  case "proc-spawn":
14912
14914
  this.refuseIfPending(req.restart);
14913
14915
  return { ok: true, kind: "json", json: await this.spawn(req) };
@@ -15050,6 +15052,20 @@ var WasmProcess = class {
15050
15052
  free: [],
15051
15053
  live: /* @__PURE__ */ new Set()
15052
15054
  };
15055
+ withDl(state) {
15056
+ if (this.dlLog.length === 0) return state;
15057
+ const { next: next2, handle, free, live } = this.closures;
15058
+ const dl = { log: [...this.dlLog], next: next2, handle, free: [...free], live: [...live] };
15059
+ return { ...state, dl };
15060
+ }
15061
+ seedDl(dl) {
15062
+ if (!dl) return;
15063
+ this.dlLog.push(...dl.log);
15064
+ this.closures.next = dl.next;
15065
+ this.closures.handle = dl.handle;
15066
+ this.closures.free.push(...dl.free);
15067
+ for (const index of dl.live) this.closures.live.add(index);
15068
+ }
15053
15069
  allocateClosure(floor) {
15054
15070
  const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
15055
15071
  this.closures.next = Math.max(this.closures.next, index + 1);
@@ -15359,6 +15375,7 @@ function processOptions(opts, header4, hooks, created3) {
15359
15375
  ...opts.settling ? { settling: opts.settling } : {},
15360
15376
  spawner: opts.spawner,
15361
15377
  forker: opts.forker,
15378
+ ...opts.fork?.dl ? { dl: opts.fork.dl } : {},
15362
15379
  fs: opts.fs,
15363
15380
  kill: opts.kill,
15364
15381
  ...opts.writesBack ? { writesBack: opts.writesBack } : {},
@@ -16770,6 +16787,12 @@ function withOwner(base, owner) {
16770
16787
  function fsError2(code, message3 = code) {
16771
16788
  return Object.assign(new Error(message3), { code });
16772
16789
  }
16790
+ var SET_ATTRS = ["mode", "mtime", "atime", "size", "uid", "gid"];
16791
+ function setAttrOf(req) {
16792
+ const attr2 = {};
16793
+ for (const key of SET_ATTRS) if (req[key] !== void 0) attr2[key] = req[key];
16794
+ return attr2;
16795
+ }
16773
16796
  async function dispatch(h, req) {
16774
16797
  switch (req.op) {
16775
16798
  case "getattr":
@@ -16814,13 +16837,7 @@ async function dispatch(h, req) {
16814
16837
  if (!h.readlink) throw fsError2("EINVAL", `${req.path} is not a symlink`);
16815
16838
  return h.readlink(req.path);
16816
16839
  case "setattr":
16817
- return h.setattr?.(req.path, {
16818
- ...req.mode !== void 0 ? { mode: req.mode } : {},
16819
- ...req.mtime !== void 0 ? { mtime: req.mtime } : {},
16820
- ...req.size !== void 0 ? { size: req.size } : {},
16821
- ...req.uid !== void 0 ? { uid: req.uid } : {},
16822
- ...req.gid !== void 0 ? { gid: req.gid } : {}
16823
- });
16840
+ return h.setattr?.(req.path, setAttrOf(req));
16824
16841
  case "statfs":
16825
16842
  return h.statfs?.() ?? null;
16826
16843
  default:
@@ -18032,11 +18049,13 @@ function idOption2(value) {
18032
18049
  return value !== void 0 && /^\d+$/.test(value) ? Number(value) : 0;
18033
18050
  }
18034
18051
  function created2(ino, kind, mode, from, owner) {
18052
+ const now = Date.now();
18035
18053
  return {
18036
18054
  kind,
18037
18055
  ino,
18038
18056
  mode: owner?.mode === void 0 ? mode : mode & ~4095 | owner.mode & 4095,
18039
- mtime: Date.now(),
18057
+ mtime: now,
18058
+ atime: now,
18040
18059
  data: new ChunkedBytes(),
18041
18060
  target: "",
18042
18061
  children: /* @__PURE__ */ new Map(),
@@ -18054,6 +18073,7 @@ function attr(node) {
18054
18073
  kind: node.kind,
18055
18074
  size: node.kind === "file" ? node.data.size : node.kind === "symlink" ? node.target.length : 4096,
18056
18075
  mtime: node.mtime,
18076
+ atime: node.atime,
18057
18077
  mode: node.mode,
18058
18078
  ino: node.ino,
18059
18079
  ...node.kind === "directory" ? {} : { nlink: node.links },
@@ -18216,6 +18236,7 @@ function tmpfs() {
18216
18236
  node.mtime = Date.now();
18217
18237
  }
18218
18238
  if (change.mtime !== void 0) node.mtime = change.mtime;
18239
+ if (change.atime !== void 0) node.atime = change.atime;
18219
18240
  owned3(node, change);
18220
18241
  },
18221
18242
  async statfs() {
@@ -19368,8 +19389,17 @@ var Launcher = class {
19368
19389
  }
19369
19390
  if (interpreter(head) !== "node") return void 0;
19370
19391
  const wasm = modulePath(glue);
19371
- if (!await this.base.exists(wasm)) return void 0;
19372
- return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19392
+ if (await this.base.exists(wasm)) {
19393
+ return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19394
+ }
19395
+ const owner = await this.glueOwner(glue, baseName(file), scope);
19396
+ return owner && { ...targetOf(owner), ...asked };
19397
+ }
19398
+ async glueOwner(glue, name2, scope) {
19399
+ const owners = [...(await this.commands(scope)).values()].filter(
19400
+ (c) => c.abi === "emscripten" && !c.script && c.glue === glue
19401
+ );
19402
+ return owners.find((c) => c.name === name2) ?? owners[0];
19373
19403
  }
19374
19404
  async head(path) {
19375
19405
  try {