@ai-ecoverse/slicc-kernel 1.32.0 → 1.32.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.
package/README.md CHANGED
@@ -410,7 +410,7 @@ OPFS stores names, bytes, sizes and modification times, nothing else. Everything
410
410
  - mode bits (`chmod`);
411
411
  - access and change times, and a modification time set explicitly with `utime` (it holds until the file is written again);
412
412
  - inode numbers that stay stable across renames;
413
- - symbolic links (`symlink`, `readlink`, `lstat`, and following them in paths), which exist only in the sidecar, with their own times: `touch -h`, `lutimes` and `utimensat` with `AT_SYMLINK_NOFOLLOW` set the link's, never the target's.
413
+ - symbolic links (`symlink`, `readlink`, `lstat`, and following them in paths), which exist only in the sidecar, with their own times: `touch -h`, `lutimes` and `utimensat` with `AT_SYMLINK_NOFOLLOW` set the link's, never the target's. A link's own mode can't be changed, as on Linux: `chmod -h`, `lchmod` and `fchmodat` with `AT_SYMLINK_NOFOLLOW` fail with `EOPNOTSUPP` (which `chmod -h` and `tar` ignore for links) and never follow it, and `open` with `O_PATH | O_NOFOLLOW` gives a descriptor for the link itself.
414
414
 
415
415
  OPFS stays authoritative: an entry is consulted only for a path that exists in OPFS (symlinks only for paths that don't), so files written straight to OPFS, for example by the BIOS installer or a page, get the defaults: directories `0755`, files `0644`, and files under `node_modules/*/bin/` `0755`. A file deleted through the OPFS API disappears at once; its leftover entry is ignored and removed when the next kernel starts. Changes go to OPFS first and then to the sidecar, so a crash in between at worst loses the metadata of that one change. Each change is a read-modify-write inside one IndexedDB transaction, so two kernels (two tabs) on the same origin don't lose each other's updates.
416
416
 
@@ -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() {