@ai-ecoverse/slicc-kernel 1.152.0 → 1.152.2

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.
@@ -2964,7 +2964,7 @@ var KERNEL_VERSION, OS_RELEASE;
2964
2964
  var init_version = __esm({
2965
2965
  "src/version.ts"() {
2966
2966
  "use strict";
2967
- KERNEL_VERSION = true ? "1.152.0" : "0.0.0-dev";
2967
+ KERNEL_VERSION = true ? "1.152.2" : "0.0.0-dev";
2968
2968
  OS_RELEASE = "6.0.0-slicc";
2969
2969
  }
2970
2970
  });
@@ -6114,6 +6114,8 @@ var init_procfs = __esm({
6114
6114
  slicc_rename_ack_busy: (listing2) => `${listing2.renameAcks?.busy ?? 0}
6115
6115
  `,
6116
6116
  slicc_stale_fds: (listing2) => `${listing2.staleFds ?? 0}
6117
+ `,
6118
+ slicc_file_ids: (listing2) => `${listing2.fileIds ?? 0}
6117
6119
  `,
6118
6120
  slicc_rename_acks: (listing2) => {
6119
6121
  const samples = [...listing2.renameAcks?.ackMs ?? []].sort((a, b) => a - b);
@@ -7431,12 +7433,22 @@ var init_wasi_files = __esm({
7431
7433
  }
7432
7434
  return this.data;
7433
7435
  }
7436
+ spoiled = false;
7437
+ spoil() {
7438
+ this.spoiled = true;
7439
+ this.dirty = false;
7440
+ }
7441
+ live() {
7442
+ if (this.spoiled) throw new WasiError("ESTALE");
7443
+ }
7434
7444
  size() {
7445
+ this.live();
7435
7446
  if (this.ranged) return this.ranged.size();
7436
7447
  this.load();
7437
7448
  return this.length;
7438
7449
  }
7439
7450
  pread(max, at) {
7451
+ this.live();
7440
7452
  if (this.ranged) return this.ranged.read(at, max);
7441
7453
  const bytes = this.load();
7442
7454
  const n = Math.max(0, Math.min(max, this.length - at));
@@ -7446,6 +7458,7 @@ var init_wasi_files = __esm({
7446
7458
  if (this.maxFile !== void 0 && end > this.maxFile) throw new WasiError("EFBIG");
7447
7459
  }
7448
7460
  pwrite(bytes, at) {
7461
+ this.live();
7449
7462
  if (bytes.length === 0) return 0;
7450
7463
  const end = at + bytes.length;
7451
7464
  this.fits(end);
@@ -7465,6 +7478,7 @@ var init_wasi_files = __esm({
7465
7478
  return bytes.length;
7466
7479
  }
7467
7480
  append(bytes) {
7481
+ this.live();
7468
7482
  const { append } = this.fs;
7469
7483
  if (!append || this.orphaned) return void 0;
7470
7484
  this.moved?.(false);
@@ -7477,6 +7491,7 @@ var init_wasi_files = __esm({
7477
7491
  return end;
7478
7492
  }
7479
7493
  truncate(size) {
7494
+ this.live();
7480
7495
  this.fits(size);
7481
7496
  this.dirty = true;
7482
7497
  if (this.ranged) {
@@ -7512,6 +7527,7 @@ var init_wasi_files = __esm({
7512
7527
  return this.dirty;
7513
7528
  }
7514
7529
  contents() {
7530
+ this.live();
7515
7531
  if (this.ranged) return this.ranged.read(0, this.ranged.size());
7516
7532
  return this.load().slice(0, this.length);
7517
7533
  }
@@ -9445,6 +9461,15 @@ var init_wasi_fds = __esm({
9445
9461
  }
9446
9462
  }
9447
9463
  }
9464
+ synced(file) {
9465
+ try {
9466
+ file.flush();
9467
+ this.reported.delete(file.buffer);
9468
+ } catch (err) {
9469
+ this.reported.add(file.buffer);
9470
+ throw err;
9471
+ }
9472
+ }
9448
9473
  flushEarly() {
9449
9474
  for (const buffer of this.buffers.values()) {
9450
9475
  try {
@@ -9471,6 +9496,7 @@ var init_wasi_fds = __esm({
9471
9496
  try {
9472
9497
  buffer.prefetch();
9473
9498
  } catch {
9499
+ buffer.spoil();
9474
9500
  }
9475
9501
  }
9476
9502
  }
@@ -11746,7 +11772,7 @@ var init_wasi_host = __esm({
11746
11772
  }
11747
11773
  sync(fd) {
11748
11774
  const e = this.fds.get(fd);
11749
- if (e.type === "file") e.file.flush();
11775
+ if (e.type === "file") this.fds.synced(e.file);
11750
11776
  else if (e.type === "device") this.interrupted?.();
11751
11777
  else if (e.type === "kernel") {
11752
11778
  const kind = this.fds.kind(fd, e);