@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.
@@ -9348,7 +9348,7 @@ function statOf(attr2, path, mount) {
9348
9348
  size: attr2.size,
9349
9349
  mode: attr2.mode ?? fallback,
9350
9350
  mtime,
9351
- atime: mtime,
9351
+ atime: attr2.atime === void 0 ? mtime : new Date(attr2.atime),
9352
9352
  ctime: mtime,
9353
9353
  ino: attr2.ino ?? inodeOf(path),
9354
9354
  ...!inodeless(mount, attr2) && attr2.nlink !== void 0 ? { nlink: attr2.nlink } : {},
@@ -10393,7 +10393,7 @@ var MountFs = class _MountFs {
10393
10393
  ([to], n) => this.utimes(to, atime, mtime, n)
10394
10394
  );
10395
10395
  }
10396
- await this.setMtime(found, real, mtime);
10396
+ await this.setTimes(found, real, atime, mtime);
10397
10397
  }
10398
10398
  async lutimes(path, atime, mtime, redirects = 0) {
10399
10399
  const found = this.at(path);
@@ -10410,12 +10410,13 @@ var MountFs = class _MountFs {
10410
10410
  if (!found.mount.caps.linkTimes && (await this.lstat(real)).isSymbolicLink) {
10411
10411
  throw errnoError("EOPNOTSUPP", path);
10412
10412
  }
10413
- await this.setMtime(found, real, mtime);
10413
+ await this.setTimes(found, real, atime, mtime);
10414
10414
  }
10415
- async setMtime(found, real, mtime) {
10415
+ async setTimes(found, real, atime, mtime) {
10416
10416
  this.writable(found.mount, real);
10417
10417
  this.table.forget(found.mount, real);
10418
- await found.mount.conn.call({ op: "setattr", path: found.rel, mtime: mtime.getTime() });
10418
+ const times = { mtime: mtime.getTime(), atime: atime.getTime() };
10419
+ await found.mount.conn.call({ op: "setattr", path: found.rel, ...times });
10419
10420
  }
10420
10421
  noLinks() {
10421
10422
  const noLinkBase = this.base.noLinks.call(this.base);
@@ -11569,7 +11570,7 @@ function mountTable(mounts = []) {
11569
11570
  }
11570
11571
 
11571
11572
  // src/version.ts
11572
- var KERNEL_VERSION = true ? "1.93.1" : "0.0.0-dev";
11573
+ var KERNEL_VERSION = true ? "1.93.3" : "0.0.0-dev";
11573
11574
  var OS_RELEASE = "6.0.0-slicc";
11574
11575
  function procVersion() {
11575
11576
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14378,6 +14379,7 @@ var WasmProcess = class {
14378
14379
  this.nodes = options.nodes ?? new VfsNodes(options.fs);
14379
14380
  if (!options.nodes) options.openFiles?.add(this.nodes);
14380
14381
  this.children.onChildState = () => this.signal(SIG.CHLD);
14382
+ this.seedDl(options.dl);
14381
14383
  this.children.onReap = (pid2) => {
14382
14384
  this.deathSignals.delete(pid2);
14383
14385
  options.onReap?.(pid2);
@@ -15212,7 +15214,7 @@ var WasmProcess = class {
15212
15214
  switch (req.op) {
15213
15215
  case "proc-fork":
15214
15216
  this.refuseIfPending(req.restart);
15215
- return { ok: true, kind: "json", json: await this.children.fork(req.state) };
15217
+ return { ok: true, kind: "json", json: await this.children.fork(this.withDl(req.state)) };
15216
15218
  case "proc-spawn":
15217
15219
  this.refuseIfPending(req.restart);
15218
15220
  return { ok: true, kind: "json", json: await this.spawn(req) };
@@ -15355,6 +15357,20 @@ var WasmProcess = class {
15355
15357
  free: [],
15356
15358
  live: /* @__PURE__ */ new Set()
15357
15359
  };
15360
+ withDl(state) {
15361
+ if (this.dlLog.length === 0) return state;
15362
+ const { next: next2, handle, free, live } = this.closures;
15363
+ const dl = { log: [...this.dlLog], next: next2, handle, free: [...free], live: [...live] };
15364
+ return { ...state, dl };
15365
+ }
15366
+ seedDl(dl) {
15367
+ if (!dl) return;
15368
+ this.dlLog.push(...dl.log);
15369
+ this.closures.next = dl.next;
15370
+ this.closures.handle = dl.handle;
15371
+ this.closures.free.push(...dl.free);
15372
+ for (const index of dl.live) this.closures.live.add(index);
15373
+ }
15358
15374
  allocateClosure(floor) {
15359
15375
  const index = this.closures.free.pop() ?? Math.max(floor, this.closures.next);
15360
15376
  this.closures.next = Math.max(this.closures.next, index + 1);
@@ -15664,6 +15680,7 @@ function processOptions(opts, header3, hooks, created3) {
15664
15680
  ...opts.settling ? { settling: opts.settling } : {},
15665
15681
  spawner: opts.spawner,
15666
15682
  forker: opts.forker,
15683
+ ...opts.fork?.dl ? { dl: opts.fork.dl } : {},
15667
15684
  fs: opts.fs,
15668
15685
  kill: opts.kill,
15669
15686
  ...opts.writesBack ? { writesBack: opts.writesBack } : {},
@@ -17075,6 +17092,12 @@ function withOwner(base, owner) {
17075
17092
  function fsError2(code, message3 = code) {
17076
17093
  return Object.assign(new Error(message3), { code });
17077
17094
  }
17095
+ var SET_ATTRS = ["mode", "mtime", "atime", "size", "uid", "gid"];
17096
+ function setAttrOf(req) {
17097
+ const attr2 = {};
17098
+ for (const key of SET_ATTRS) if (req[key] !== void 0) attr2[key] = req[key];
17099
+ return attr2;
17100
+ }
17078
17101
  async function dispatch(h, req) {
17079
17102
  switch (req.op) {
17080
17103
  case "getattr":
@@ -17119,13 +17142,7 @@ async function dispatch(h, req) {
17119
17142
  if (!h.readlink) throw fsError2("EINVAL", `${req.path} is not a symlink`);
17120
17143
  return h.readlink(req.path);
17121
17144
  case "setattr":
17122
- return h.setattr?.(req.path, {
17123
- ...req.mode !== void 0 ? { mode: req.mode } : {},
17124
- ...req.mtime !== void 0 ? { mtime: req.mtime } : {},
17125
- ...req.size !== void 0 ? { size: req.size } : {},
17126
- ...req.uid !== void 0 ? { uid: req.uid } : {},
17127
- ...req.gid !== void 0 ? { gid: req.gid } : {}
17128
- });
17145
+ return h.setattr?.(req.path, setAttrOf(req));
17129
17146
  case "statfs":
17130
17147
  return h.statfs?.() ?? null;
17131
17148
  default:
@@ -18234,11 +18251,13 @@ function idOption2(value) {
18234
18251
  return value !== void 0 && /^\d+$/.test(value) ? Number(value) : 0;
18235
18252
  }
18236
18253
  function created2(ino, kind, mode, from, owner) {
18254
+ const now = Date.now();
18237
18255
  return {
18238
18256
  kind,
18239
18257
  ino,
18240
18258
  mode: owner?.mode === void 0 ? mode : mode & ~4095 | owner.mode & 4095,
18241
- mtime: Date.now(),
18259
+ mtime: now,
18260
+ atime: now,
18242
18261
  data: new ChunkedBytes(),
18243
18262
  target: "",
18244
18263
  children: /* @__PURE__ */ new Map(),
@@ -18256,6 +18275,7 @@ function attr(node) {
18256
18275
  kind: node.kind,
18257
18276
  size: node.kind === "file" ? node.data.size : node.kind === "symlink" ? node.target.length : 4096,
18258
18277
  mtime: node.mtime,
18278
+ atime: node.atime,
18259
18279
  mode: node.mode,
18260
18280
  ino: node.ino,
18261
18281
  ...node.kind === "directory" ? {} : { nlink: node.links },
@@ -18418,6 +18438,7 @@ function tmpfs() {
18418
18438
  node.mtime = Date.now();
18419
18439
  }
18420
18440
  if (change.mtime !== void 0) node.mtime = change.mtime;
18441
+ if (change.atime !== void 0) node.atime = change.atime;
18421
18442
  owned3(node, change);
18422
18443
  },
18423
18444
  async statfs() {
@@ -19570,8 +19591,17 @@ var Launcher = class {
19570
19591
  }
19571
19592
  if (interpreter(head) !== "node") return void 0;
19572
19593
  const wasm = modulePath(glue);
19573
- if (!await this.base.exists(wasm)) return void 0;
19574
- return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19594
+ if (await this.base.exists(wasm)) {
19595
+ return { abi: "emscripten", glue, wasm, argv0: baseName(argv0 || file), ...asked };
19596
+ }
19597
+ const owner = await this.glueOwner(glue, baseName(file), scope);
19598
+ return owner && { ...targetOf(owner), ...asked };
19599
+ }
19600
+ async glueOwner(glue, name2, scope) {
19601
+ const owners = [...(await this.commands(scope)).values()].filter(
19602
+ (c) => c.abi === "emscripten" && !c.script && c.glue === glue
19603
+ );
19604
+ return owners.find((c) => c.name === name2) ?? owners[0];
19575
19605
  }
19576
19606
  async head(path) {
19577
19607
  try {