@ai-ecoverse/slicc-kernel 1.100.1 → 1.100.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.
@@ -4767,7 +4767,7 @@ var KERNEL_VERSION, OS_RELEASE;
4767
4767
  var init_version = __esm({
4768
4768
  "src/version.ts"() {
4769
4769
  "use strict";
4770
- KERNEL_VERSION = true ? "1.100.1" : "0.0.0-dev";
4770
+ KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
4771
4771
  OS_RELEASE = "6.0.0-slicc";
4772
4772
  }
4773
4773
  });
package/dist/node.js CHANGED
@@ -11107,7 +11107,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11107
11107
  var EARLY_WHOLE_FILE = 64 * 1024;
11108
11108
 
11109
11109
  // src/version.ts
11110
- var KERNEL_VERSION = true ? "1.100.1" : "0.0.0-dev";
11110
+ var KERNEL_VERSION = true ? "1.100.2" : "0.0.0-dev";
11111
11111
  var OS_RELEASE = "6.0.0-slicc";
11112
11112
  function procVersion() {
11113
11113
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -14246,6 +14246,13 @@ var SEM_NAMES_MAX = 4096;
14246
14246
  var SEM_HANDLES_MAX = 256;
14247
14247
  var NAME_MAX = 251;
14248
14248
  var TIMER_MAX_MS = 2147483647;
14249
+ var deadlines = /* @__PURE__ */ new WeakMap();
14250
+ function timeLeft(req, timeoutMs) {
14251
+ const now = performance.now();
14252
+ const deadline = deadlines.get(req) ?? now + timeoutMs;
14253
+ deadlines.set(req, deadline);
14254
+ return Math.max(0, deadline - now);
14255
+ }
14249
14256
  var SEM_OPS = [
14250
14257
  "sem-open",
14251
14258
  "sem-close",
@@ -14432,8 +14439,9 @@ async function semSyscall(req, proc) {
14432
14439
  const sem = handles.get(req.handle);
14433
14440
  if (sem.take()) return ok2();
14434
14441
  if (req.how === "try") throw new KernelError("EAGAIN");
14435
- if (req.how === "timed" && req.timeoutMs === 0) throw new KernelError("ETIMEDOUT");
14436
- const got = await sem.wait(proc.blocking(), req.how === "block" ? -1 : req.timeoutMs);
14442
+ const timeoutMs = req.how === "block" ? -1 : timeLeft(req, req.timeoutMs);
14443
+ if (timeoutMs === 0) throw new KernelError("ETIMEDOUT");
14444
+ const got = await sem.wait(proc.blocking(), timeoutMs);
14437
14445
  if (!got) throw new KernelError("ETIMEDOUT");
14438
14446
  return ok2();
14439
14447
  }