@ai-ecoverse/slicc-kernel 1.32.0 → 1.32.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.
@@ -1152,6 +1152,10 @@ function nullFile() {
1152
1152
  }
1153
1153
  });
1154
1154
  }
1155
+ function written(device, bytes) {
1156
+ if (device === "full" && bytes.length > 0) throw new KernelError("ENOSPC");
1157
+ return bytes.length;
1158
+ }
1155
1159
  function deviceFile(device, access) {
1156
1160
  const read = async (max) => {
1157
1161
  if (device === "null") return new Uint8Array(0);
@@ -1165,7 +1169,7 @@ function deviceFile(device, access) {
1165
1169
  };
1166
1170
  return new OpenFile({
1167
1171
  ...access !== "write" ? { read } : {},
1168
- ...access !== "read" ? { write: async (bytes) => bytes.length } : {},
1172
+ ...access !== "read" ? { write: async (bytes) => written(device, bytes) } : {},
1169
1173
  seek: async () => 0,
1170
1174
  heldMeta: { device, ...access ? { access } : {} },
1171
1175
  close: () => {
@@ -4979,6 +4983,7 @@ var ChildTable = class {
4979
4983
  openSlot(slot, n, captured) {
4980
4984
  if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
4981
4985
  if ("input" in slot) return bytesSource(slot.input);
4986
+ if ("device" in slot) return deviceFile(slot.device, slot.access);
4982
4987
  if ("capture" in slot) {
4983
4988
  const chunks = [];
4984
4989
  captured.set(n, chunks);
@@ -7210,11 +7215,11 @@ var Pages = class {
7210
7215
  runs.push({ offset: start, bytes });
7211
7216
  i = j;
7212
7217
  }
7213
- const written = Math.max(this.stored, ...runs.map((r) => r.offset + r.bytes.length));
7218
+ const written2 = Math.max(this.stored, ...runs.map((r) => r.offset + r.bytes.length));
7214
7219
  return {
7215
7220
  ...this.shrink !== void 0 ? { shrink: this.shrink } : {},
7216
7221
  runs,
7217
- ...this.length > written ? { extend: this.length } : {}
7222
+ ...this.length > written2 ? { extend: this.length } : {}
7218
7223
  };
7219
7224
  }
7220
7225
  flushed() {