@ai-ecoverse/slicc-kernel 1.108.0 → 1.108.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.
package/dist/node.js CHANGED
@@ -6435,7 +6435,7 @@ function satisfies(version, range2) {
6435
6435
  }
6436
6436
 
6437
6437
  // src/version.ts
6438
- var KERNEL_VERSION = true ? "1.108.0" : "0.0.0-dev";
6438
+ var KERNEL_VERSION = true ? "1.108.1" : "0.0.0-dev";
6439
6439
  var OS_RELEASE = "6.0.0-slicc";
6440
6440
  function procVersion() {
6441
6441
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -2491,7 +2491,7 @@ var KERNEL_VERSION, OS_RELEASE;
2491
2491
  var init_version = __esm({
2492
2492
  "src/version.ts"() {
2493
2493
  "use strict";
2494
- KERNEL_VERSION = true ? "1.108.0" : "0.0.0-dev";
2494
+ KERNEL_VERSION = true ? "1.108.1" : "0.0.0-dev";
2495
2495
  OS_RELEASE = "6.0.0-slicc";
2496
2496
  }
2497
2497
  });
@@ -7608,7 +7608,7 @@ var init_wasi_fds = __esm({
7608
7608
  const flags = want === 6 ? O_RDWR4 : want === 2 ? O_WRONLY4 : 0;
7609
7609
  return openDevice2.call(this.kernel.sys, flags);
7610
7610
  }
7611
- open(path, oflags, rights, fdflags) {
7611
+ open(path, oflags, rights, fdflags, mode) {
7612
7612
  const device2 = deviceOf(path);
7613
7613
  if (device2) return this.install({ type: "device", device: device2 });
7614
7614
  const kernelDevice = this.openKernelDevice(path, oflags, fdflags, rights);
@@ -7629,13 +7629,16 @@ var init_wasi_fds = __esm({
7629
7629
  }
7630
7630
  if (!s && !(oflags & OFLAGS.CREAT)) throw new WasiError("ENOENT");
7631
7631
  refuseWrite(s, oflags, rights);
7632
- return this.regular(path, s, oflags, rights, fdflags);
7632
+ return this.regular(path, s, oflags, rights, fdflags, mode);
7633
7633
  }
7634
- regular(path, s, oflags, rights, fdflags) {
7634
+ regular(path, s, oflags, rights, fdflags, mode) {
7635
7635
  if (this.shared || this.kernelHolds(path, s)) {
7636
- return this.kernelFile(path, s, oflags, rights, fdflags);
7636
+ return this.kernelFile(path, s, oflags, rights, fdflags, mode);
7637
7637
  }
7638
- return this.install({ type: "file", file: this.file(path, s, oflags, rights, fdflags) });
7638
+ return this.install({
7639
+ type: "file",
7640
+ file: this.file(path, s, oflags, rights, fdflags, mode)
7641
+ });
7639
7642
  }
7640
7643
  kernelHolds(path, st) {
7641
7644
  for (const [fd, e] of this.table) {
@@ -7657,7 +7660,7 @@ var init_wasi_fds = __esm({
7657
7660
  } catch {
7658
7661
  }
7659
7662
  }
7660
- file(path, existing, oflags, rights, fdflags) {
7663
+ file(path, existing, oflags, rights, fdflags, mode) {
7661
7664
  const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
7662
7665
  let buffer = this.buffers.get(path);
7663
7666
  if (buffer?.handle !== void 0 && this.fs.kept?.(buffer.handle)) {
@@ -7670,13 +7673,13 @@ var init_wasi_fds = __esm({
7670
7673
  if (this.fs.owners) this.fs.access?.(path, want, "open");
7671
7674
  if (oflags & OFLAGS.TRUNC) buffer.truncate(0);
7672
7675
  } else {
7673
- buffer = this.freshBuffer(path, existing, oflags, want);
7676
+ buffer = this.freshBuffer(path, existing, oflags, want, mode);
7674
7677
  }
7675
7678
  buffer.opens++;
7676
7679
  return new LocalFile(buffer, readable3, writable2, (fdflags & FDFLAGS.APPEND) !== 0);
7677
7680
  }
7678
- freshBuffer(path, existing, oflags, want) {
7679
- const made = !existing && this.createNew(path, oflags);
7681
+ freshBuffer(path, existing, oflags, want, mode) {
7682
+ const made = !existing && this.createNew(path, oflags, mode);
7680
7683
  const empty = made || (oflags & OFLAGS.TRUNC) !== 0;
7681
7684
  if (existing?.ranged) this.fs.invalidate?.();
7682
7685
  const seen = this.fs.changes?.now();
@@ -7706,11 +7709,11 @@ var init_wasi_fds = __esm({
7706
7709
  if (id !== void 0) this.know(buffer, id);
7707
7710
  return buffer;
7708
7711
  }
7709
- kernelFile(path, existing, oflags, rights, fdflags) {
7712
+ kernelFile(path, existing, oflags, rights, fdflags, mode) {
7710
7713
  const { readable: readable3, writable: writable2 } = openAccess(existing, oflags, rights);
7711
7714
  const append = (fdflags & FDFLAGS.APPEND) !== 0;
7712
7715
  const flags = (writable2 ? readable3 ? O_RDWR4 : O_WRONLY4 : 0) | (append ? O_APPEND2 : 0);
7713
- const made = !existing && this.createNew(path, oflags);
7716
+ const made = !existing && this.createNew(path, oflags, mode);
7714
7717
  const truncate = made || (oflags & OFLAGS.TRUNC) !== 0;
7715
7718
  const fd = this.kernel.sys.openVfs(path, flags, 0, {
7716
7719
  ...truncate ? { truncate } : {},
@@ -7723,13 +7726,13 @@ var init_wasi_fds = __esm({
7723
7726
  this.bump();
7724
7727
  return fd;
7725
7728
  }
7726
- createNew(path, oflags) {
7729
+ createNew(path, oflags, mode) {
7727
7730
  if (!this.fs.create) {
7728
7731
  this.fs.writeFile(path, new Uint8Array(0));
7729
7732
  return true;
7730
7733
  }
7731
7734
  try {
7732
- this.fs.create(path, void 0, true);
7735
+ this.fs.create(path, mode, true);
7733
7736
  return true;
7734
7737
  } catch (err) {
7735
7738
  if (oflags & OFLAGS.EXCL || err.code !== "EEXIST") throw err;
@@ -10037,13 +10040,15 @@ function importsContext({
10037
10040
  const fds = {
10038
10041
  open(path, o = {}) {
10039
10042
  const abs = host.fds.resolve(3, path);
10040
- if (o.nofollow && fs.exists(abs) && fs.lstat(abs).isSymbolicLink)
10043
+ const fresh = o.create === true && o.exclusive === true && owners && fs.create !== void 0;
10044
+ if (!fresh && o.nofollow && fs.exists(abs) && fs.lstat(abs).isSymbolicLink)
10041
10045
  throw new WasiError("ELOOP");
10042
- const existed = fs.exists(abs);
10046
+ const existed = !fresh && fs.exists(abs);
10043
10047
  const oflags = (o.create ? OFLAGS.CREAT : 0) | (o.exclusive ? OFLAGS.EXCL : 0) | (o.truncate ? OFLAGS.TRUNC : 0) | (o.directory ? OFLAGS.DIRECTORY : 0);
10044
10048
  const rights = (o.write ? RIGHTS.FD_WRITE : 0n) | (o.read || !o.write ? RIGHTS.FD_READ : 0n);
10045
- const fd = host.fds.open(abs, oflags, rights, o.append ? FDFLAGS.APPEND : 0);
10046
- if (o.mode !== void 0 && !existed) fs.chmod(abs, o.mode);
10049
+ const flags = o.append ? FDFLAGS.APPEND : 0;
10050
+ const fd = host.fds.open(abs, oflags, rights, flags, fresh ? o.mode : void 0);
10051
+ if (o.mode !== void 0 && !existed && !fresh) fs.chmod(abs, o.mode);
10047
10052
  return fd;
10048
10053
  },
10049
10054
  close(fd) {