@ai-ecoverse/slicc-kernel 1.125.9 → 1.125.11

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
@@ -4340,6 +4340,17 @@ var S_IFIFO = 4096;
4340
4340
  var PERM_MASK = 4095;
4341
4341
  var S_ISGID3 = 1024;
4342
4342
  var READ_ATTEMPTS = 3;
4343
+ async function swapped(op) {
4344
+ for (let attempt = 1; ; attempt++) {
4345
+ try {
4346
+ return await op();
4347
+ } catch (err) {
4348
+ if (err?.name !== "NotFoundError" || attempt >= READ_ATTEMPTS) {
4349
+ throw err;
4350
+ }
4351
+ }
4352
+ }
4353
+ }
4343
4354
  var MAX_LINKS5 = 40;
4344
4355
  var CHECK_MS = 1e3;
4345
4356
  var ABSENT_MS = 2;
@@ -5121,10 +5132,14 @@ var OpfsFs = class {
5121
5132
  return { ...stat, ...ownOf(meta) ?? inherit(entries) };
5122
5133
  }
5123
5134
  stat(path) {
5124
- return this.unreplaced(async () => this.describe(await this.located(path, true)));
5135
+ return this.unreplaced(
5136
+ () => swapped(async () => this.describe(await this.located(path, true)))
5137
+ );
5125
5138
  }
5126
5139
  lstat(path) {
5127
- return this.unreplaced(async () => this.describe(await this.located(path, false)));
5140
+ return this.unreplaced(
5141
+ () => swapped(async () => this.describe(await this.located(path, false)))
5142
+ );
5128
5143
  }
5129
5144
  async exists(path) {
5130
5145
  return this.locate(path, true).then(
@@ -5150,8 +5165,17 @@ var OpfsFs = class {
5150
5165
  }
5151
5166
  reading(path, op) {
5152
5167
  return this.unreplaced(async () => {
5153
- const handle = await this.existing(path);
5154
- return this.retrying(path, () => op(handle), false);
5168
+ for (let attempt = 1; ; attempt++) {
5169
+ const found = await this.locate(path, true);
5170
+ const handle = found.handle;
5171
+ if (handle.kind === "directory") throw fsError("EISDIR", path);
5172
+ try {
5173
+ return await this.retrying(path, () => op(handle), false);
5174
+ } catch (err) {
5175
+ if (err.code !== "ENOENT" || attempt >= READ_ATTEMPTS) throw err;
5176
+ this.files.delete(found.path);
5177
+ }
5178
+ }
5155
5179
  });
5156
5180
  }
5157
5181
  async existing(path, writing = false) {
@@ -5655,10 +5679,10 @@ var OpfsFs = class {
5655
5679
  }));
5656
5680
  }
5657
5681
  async utimes(path, atime, mtime) {
5658
- await this.setTimes(await this.locate(path, true), atime, mtime);
5682
+ await swapped(async () => this.setTimes(await this.locate(path, true), atime, mtime));
5659
5683
  }
5660
5684
  async lutimes(path, atime, mtime) {
5661
- await this.setTimes(await this.locate(path, false), atime, mtime);
5685
+ await swapped(async () => this.setTimes(await this.locate(path, false), atime, mtime));
5662
5686
  }
5663
5687
  async setTimes(found, atime, mtime) {
5664
5688
  this.refuse(found.path);
@@ -7086,7 +7110,7 @@ function satisfies(version, range2) {
7086
7110
  }
7087
7111
 
7088
7112
  // src/version.ts
7089
- var KERNEL_VERSION = true ? "1.125.9" : "0.0.0-dev";
7113
+ var KERNEL_VERSION = true ? "1.125.11" : "0.0.0-dev";
7090
7114
  var OS_RELEASE = "6.0.0-slicc";
7091
7115
  function procVersion() {
7092
7116
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19267,6 +19291,7 @@ var MAX_READ = 1024 * 1024;
19267
19291
  var O_NONBLOCK = 2048;
19268
19292
  var WRITE_ACCESS = 3;
19269
19293
  var KEYBOARD = /* @__PURE__ */ new Set([SIG.INT, SIG.QUIT, SIG.TSTP]);
19294
+ var STUCK_ESCAPES = /* @__PURE__ */ new Set([SIG.INT, SIG.TERM, SIG.QUIT, SIG.HUP]);
19270
19295
  var DEFAULT_UMASK2 = 18;
19271
19296
  function words(value2) {
19272
19297
  if (!Array.isArray(value2) || !value2.every((w) => typeof w === "string")) {
@@ -19323,6 +19348,8 @@ var WasmProcess = class {
19323
19348
  cred;
19324
19349
  execChild;
19325
19350
  killed = false;
19351
+ calls = 0;
19352
+ pendingAt = /* @__PURE__ */ new Map();
19326
19353
  execTermsig;
19327
19354
  stopped = 0;
19328
19355
  stops = 0;
@@ -19421,9 +19448,9 @@ var WasmProcess = class {
19421
19448
  const action = defaultAction(sig);
19422
19449
  return action === "stop" ? this.stop(sig) : action;
19423
19450
  }
19424
- if (((this.options.pendingBits?.() ?? 0) & bit) !== 0 && defaultAction(sig) === "terminate") {
19425
- return "terminate";
19426
- }
19451
+ if (((this.options.pendingBits?.() ?? 0) & bit) !== 0) {
19452
+ if (STUCK_ESCAPES.has(sig) && this.pendingAt.get(sig) === this.calls) return "terminate";
19453
+ } else this.pendingAt.set(sig, this.calls);
19427
19454
  this.options.onPending?.(sig);
19428
19455
  if (this.options.jobs?.keyboard && KEYBOARD.has(sig) && this.waiting.size === 0)
19429
19456
  this.owed = true;
@@ -19546,6 +19573,7 @@ var WasmProcess = class {
19546
19573
  }
19547
19574
  async syscall(req, cancelled, block) {
19548
19575
  this.options.onSyscall?.(req);
19576
+ this.calls += 1;
19549
19577
  const started = performance.now();
19550
19578
  let restarted = false;
19551
19579
  for (; ; ) {