@ai-ecoverse/slicc-kernel 1.120.0 → 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.120.0" : "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
  });
@@ -6701,6 +6705,11 @@ var init_wasi_files = __esm({
6701
6705
  this.orphaned = true;
6702
6706
  this.ranged?.pin();
6703
6707
  }
6708
+ reread() {
6709
+ if (this.dirty || this.orphaned) return;
6710
+ if (this.ranged) this.ranged.reread();
6711
+ else this.data = void 0;
6712
+ }
6704
6713
  isOrphan() {
6705
6714
  return this.orphaned;
6706
6715
  }
@@ -6943,7 +6952,8 @@ function lockImports(host) {
6943
6952
  host.promote(fd);
6944
6953
  const kind = FLOCK_OPS[op & ~LOCK_NB];
6945
6954
  if (!kind) throw new WasiError("EINVAL");
6946
- 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);
6947
6957
  },
6948
6958
  fcntl_lock: (fd, cmd, at) => {
6949
6959
  if (cmd !== F_GETLK2 && cmd !== F_SETLK2 && cmd !== F_SETLKW2) throw new WasiError("EINVAL");
@@ -6961,8 +6971,10 @@ function lockImports(host) {
6961
6971
  if (kind === "read" && file.readable === false || kind === "write" && file.writable === false)
6962
6972
  throw new WasiError("EBADF");
6963
6973
  if (kind !== "write") host.flush(file);
6964
- host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW2);
6965
- 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);
6966
6978
  }
6967
6979
  };
6968
6980
  }
@@ -7664,6 +7676,10 @@ var init_wasi_fds = __esm({
7664
7676
  }
7665
7677
  }
7666
7678
  }
7679
+ reread(fd) {
7680
+ const e = this.get(fd);
7681
+ if (e.type === "file") e.file.buffer.reread();
7682
+ }
7667
7683
  flushPath(path) {
7668
7684
  for (const [p, buffer] of this.buffers) if (within(p, path)) buffer.flush();
7669
7685
  if (this.shared && !this.fs.changes?.clean()) this.kernel.call({ op: "fd-path-flush", path });
@@ -9146,6 +9162,35 @@ var init_wasi_host = __esm({
9146
9162
  }
9147
9163
  });
9148
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
+ }
9149
9194
  sliccImports() {
9150
9195
  const { mem } = this;
9151
9196
  const path = (p, l) => {
@@ -9176,32 +9221,7 @@ var init_wasi_host = __esm({
9176
9221
  void this.creds.change(() => this.o.kernel.call({ op: "proc-setcred", change }));
9177
9222
  },
9178
9223
  ...semImports(this),
9179
- ...lockImports({
9180
- mem,
9181
- file: (fd) => this.lockedFile(fd),
9182
- flush: (file) => {
9183
- if (file.path !== void 0) this.fds.flushPath(file.path);
9184
- else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
9185
- },
9186
- locked: () => this.fds.holdLocks(),
9187
- promote: (fd, moved) => this.fds.promote(fd, moved),
9188
- calls: {
9189
- flock: (fd, kind, wait2) => void this.fds.restarting(
9190
- () => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
9191
- ),
9192
- set: (target, kind, start2, len, wait2) => void this.fds.restarting(
9193
- () => this.o.kernel.call({
9194
- op: "lk-set",
9195
- ...target,
9196
- kind,
9197
- start: start2,
9198
- len,
9199
- ...wait2 ? { wait: wait2 } : {}
9200
- })
9201
- ),
9202
- get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
9203
- }
9204
- }),
9224
+ ...lockImports(this.lockHost(mem)),
9205
9225
  groups_get: (buf, cap, count) => {
9206
9226
  const { groups } = this.creds.get();
9207
9227
  if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");