@ai-ecoverse/slicc-kernel 1.120.0 → 1.120.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.
- package/README.md +8 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +79 -13
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +64 -37
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +79 -13
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +64 -37
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/changes.d.ts +2 -0
- package/dist/types/fs/opfs.d.ts +4 -1
- package/dist/types/fs/ranged.d.ts +1 -0
- package/dist/types/fs/remote.d.ts +3 -0
- package/dist/types/fs/types.d.ts +7 -0
- package/dist/types/kernel/fd-table.d.ts +1 -0
- package/dist/types/kernel/host-ops.d.ts +1 -0
- package/dist/types/kernel/lock-service.d.ts +8 -1
- package/dist/types/kernel/process.d.ts +1 -0
- package/dist/types/kernel/vfs-file.d.ts +1 -0
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +3 -2
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +1 -0
- package/dist/types/process/wasi/wasi-host.d.ts +1 -0
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -702,7 +702,11 @@ var init_ranged = __esm({
|
|
|
702
702
|
if (!watch || this.pinned) return;
|
|
703
703
|
const { now, changed: changed2 } = watchedChange(watch, this.seen, this.path);
|
|
704
704
|
this.seen = now;
|
|
705
|
-
if (
|
|
705
|
+
if (changed2) this.reread();
|
|
706
|
+
}
|
|
707
|
+
reread() {
|
|
708
|
+
const watch = this.watch;
|
|
709
|
+
if (!watch || this.pinned || this.pages.changed) return;
|
|
706
710
|
let st;
|
|
707
711
|
try {
|
|
708
712
|
st = watch.stat(this.path);
|
|
@@ -1028,7 +1032,7 @@ function normal(path) {
|
|
|
1028
1032
|
}
|
|
1029
1033
|
return `/${parts.join("/")}`;
|
|
1030
1034
|
}
|
|
1031
|
-
var GEN, RING, RING_SIZE, SLOT, DIRTY, CHANGES_BYTES, ChangeView;
|
|
1035
|
+
var GEN, RING, RING_SIZE, SLOT, DIRTY, FOREIGN, CHANGES_BYTES, ChangeView;
|
|
1032
1036
|
var init_changes = __esm({
|
|
1033
1037
|
"src/fs/changes.ts"() {
|
|
1034
1038
|
"use strict";
|
|
@@ -1037,7 +1041,8 @@ var init_changes = __esm({
|
|
|
1037
1041
|
RING_SIZE = 4096;
|
|
1038
1042
|
SLOT = 2;
|
|
1039
1043
|
DIRTY = RING + RING_SIZE * SLOT;
|
|
1040
|
-
|
|
1044
|
+
FOREIGN = DIRTY + 1;
|
|
1045
|
+
CHANGES_BYTES = (FOREIGN + 1) * 4;
|
|
1041
1046
|
ChangeView = class {
|
|
1042
1047
|
view;
|
|
1043
1048
|
constructor(sab) {
|
|
@@ -1049,6 +1054,9 @@ var init_changes = __esm({
|
|
|
1049
1054
|
clean() {
|
|
1050
1055
|
return this.view.length > DIRTY && Atomics.load(this.view, DIRTY) === 0;
|
|
1051
1056
|
}
|
|
1057
|
+
foreign() {
|
|
1058
|
+
return this.view.length > FOREIGN && Atomics.load(this.view, FOREIGN) === 1;
|
|
1059
|
+
}
|
|
1052
1060
|
changedSince(seen, path) {
|
|
1053
1061
|
const now = Atomics.load(this.view, GEN);
|
|
1054
1062
|
const distance = now - seen >>> 0;
|
|
@@ -1409,7 +1417,8 @@ function refusal(err) {
|
|
|
1409
1417
|
const code2 = err?.code;
|
|
1410
1418
|
return code2 === "EACCES" || code2 === "EPERM";
|
|
1411
1419
|
}
|
|
1412
|
-
function cachedStat(s, dir) {
|
|
1420
|
+
function cachedStat(s, dir, view) {
|
|
1421
|
+
if (view?.foreign() && !s.dirty) return false;
|
|
1413
1422
|
return s.stat !== void 0 && (!dir || s.statAt === syncCallCount());
|
|
1414
1423
|
}
|
|
1415
1424
|
function searchParents(Fs, node, bridge, call2) {
|
|
@@ -1530,7 +1539,7 @@ function createHelpers(Fs, ops) {
|
|
|
1530
1539
|
const size = node.live.ranged?.size() ?? node.live.len;
|
|
1531
1540
|
return { ...node.live.stat, size };
|
|
1532
1541
|
}
|
|
1533
|
-
if (!cachedStat(node.live, Fs.isDir(node.mode))) {
|
|
1542
|
+
if (!cachedStat(node.live, Fs.isDir(node.mode), bridgeOf(node).changes)) {
|
|
1534
1543
|
const st = call2(() => bridgeOf(node).lstat(liveNodePath(linked.holder(node))));
|
|
1535
1544
|
Object.assign(node.live, { stat: st, statAt: syncCallCount() });
|
|
1536
1545
|
node.mode = modeFromStat(st, exactIn(node));
|
|
@@ -1694,7 +1703,7 @@ function createNodeOps(h) {
|
|
|
1694
1703
|
const owned = bridgeOf(node).owners === true;
|
|
1695
1704
|
if (owned && Fs.isLink(node.mode) && statOf(node).uid === void 0)
|
|
1696
1705
|
node.live.stat = void 0;
|
|
1697
|
-
const cached = owned && cachedStat(node.live, Fs.isDir(node.mode));
|
|
1706
|
+
const cached = owned && cachedStat(node.live, Fs.isDir(node.mode), bridgeOf(node).changes);
|
|
1698
1707
|
const st = statOf(node);
|
|
1699
1708
|
if (cached) searchParents(Fs, node, bridgeOf(node), call2);
|
|
1700
1709
|
const s = node.live;
|
|
@@ -2256,6 +2265,8 @@ function guardKeptNodes(Fs, handled) {
|
|
|
2256
2265
|
}
|
|
2257
2266
|
function outdated(node, view, before) {
|
|
2258
2267
|
const s = node.live;
|
|
2268
|
+
if (view.foreign() && s.openCount === 0 && !s.dirty && node !== node.mount.root && !node.mounted)
|
|
2269
|
+
return true;
|
|
2259
2270
|
if (s.named === void 0) {
|
|
2260
2271
|
s.named = before;
|
|
2261
2272
|
return false;
|
|
@@ -2542,7 +2553,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2542
2553
|
var init_version = __esm({
|
|
2543
2554
|
"src/version.ts"() {
|
|
2544
2555
|
"use strict";
|
|
2545
|
-
KERNEL_VERSION = true ? "1.120.
|
|
2556
|
+
KERNEL_VERSION = true ? "1.120.2" : "0.0.0-dev";
|
|
2546
2557
|
OS_RELEASE = "6.0.0-slicc";
|
|
2547
2558
|
}
|
|
2548
2559
|
});
|
|
@@ -6412,7 +6423,7 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
6412
6423
|
return void 0;
|
|
6413
6424
|
};
|
|
6414
6425
|
const cached = (map, path, get) => {
|
|
6415
|
-
if (blind) return get();
|
|
6426
|
+
if (blind || view?.foreign()) return get();
|
|
6416
6427
|
cache.fresh();
|
|
6417
6428
|
let hit = map.get(path);
|
|
6418
6429
|
if (hit === void 0 || "until" in hit && !live(hit, path)) {
|
|
@@ -6701,6 +6712,11 @@ var init_wasi_files = __esm({
|
|
|
6701
6712
|
this.orphaned = true;
|
|
6702
6713
|
this.ranged?.pin();
|
|
6703
6714
|
}
|
|
6715
|
+
reread() {
|
|
6716
|
+
if (this.dirty || this.orphaned) return;
|
|
6717
|
+
if (this.ranged) this.ranged.reread();
|
|
6718
|
+
else this.data = void 0;
|
|
6719
|
+
}
|
|
6704
6720
|
isOrphan() {
|
|
6705
6721
|
return this.orphaned;
|
|
6706
6722
|
}
|
|
@@ -6943,7 +6959,8 @@ function lockImports(host) {
|
|
|
6943
6959
|
host.promote(fd);
|
|
6944
6960
|
const kind = FLOCK_OPS[op & ~LOCK_NB];
|
|
6945
6961
|
if (!kind) throw new WasiError("EINVAL");
|
|
6946
|
-
host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
6962
|
+
const shared = host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
6963
|
+
if (kind !== "unlock" && shared === true) host.reread(fd);
|
|
6947
6964
|
},
|
|
6948
6965
|
fcntl_lock: (fd, cmd, at) => {
|
|
6949
6966
|
if (cmd !== F_GETLK2 && cmd !== F_SETLK2 && cmd !== F_SETLKW2) throw new WasiError("EINVAL");
|
|
@@ -6961,8 +6978,10 @@ function lockImports(host) {
|
|
|
6961
6978
|
if (kind === "read" && file.readable === false || kind === "write" && file.writable === false)
|
|
6962
6979
|
throw new WasiError("EBADF");
|
|
6963
6980
|
if (kind !== "write") host.flush(file);
|
|
6964
|
-
host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW2);
|
|
6965
|
-
if (kind
|
|
6981
|
+
const shared = host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW2);
|
|
6982
|
+
if (kind === "unlock") return;
|
|
6983
|
+
host.locked();
|
|
6984
|
+
if (shared === true) host.reread(fd);
|
|
6966
6985
|
}
|
|
6967
6986
|
};
|
|
6968
6987
|
}
|
|
@@ -7664,6 +7683,10 @@ var init_wasi_fds = __esm({
|
|
|
7664
7683
|
}
|
|
7665
7684
|
}
|
|
7666
7685
|
}
|
|
7686
|
+
reread(fd) {
|
|
7687
|
+
const e = this.get(fd);
|
|
7688
|
+
if (e.type === "file") e.file.buffer.reread();
|
|
7689
|
+
}
|
|
7667
7690
|
flushPath(path) {
|
|
7668
7691
|
for (const [p, buffer] of this.buffers) if (within(p, path)) buffer.flush();
|
|
7669
7692
|
if (this.shared && !this.fs.changes?.clean()) this.kernel.call({ op: "fd-path-flush", path });
|
|
@@ -9146,6 +9169,35 @@ var init_wasi_host = __esm({
|
|
|
9146
9169
|
}
|
|
9147
9170
|
});
|
|
9148
9171
|
}
|
|
9172
|
+
lockHost(mem) {
|
|
9173
|
+
return {
|
|
9174
|
+
mem,
|
|
9175
|
+
file: (fd) => this.lockedFile(fd),
|
|
9176
|
+
flush: (file) => {
|
|
9177
|
+
if (file.path !== void 0) this.fds.flushPath(file.path);
|
|
9178
|
+
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
9179
|
+
},
|
|
9180
|
+
locked: () => this.fds.holdLocks(),
|
|
9181
|
+
promote: (fd, moved) => this.fds.promote(fd, moved),
|
|
9182
|
+
reread: (fd) => this.fds.reread(fd),
|
|
9183
|
+
calls: {
|
|
9184
|
+
flock: (fd, kind, wait2) => this.fds.restarting(
|
|
9185
|
+
() => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
|
|
9186
|
+
),
|
|
9187
|
+
set: (target, kind, start2, len, wait2) => this.fds.restarting(
|
|
9188
|
+
() => this.o.kernel.call({
|
|
9189
|
+
op: "lk-set",
|
|
9190
|
+
...target,
|
|
9191
|
+
kind,
|
|
9192
|
+
start: start2,
|
|
9193
|
+
len,
|
|
9194
|
+
...wait2 ? { wait: wait2 } : {}
|
|
9195
|
+
})
|
|
9196
|
+
),
|
|
9197
|
+
get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
|
|
9198
|
+
}
|
|
9199
|
+
};
|
|
9200
|
+
}
|
|
9149
9201
|
sliccImports() {
|
|
9150
9202
|
const { mem } = this;
|
|
9151
9203
|
const path = (p, l) => {
|
|
@@ -9176,32 +9228,7 @@ var init_wasi_host = __esm({
|
|
|
9176
9228
|
void this.creds.change(() => this.o.kernel.call({ op: "proc-setcred", change }));
|
|
9177
9229
|
},
|
|
9178
9230
|
...semImports(this),
|
|
9179
|
-
...lockImports(
|
|
9180
|
-
mem,
|
|
9181
|
-
file: (fd) => this.lockedFile(fd),
|
|
9182
|
-
flush: (file) => {
|
|
9183
|
-
if (file.path !== void 0) this.fds.flushPath(file.path);
|
|
9184
|
-
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
9185
|
-
},
|
|
9186
|
-
locked: () => this.fds.holdLocks(),
|
|
9187
|
-
promote: (fd, moved) => this.fds.promote(fd, moved),
|
|
9188
|
-
calls: {
|
|
9189
|
-
flock: (fd, kind, wait2) => void this.fds.restarting(
|
|
9190
|
-
() => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
|
|
9191
|
-
),
|
|
9192
|
-
set: (target, kind, start2, len, wait2) => void this.fds.restarting(
|
|
9193
|
-
() => this.o.kernel.call({
|
|
9194
|
-
op: "lk-set",
|
|
9195
|
-
...target,
|
|
9196
|
-
kind,
|
|
9197
|
-
start: start2,
|
|
9198
|
-
len,
|
|
9199
|
-
...wait2 ? { wait: wait2 } : {}
|
|
9200
|
-
})
|
|
9201
|
-
),
|
|
9202
|
-
get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
|
|
9203
|
-
}
|
|
9204
|
-
}),
|
|
9231
|
+
...lockImports(this.lockHost(mem)),
|
|
9205
9232
|
groups_get: (buf, cap, count) => {
|
|
9206
9233
|
const { groups } = this.creds.get();
|
|
9207
9234
|
if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");
|