@ai-ecoverse/slicc-kernel 1.119.2 → 1.120.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.
@@ -702,7 +702,11 @@ var init_ranged = __esm({
702
702
  if (!watch || this.pinned) return;
703
703
  const { now, changed: changed2 } = watchedChange(watch, this.seen, this.path);
704
704
  this.seen = now;
705
- if (!changed2) return;
705
+ if (changed2) this.reread();
706
+ }
707
+ reread() {
708
+ const watch = this.watch;
709
+ if (!watch || this.pinned || this.pages.changed) return;
706
710
  let st;
707
711
  try {
708
712
  st = watch.stat(this.path);
@@ -2542,7 +2546,7 @@ var KERNEL_VERSION, OS_RELEASE;
2542
2546
  var init_version = __esm({
2543
2547
  "src/version.ts"() {
2544
2548
  "use strict";
2545
- KERNEL_VERSION = true ? "1.119.2" : "0.0.0-dev";
2549
+ KERNEL_VERSION = true ? "1.120.1" : "0.0.0-dev";
2546
2550
  OS_RELEASE = "6.0.0-slicc";
2547
2551
  }
2548
2552
  });
@@ -6521,6 +6525,9 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6521
6525
  ...bridge.create ? {
6522
6526
  create: (p, mode, opening2) => mutating(() => bridge.create?.(p, mode, opening2), ...entry(p))
6523
6527
  } : {},
6528
+ ...bridge.mkfifo ? {
6529
+ mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
6530
+ } : {},
6524
6531
  ...chown ? {
6525
6532
  chown: (p, ...rest2) => rewriting(p, () => chown.call(bridge, p, ...rest2))
6526
6533
  } : {},
@@ -6698,6 +6705,11 @@ var init_wasi_files = __esm({
6698
6705
  this.orphaned = true;
6699
6706
  this.ranged?.pin();
6700
6707
  }
6708
+ reread() {
6709
+ if (this.dirty || this.orphaned) return;
6710
+ if (this.ranged) this.ranged.reread();
6711
+ else this.data = void 0;
6712
+ }
6701
6713
  isOrphan() {
6702
6714
  return this.orphaned;
6703
6715
  }
@@ -6940,7 +6952,8 @@ function lockImports(host) {
6940
6952
  host.promote(fd);
6941
6953
  const kind = FLOCK_OPS[op & ~LOCK_NB];
6942
6954
  if (!kind) throw new WasiError("EINVAL");
6943
- host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
6955
+ const shared = host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
6956
+ if (kind !== "unlock" && shared === true) host.reread(fd);
6944
6957
  },
6945
6958
  fcntl_lock: (fd, cmd, at) => {
6946
6959
  if (cmd !== F_GETLK2 && cmd !== F_SETLK2 && cmd !== F_SETLKW2) throw new WasiError("EINVAL");
@@ -6958,8 +6971,10 @@ function lockImports(host) {
6958
6971
  if (kind === "read" && file.readable === false || kind === "write" && file.writable === false)
6959
6972
  throw new WasiError("EBADF");
6960
6973
  if (kind !== "write") host.flush(file);
6961
- host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW2);
6962
- if (kind !== "unlock") host.locked();
6974
+ const shared = host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW2);
6975
+ if (kind === "unlock") return;
6976
+ host.locked();
6977
+ if (shared === true) host.reread(fd);
6963
6978
  }
6964
6979
  };
6965
6980
  }
@@ -7661,6 +7676,10 @@ var init_wasi_fds = __esm({
7661
7676
  }
7662
7677
  }
7663
7678
  }
7679
+ reread(fd) {
7680
+ const e = this.get(fd);
7681
+ if (e.type === "file") e.file.buffer.reread();
7682
+ }
7664
7683
  flushPath(path) {
7665
7684
  for (const [p, buffer] of this.buffers) if (within(p, path)) buffer.flush();
7666
7685
  if (this.shared && !this.fs.changes?.clean()) this.kernel.call({ op: "fd-path-flush", path });
@@ -8894,7 +8913,7 @@ function wrap(table) {
8894
8913
  }
8895
8914
  return out;
8896
8915
  }
8897
- var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO2, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
8916
+ var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW2, AT_FDCWD2, AT_EACCESS2, ROOT_IDS, GONE, S_IFIFO2, S_IFLNK2, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
8898
8917
  var init_wasi_host = __esm({
8899
8918
  "src/process/wasi/wasi-host.ts"() {
8900
8919
  "use strict";
@@ -8925,6 +8944,7 @@ var init_wasi_host = __esm({
8925
8944
  IDS = ["ruid", "euid", "suid", "rgid", "egid", "sgid"];
8926
8945
  NS_PER_MS4 = 1000000n;
8927
8946
  AT_SYMLINK_NOFOLLOW2 = 1;
8947
+ AT_FDCWD2 = -2;
8928
8948
  AT_EACCESS2 = 2;
8929
8949
  ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
8930
8950
  GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
@@ -9107,6 +9127,18 @@ var init_wasi_host = __esm({
9107
9127
  },
9108
9128
  fd_chmod: (fd, mode) => void this.o.fs.chmod(pathOf(fd), mode & 4095),
9109
9129
  path_chmod: (dirfd, p, l, mode, flags) => void this.o.fs.chmod(target(at(dirfd, p, l), flags), mode & 4095),
9130
+ path_mkfifo: (dirfd, p, l, mode) => {
9131
+ const { mkfifo } = this.o.fs;
9132
+ if (!mkfifo) return E.NOSYS;
9133
+ const raw = mem.string(p, l);
9134
+ const path = dirfd === AT_FDCWD2 && !raw.startsWith("/") ? fds.resolve(3, `${this.cwd}/${raw}`) : at(dirfd, p, l);
9135
+ const umask = this.o.kernel.call({ op: "proc-umask" });
9136
+ const want = mode & 4095 & ~umask;
9137
+ mkfifo.call(this.o.fs, path, want);
9138
+ const made = (this.o.fs.lstat(path).mode ?? 0) & 4095;
9139
+ if ((made & ~want) !== 0) this.o.fs.chmod(path, made & want);
9140
+ return E.SUCCESS;
9141
+ },
9110
9142
  umask: (mask, out) => {
9111
9143
  const old = this.o.kernel.call({ op: "proc-umask", mask });
9112
9144
  mem.view().setUint32(out, old, true);
@@ -9130,6 +9162,35 @@ var init_wasi_host = __esm({
9130
9162
  }
9131
9163
  });
9132
9164
  }
9165
+ lockHost(mem) {
9166
+ return {
9167
+ mem,
9168
+ file: (fd) => this.lockedFile(fd),
9169
+ flush: (file) => {
9170
+ if (file.path !== void 0) this.fds.flushPath(file.path);
9171
+ else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
9172
+ },
9173
+ locked: () => this.fds.holdLocks(),
9174
+ promote: (fd, moved) => this.fds.promote(fd, moved),
9175
+ reread: (fd) => this.fds.reread(fd),
9176
+ calls: {
9177
+ flock: (fd, kind, wait2) => this.fds.restarting(
9178
+ () => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
9179
+ ),
9180
+ set: (target, kind, start2, len, wait2) => this.fds.restarting(
9181
+ () => this.o.kernel.call({
9182
+ op: "lk-set",
9183
+ ...target,
9184
+ kind,
9185
+ start: start2,
9186
+ len,
9187
+ ...wait2 ? { wait: wait2 } : {}
9188
+ })
9189
+ ),
9190
+ get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
9191
+ }
9192
+ };
9193
+ }
9133
9194
  sliccImports() {
9134
9195
  const { mem } = this;
9135
9196
  const path = (p, l) => {
@@ -9160,32 +9221,7 @@ var init_wasi_host = __esm({
9160
9221
  void this.creds.change(() => this.o.kernel.call({ op: "proc-setcred", change }));
9161
9222
  },
9162
9223
  ...semImports(this),
9163
- ...lockImports({
9164
- mem,
9165
- file: (fd) => this.lockedFile(fd),
9166
- flush: (file) => {
9167
- if (file.path !== void 0) this.fds.flushPath(file.path);
9168
- else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
9169
- },
9170
- locked: () => this.fds.holdLocks(),
9171
- promote: (fd, moved) => this.fds.promote(fd, moved),
9172
- calls: {
9173
- flock: (fd, kind, wait2) => void this.fds.restarting(
9174
- () => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
9175
- ),
9176
- set: (target, kind, start2, len, wait2) => void this.fds.restarting(
9177
- () => this.o.kernel.call({
9178
- op: "lk-set",
9179
- ...target,
9180
- kind,
9181
- start: start2,
9182
- len,
9183
- ...wait2 ? { wait: wait2 } : {}
9184
- })
9185
- ),
9186
- get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
9187
- }
9188
- }),
9224
+ ...lockImports(this.lockHost(mem)),
9189
9225
  groups_get: (buf, cap, count) => {
9190
9226
  const { groups } = this.creds.get();
9191
9227
  if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");
@@ -10955,7 +10991,7 @@ var init_wasi_procfs = __esm({
10955
10991
  }
10956
10992
  };
10957
10993
  FOLLOWING = ["writeFile", "chmod", "utimes", "pwrite", "truncate"];
10958
- NOT_FOLLOWING = ["mkdir", "rm", "unlink", "rmdir", "lutimes", "create"];
10994
+ NOT_FOLLOWING = ["mkdir", "rm", "unlink", "rmdir", "lutimes", "create", "mkfifo"];
10959
10995
  MAX_HOPS2 = 40;
10960
10996
  }
10961
10997
  });