@ai-ecoverse/slicc-kernel 1.133.0 → 1.133.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.
@@ -2914,6 +2914,10 @@ function stdioAlias(path) {
2914
2914
  function deviceOf(path) {
2915
2915
  return deviceAt(path);
2916
2916
  }
2917
+ function namedDevice(path) {
2918
+ if (deviceOf(path) || stdioAlias(path) !== void 0) return true;
2919
+ return path === SEALED_PATH || path === CLIPBOARD_PATH || path === "/dev/tty";
2920
+ }
2917
2921
  function within(path, root) {
2918
2922
  return path === root || path.startsWith(root === "/" ? "/" : `${root}/`);
2919
2923
  }
@@ -3570,8 +3574,19 @@ var init_wasi_fds = __esm({
3570
3574
  fd = this.openCharDevice(openClipboard, oflags, rights);
3571
3575
  kind = "clipboard";
3572
3576
  } else if (path === "/dev/tty" || /^\/dev\/tty\d+$/.test(path)) {
3573
- fd = openTty?.call(this.kernel.sys, path === "/dev/tty" ? void 0 : path);
3577
+ const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
3578
+ try {
3579
+ fd = openTty?.call(this.kernel.sys, path === "/dev/tty" ? void 0 : path);
3580
+ } catch (err) {
3581
+ if (exclusive && err.code === "EACCES")
3582
+ throw new WasiError("EEXIST");
3583
+ throw err;
3584
+ }
3574
3585
  if (fd === void 0) throw new WasiError("ENXIO");
3586
+ if (exclusive) {
3587
+ this.kernel.sys.close(fd);
3588
+ throw new WasiError("EEXIST");
3589
+ }
3575
3590
  kind = "tty";
3576
3591
  } else return void 0;
3577
3592
  this.adopt(fd, kind, nonblock);
@@ -3587,13 +3602,14 @@ var init_wasi_fds = __esm({
3587
3602
  open(path, oflags, rights, fdflags, mode) {
3588
3603
  this.made = void 0;
3589
3604
  this.created = false;
3605
+ const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
3606
+ if (exclusive && namedDevice(path)) throw new WasiError("EEXIST");
3590
3607
  const device2 = deviceOf(path);
3591
3608
  if (device2) return this.install({ type: "device", device: device2 });
3592
3609
  const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
3593
3610
  if (kernelDevice !== void 0) return kernelDevice;
3594
3611
  const alias = stdioAlias(path);
3595
3612
  if (alias !== void 0) return this.reopen(alias);
3596
- const exclusive = (oflags & OFLAGS.CREAT) !== 0 && (oflags & OFLAGS.EXCL) !== 0;
3597
3613
  if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
3598
3614
  return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
3599
3615
  }
@@ -6504,7 +6520,7 @@ var KERNEL_VERSION, OS_RELEASE;
6504
6520
  var init_version = __esm({
6505
6521
  "src/version.ts"() {
6506
6522
  "use strict";
6507
- KERNEL_VERSION = true ? "1.133.0" : "0.0.0-dev";
6523
+ KERNEL_VERSION = true ? "1.133.2" : "0.0.0-dev";
6508
6524
  OS_RELEASE = "6.0.0-slicc";
6509
6525
  }
6510
6526
  });