@ai-ecoverse/slicc-kernel 1.110.5 → 1.110.6

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.
@@ -5212,7 +5212,7 @@ var KERNEL_VERSION, OS_RELEASE;
5212
5212
  var init_version = __esm({
5213
5213
  "src/version.ts"() {
5214
5214
  "use strict";
5215
- KERNEL_VERSION = true ? "1.110.5" : "0.0.0-dev";
5215
+ KERNEL_VERSION = true ? "1.110.6" : "0.0.0-dev";
5216
5216
  OS_RELEASE = "6.0.0-slicc";
5217
5217
  }
5218
5218
  });
@@ -9025,6 +9025,7 @@ function useMounts(Fs, env = {}, live = false) {
9025
9025
  if (typeof Fs.open !== "function" || typeof writeFile !== "function") return;
9026
9026
  const { passwd, group } = accounts(env);
9027
9027
  const backing = { "/etc/mtab": "/proc/mounts" };
9028
+ const defaults = {};
9028
9029
  try {
9029
9030
  if (!live) writeFile.call(Fs, "/proc/mounts", mountTable());
9030
9031
  } catch {
@@ -9032,20 +9033,39 @@ function useMounts(Fs, env = {}, live = false) {
9032
9033
  }
9033
9034
  try {
9034
9035
  mkdirTree.call(Fs, "/dev/.etc");
9035
- writeFile.call(Fs, "/dev/.etc/passwd", passwd);
9036
- writeFile.call(Fs, "/dev/.etc/group", group);
9037
- writeFile.call(Fs, "/dev/.etc/hosts", hostsFile(hostnameOf(env)));
9038
- writeFile.call(Fs, "/dev/.etc/hostname", `${hostnameOf(env)}
9039
- `);
9040
- backing["/etc/passwd"] = "/dev/.etc/passwd";
9041
- backing["/etc/group"] = "/dev/.etc/group";
9042
- backing["/etc/hosts"] = "/dev/.etc/hosts";
9043
- backing["/etc/hostname"] = "/dev/.etc/hostname";
9036
+ const files = {
9037
+ passwd,
9038
+ group,
9039
+ hosts: hostsFile(hostnameOf(env)),
9040
+ hostname: `${hostnameOf(env)}
9041
+ `
9042
+ };
9043
+ for (const [name2, text] of Object.entries(files)) {
9044
+ writeFile.call(Fs, `/dev/.etc/${name2}`, text);
9045
+ backing[`/etc/${name2}`] = `/dev/.etc/${name2}`;
9046
+ defaults[`/etc/${name2}`] = text;
9047
+ }
9044
9048
  } catch {
9045
9049
  }
9046
9050
  const open = Fs.open.bind(Fs);
9051
+ const seed = (path, text) => {
9052
+ let stream;
9053
+ try {
9054
+ stream = open(path, O_WRONLY5 | O_CREAT | O_EXCL, 420);
9055
+ } catch {
9056
+ return;
9057
+ }
9058
+ try {
9059
+ const bytes = new TextEncoder().encode(text);
9060
+ Fs.write(stream, bytes, 0, bytes.length);
9061
+ } finally {
9062
+ Fs.closeStream(stream.fd);
9063
+ }
9064
+ };
9047
9065
  Fs.open = (path, flags, mode) => {
9048
9066
  const instead = backing[path];
9067
+ const text = defaults[path];
9068
+ if (text !== void 0 && (flags & (O_ACCMODE3 | O_CREAT)) !== 0) seed(path, text);
9049
9069
  if (!instead || (flags & (O_ACCMODE3 | O_CREAT)) !== 0) return open(path, flags, mode);
9050
9070
  try {
9051
9071
  return open(path, flags, mode);
@@ -9227,7 +9247,7 @@ function linuxDevices(Fs) {
9227
9247
  }
9228
9248
  }
9229
9249
  }
9230
- var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
9250
+ var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS2, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
9231
9251
  var init_process_fds = __esm({
9232
9252
  "src/process/process-fds.ts"() {
9233
9253
  "use strict";
@@ -9287,6 +9307,7 @@ var init_process_fds = __esm({
9287
9307
  CHAR_DEVICE = 8630;
9288
9308
  O_ACCMODE3 = 3;
9289
9309
  O_CREAT = 64;
9310
+ O_EXCL = 128;
9290
9311
  field = (text) => (text || "none").replace(/[\s\\]/g, (c) => `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}`);
9291
9312
  rootKind = () => globalThis.navigator?.storage ? "opfs" : "memory";
9292
9313
  NAME = /^[a-z_][a-z0-9_-]*$/i;
@@ -11731,7 +11752,7 @@ function datesOf(real) {
11731
11752
  dates[key] = new Date(value2);
11732
11753
  return dates;
11733
11754
  }
11734
- var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK2, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH2, STRERROR, CLIPBOARD_PATH2, O_CREAT2, O_EXCL, O_NOCTTY, O_TRUNC2, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
11755
+ var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK2, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH2, STRERROR, CLIPBOARD_PATH2, O_CREAT2, O_EXCL2, O_NOCTTY, O_TRUNC2, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
11735
11756
  var init_kernel_streams = __esm({
11736
11757
  "src/process/kernel-streams.ts"() {
11737
11758
  "use strict";
@@ -11761,7 +11782,7 @@ var init_kernel_streams = __esm({
11761
11782
  };
11762
11783
  CLIPBOARD_PATH2 = "/dev/clipboard";
11763
11784
  O_CREAT2 = 64;
11764
- O_EXCL = 128;
11785
+ O_EXCL2 = 128;
11765
11786
  O_NOCTTY = 256;
11766
11787
  O_TRUNC2 = 512;
11767
11788
  O_DIRECTORY = 65536;
@@ -12062,13 +12083,13 @@ var init_kernel_streams = __esm({
12062
12083
  try {
12063
12084
  return open(path, flags, mode);
12064
12085
  } catch (err) {
12065
- const lost = err.errno === wasiErrno("EEXIST") && !(flags & O_EXCL);
12086
+ const lost = err.errno === wasiErrno("EEXIST") && !(flags & O_EXCL2);
12066
12087
  if (!lost) throw err;
12067
12088
  return open(path, flags, mode);
12068
12089
  }
12069
12090
  }
12070
12091
  refuseExclusiveLink(path, flags) {
12071
- if ((flags & (O_CREAT2 | O_EXCL)) !== (O_CREAT2 | O_EXCL)) return;
12092
+ if ((flags & (O_CREAT2 | O_EXCL2)) !== (O_CREAT2 | O_EXCL2)) return;
12072
12093
  let mode = 0;
12073
12094
  try {
12074
12095
  mode = this.Fs.stat?.(path, true)?.mode ?? 0;
@@ -12110,7 +12131,7 @@ var init_kernel_streams = __esm({
12110
12131
  vessel(open, kfd, at, terminal) {
12111
12132
  let stream;
12112
12133
  try {
12113
- stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL | O_TRUNC2), at.mode);
12134
+ stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 | O_TRUNC2), at.mode);
12114
12135
  } catch (e) {
12115
12136
  this.sys.close(kfd);
12116
12137
  throw e;
@@ -12449,7 +12470,7 @@ function restoreForkedStreams(Fs, streams2, table) {
12449
12470
  } else {
12450
12471
  const placed = place(
12451
12472
  Fs,
12452
- Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL2 | O_TRUNC3)),
12473
+ Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 | O_TRUNC3)),
12453
12474
  entry.fd
12454
12475
  );
12455
12476
  setCloseOnExec(placed, (entry.flags & O_CLOEXEC) !== 0);
@@ -12458,7 +12479,7 @@ function restoreForkedStreams(Fs, streams2, table) {
12458
12479
  }
12459
12480
  }
12460
12481
  }
12461
- var O_RDWR4, O_ACCMODE4, O_CREAT3, O_EXCL2, O_TRUNC3, PLACEHOLDER_DIR, NAMED_DEVICES, ACCESS, DEVICES2, FIFO_MODE, nextStreamIno, streamInos;
12482
+ var O_RDWR4, O_ACCMODE4, O_CREAT3, O_EXCL3, O_TRUNC3, PLACEHOLDER_DIR, NAMED_DEVICES, ACCESS, DEVICES2, FIFO_MODE, nextStreamIno, streamInos;
12462
12483
  var init_process_fork = __esm({
12463
12484
  "src/process/process-fork.ts"() {
12464
12485
  "use strict";
@@ -12466,7 +12487,7 @@ var init_process_fork = __esm({
12466
12487
  O_RDWR4 = 2;
12467
12488
  O_ACCMODE4 = 3;
12468
12489
  O_CREAT3 = 64;
12469
- O_EXCL2 = 128;
12490
+ O_EXCL3 = 128;
12470
12491
  O_TRUNC3 = 512;
12471
12492
  PLACEHOLDER_DIR = "/dev/slicc-fd";
12472
12493
  NAMED_DEVICES = {