@ai-ecoverse/slicc-kernel 1.99.2 → 1.100.0

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
@@ -11100,7 +11100,7 @@ var PATH_OPS = new Set(SYNC_FS_OPS);
11100
11100
  var EARLY_WHOLE_FILE = 64 * 1024;
11101
11101
 
11102
11102
  // src/version.ts
11103
- var KERNEL_VERSION = true ? "1.99.2" : "0.0.0-dev";
11103
+ var KERNEL_VERSION = true ? "1.100.0" : "0.0.0-dev";
11104
11104
  var OS_RELEASE = "6.0.0-slicc";
11105
11105
  function procVersion() {
11106
11106
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -12140,7 +12140,7 @@ async function recordLock2(req, ctx) {
12140
12140
  return done2;
12141
12141
  }
12142
12142
  const range = lockRange(req.start, req.len);
12143
- const key = await fileKey(target, req.kind);
12143
+ const key = await fileKey(target, req.kind, req.op === "lk-set" && req.fd !== void 0);
12144
12144
  if (req.op === "lk-get") {
12145
12145
  const held = locks.holder(key, owner, { key, kind: req.kind, ...range });
12146
12146
  if (!held) return json3(null);
@@ -15624,7 +15624,7 @@ var WasmProcess = class {
15624
15624
  return await hostSyscall(req, {
15625
15625
  pid: this.pid,
15626
15626
  owner: () => this.lockOwner(),
15627
- fileKey: (target, kind) => this.lockKey(target, kind),
15627
+ fileKey: (target, kind, setting) => this.lockKey(target, kind, setting),
15628
15628
  locks: this.options.locks,
15629
15629
  ops: this.asyncOps,
15630
15630
  blocking: () => this.blockingSignal(cancelled),
@@ -15676,8 +15676,11 @@ var WasmProcess = class {
15676
15676
  }
15677
15677
  return path;
15678
15678
  }
15679
- async lockKey(target, kind) {
15679
+ async lockKey(target, kind, setting = false) {
15680
15680
  const file = target.fd === void 0 ? void 0 : this.fds.get(target.fd);
15681
+ const access2 = file?.file;
15682
+ if (setting && (kind === "read" && !access2?.read || kind === "write" && !access2?.write))
15683
+ throw new KernelError("EBADF");
15681
15684
  const known = file ? fileKeys.get(file) : this.pathKeys.get(target.path ?? "");
15682
15685
  if (kind === "close" && !file && target.path !== void 0) this.pathKeys.delete(target.path);
15683
15686
  const want = kind === "read" ? R_OK : kind === "write" ? W_OK : 0;