@ai-ecoverse/slicc-kernel 1.120.1 → 1.121.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.
@@ -1032,7 +1032,7 @@ function normal(path) {
1032
1032
  }
1033
1033
  return `/${parts.join("/")}`;
1034
1034
  }
1035
- var GEN, RING, RING_SIZE, SLOT, DIRTY, CHANGES_BYTES, ChangeView;
1035
+ var GEN, RING, RING_SIZE, SLOT, DIRTY, FOREIGN, CHANGES_BYTES, ChangeView;
1036
1036
  var init_changes = __esm({
1037
1037
  "src/fs/changes.ts"() {
1038
1038
  "use strict";
@@ -1041,7 +1041,8 @@ var init_changes = __esm({
1041
1041
  RING_SIZE = 4096;
1042
1042
  SLOT = 2;
1043
1043
  DIRTY = RING + RING_SIZE * SLOT;
1044
- CHANGES_BYTES = (DIRTY + 1) * 4;
1044
+ FOREIGN = DIRTY + 1;
1045
+ CHANGES_BYTES = (FOREIGN + 1) * 4;
1045
1046
  ChangeView = class {
1046
1047
  view;
1047
1048
  constructor(sab) {
@@ -1053,6 +1054,9 @@ var init_changes = __esm({
1053
1054
  clean() {
1054
1055
  return this.view.length > DIRTY && Atomics.load(this.view, DIRTY) === 0;
1055
1056
  }
1057
+ foreign() {
1058
+ return this.view.length > FOREIGN && Atomics.load(this.view, FOREIGN) === 1;
1059
+ }
1056
1060
  changedSince(seen, path) {
1057
1061
  const now = Atomics.load(this.view, GEN);
1058
1062
  const distance = now - seen >>> 0;
@@ -1413,7 +1417,8 @@ function refusal(err) {
1413
1417
  const code2 = err?.code;
1414
1418
  return code2 === "EACCES" || code2 === "EPERM";
1415
1419
  }
1416
- function cachedStat(s, dir) {
1420
+ function cachedStat(s, dir, view) {
1421
+ if (view?.foreign() && !s.dirty) return false;
1417
1422
  return s.stat !== void 0 && (!dir || s.statAt === syncCallCount());
1418
1423
  }
1419
1424
  function searchParents(Fs, node, bridge, call2) {
@@ -1534,7 +1539,7 @@ function createHelpers(Fs, ops) {
1534
1539
  const size = node.live.ranged?.size() ?? node.live.len;
1535
1540
  return { ...node.live.stat, size };
1536
1541
  }
1537
- if (!cachedStat(node.live, Fs.isDir(node.mode))) {
1542
+ if (!cachedStat(node.live, Fs.isDir(node.mode), bridgeOf(node).changes)) {
1538
1543
  const st = call2(() => bridgeOf(node).lstat(liveNodePath(linked.holder(node))));
1539
1544
  Object.assign(node.live, { stat: st, statAt: syncCallCount() });
1540
1545
  node.mode = modeFromStat(st, exactIn(node));
@@ -1698,7 +1703,7 @@ function createNodeOps(h) {
1698
1703
  const owned = bridgeOf(node).owners === true;
1699
1704
  if (owned && Fs.isLink(node.mode) && statOf(node).uid === void 0)
1700
1705
  node.live.stat = void 0;
1701
- const cached = owned && cachedStat(node.live, Fs.isDir(node.mode));
1706
+ const cached = owned && cachedStat(node.live, Fs.isDir(node.mode), bridgeOf(node).changes);
1702
1707
  const st = statOf(node);
1703
1708
  if (cached) searchParents(Fs, node, bridgeOf(node), call2);
1704
1709
  const s = node.live;
@@ -2260,6 +2265,8 @@ function guardKeptNodes(Fs, handled) {
2260
2265
  }
2261
2266
  function outdated(node, view, before) {
2262
2267
  const s = node.live;
2268
+ if (view.foreign() && s.openCount === 0 && !s.dirty && node !== node.mount.root && !node.mounted)
2269
+ return true;
2263
2270
  if (s.named === void 0) {
2264
2271
  s.named = before;
2265
2272
  return false;
@@ -2546,7 +2553,7 @@ var KERNEL_VERSION, OS_RELEASE;
2546
2553
  var init_version = __esm({
2547
2554
  "src/version.ts"() {
2548
2555
  "use strict";
2549
- KERNEL_VERSION = true ? "1.120.1" : "0.0.0-dev";
2556
+ KERNEL_VERSION = true ? "1.121.0" : "0.0.0-dev";
2550
2557
  OS_RELEASE = "6.0.0-slicc";
2551
2558
  }
2552
2559
  });
@@ -4494,6 +4501,14 @@ var init_process_fork = __esm({
4494
4501
  });
4495
4502
 
4496
4503
  // src/process/process-children.ts
4504
+ function inheritedOf(r) {
4505
+ return r.ok && r.kind === "json" ? r.json & ~UNSEEDED : 0;
4506
+ }
4507
+ function inheritedSignals(transport) {
4508
+ return inheritedOf(
4509
+ transport.call({ op: "sig-inherited" }, Number.POSITIVE_INFINITY, "sig-inherited")
4510
+ );
4511
+ }
4497
4512
  function status(r) {
4498
4513
  return r.ok ? 0 : -wasiErrno(r.errno);
4499
4514
  }
@@ -4712,9 +4727,8 @@ function createProcessKernel(deps) {
4712
4727
  execCaptures.delete(pid);
4713
4728
  return status2;
4714
4729
  },
4715
- pause() {
4716
- return status(call2({ op: "sig-pause" }, "pause"));
4717
- },
4730
+ pause: () => status(call2({ op: "sig-pause" }, "pause")),
4731
+ sigInherited: () => inheritedOf(call2({ op: "sig-inherited" }, "sig-inherited")),
4718
4732
  mount(source, target, type, flags, data) {
4719
4733
  const req = { op: "mount", source, target: at(target), type, flags, data };
4720
4734
  return status(call2(req, `mount ${target}`));
@@ -4763,7 +4777,7 @@ function createProcessKernel(deps) {
4763
4777
  }
4764
4778
  };
4765
4779
  }
4766
- var S_IFMT2, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
4780
+ var S_IFMT2, UNSEEDED, S_IFDIR2, POLLIN2, POLLOUT2, POLLERR2, POLLHUP2, POLLNVAL, SELECT_SLICE_MS, WUNTRACED, WCONTINUED;
4767
4781
  var init_process_children = __esm({
4768
4782
  "src/process/process-children.ts"() {
4769
4783
  "use strict";
@@ -4772,6 +4786,7 @@ var init_process_children = __esm({
4772
4786
  init_process_locks();
4773
4787
  init_wasi_errno();
4774
4788
  S_IFMT2 = 61440;
4789
+ UNSEEDED = sigbit(SIG.KILL) | sigbit(SIG.STOP) | 1;
4775
4790
  S_IFDIR2 = 16384;
4776
4791
  POLLIN2 = 1;
4777
4792
  POLLOUT2 = 4;
@@ -5880,6 +5895,7 @@ async function runWasmProcess(init, port2, deps = {}) {
5880
5895
  sliccPid: id.pid,
5881
5896
  sliccPpid: id.ppid,
5882
5897
  sliccEnv: init.env,
5898
+ sliccKernel: { sigInherited: () => inheritedSignals(transport) },
5883
5899
  print: say(1),
5884
5900
  printErr: say(2),
5885
5901
  instantiateWasm(imports, done) {
@@ -6416,7 +6432,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
6416
6432
  return void 0;
6417
6433
  };
6418
6434
  const cached = (map, path, get) => {
6419
- if (blind) return get();
6435
+ if (blind || view?.foreign()) return get();
6420
6436
  cache.fresh();
6421
6437
  let hit = map.get(path);
6422
6438
  if (hit === void 0 || "until" in hit && !live(hit, path)) {