@ai-ecoverse/slicc-kernel 1.116.2 → 1.117.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/README.md +18 -1
- package/dist/kernel-worker.js +128 -23
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +23 -8
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +128 -23
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +23 -8
- package/dist/process-worker.js.map +3 -3
- package/dist/types/kernel/fd-table.d.ts +1 -0
- package/dist/types/kernel/host-ops.d.ts +10 -1
- package/dist/types/kernel/locks.d.ts +11 -0
- package/dist/types/kernel/process.d.ts +2 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +3 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1724,6 +1724,12 @@ function writeHolder(view, at, found) {
|
|
|
1724
1724
|
}
|
|
1725
1725
|
function lockImports(host) {
|
|
1726
1726
|
return {
|
|
1727
|
+
flock: (fd, op) => {
|
|
1728
|
+
host.promote(fd);
|
|
1729
|
+
const kind = FLOCK_OPS[op & ~LOCK_NB];
|
|
1730
|
+
if (!kind) throw new WasiError("EINVAL");
|
|
1731
|
+
host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
1732
|
+
},
|
|
1727
1733
|
fcntl_lock: (fd, cmd, at) => {
|
|
1728
1734
|
if (cmd !== F_GETLK && cmd !== F_SETLK && cmd !== F_SETLKW) throw new WasiError("EINVAL");
|
|
1729
1735
|
const file = host.file(fd);
|
|
@@ -1744,7 +1750,7 @@ function lockImports(host) {
|
|
|
1744
1750
|
}
|
|
1745
1751
|
};
|
|
1746
1752
|
}
|
|
1747
|
-
var F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_WRLCK, F_UNLCK, SEEK_SET, SEEK_CUR, SEEK_END;
|
|
1753
|
+
var F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_WRLCK, F_UNLCK, SEEK_SET, SEEK_CUR, SEEK_END, LOCK_NB, FLOCK_OPS;
|
|
1748
1754
|
var init_slicc_lock = __esm({
|
|
1749
1755
|
"src/process/wasi/slicc-lock.ts"() {
|
|
1750
1756
|
"use strict";
|
|
@@ -1758,6 +1764,8 @@ var init_slicc_lock = __esm({
|
|
|
1758
1764
|
SEEK_SET = 0;
|
|
1759
1765
|
SEEK_CUR = 1;
|
|
1760
1766
|
SEEK_END = 2;
|
|
1767
|
+
LOCK_NB = 4;
|
|
1768
|
+
FLOCK_OPS = { 1: "shared", 2: "exclusive", 8: "unlock" };
|
|
1761
1769
|
}
|
|
1762
1770
|
});
|
|
1763
1771
|
|
|
@@ -2207,12 +2215,12 @@ var init_wasi_fds = __esm({
|
|
|
2207
2215
|
dup(fd, min, cloexec) {
|
|
2208
2216
|
const e = this.get(fd);
|
|
2209
2217
|
let at;
|
|
2210
|
-
if (e.type
|
|
2218
|
+
if (e.type !== "file") {
|
|
2211
2219
|
at = this.kernel.call({ op: "fd-dup", fd, min: Math.max(3, min) });
|
|
2212
2220
|
this.table.set(at, { ...e });
|
|
2213
2221
|
} else {
|
|
2214
|
-
|
|
2215
|
-
at = this.install(e
|
|
2222
|
+
e.file.refs++;
|
|
2223
|
+
at = this.install(e, min);
|
|
2216
2224
|
}
|
|
2217
2225
|
if (cloexec) this.setCloexec(at, true);
|
|
2218
2226
|
this.bump(at);
|
|
@@ -2237,11 +2245,15 @@ var init_wasi_fds = __esm({
|
|
|
2237
2245
|
}
|
|
2238
2246
|
this.bump();
|
|
2239
2247
|
}
|
|
2240
|
-
|
|
2248
|
+
promote(fd) {
|
|
2249
|
+
const e = this.get(fd);
|
|
2250
|
+
if (e.type === "file") this.promoteFiles(e.file.buffer);
|
|
2251
|
+
}
|
|
2252
|
+
promoteFiles(only) {
|
|
2241
2253
|
const promoted = /* @__PURE__ */ new Map();
|
|
2242
2254
|
const handed = /* @__PURE__ */ new Set();
|
|
2243
2255
|
for (const [fd, e] of [...this.table]) {
|
|
2244
|
-
if (e.type !== "file") continue;
|
|
2256
|
+
if (e.type !== "file" || only && e.file.buffer !== only) continue;
|
|
2245
2257
|
const first = promoted.get(e.file);
|
|
2246
2258
|
if (first !== void 0) {
|
|
2247
2259
|
this.kernel.call({ op: "fd-promote", fd, share: first });
|
|
@@ -3981,7 +3993,9 @@ var init_wasi_host = __esm({
|
|
|
3981
3993
|
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
3982
3994
|
},
|
|
3983
3995
|
locked: () => this.fds.holdLocks(),
|
|
3996
|
+
promote: (fd) => this.fds.promote(fd),
|
|
3984
3997
|
calls: {
|
|
3998
|
+
flock: (fd, kind, wait2) => void this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} }),
|
|
3985
3999
|
set: (target, kind, start2, len, wait2) => void this.o.kernel.call({
|
|
3986
4000
|
op: "lk-set",
|
|
3987
4001
|
...target,
|
|
@@ -4463,7 +4477,8 @@ var init_wasi_host = __esm({
|
|
|
4463
4477
|
size: () => file.size()
|
|
4464
4478
|
};
|
|
4465
4479
|
}
|
|
4466
|
-
if (e.type !== "kernel"
|
|
4480
|
+
if (e.type !== "kernel") throw new WasiError("EBADF");
|
|
4481
|
+
if (this.fds.kind(fd, e) !== "file") return { target: { fd }, offset: () => 0, size: () => 0 };
|
|
4467
4482
|
return {
|
|
4468
4483
|
target: { fd },
|
|
4469
4484
|
offset: () => this.o.kernel.sys.seek(fd, 0, WHENCE.CUR),
|
|
@@ -5362,7 +5377,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
5362
5377
|
var init_version = __esm({
|
|
5363
5378
|
"src/version.ts"() {
|
|
5364
5379
|
"use strict";
|
|
5365
|
-
KERNEL_VERSION = true ? "1.
|
|
5380
|
+
KERNEL_VERSION = true ? "1.117.0" : "0.0.0-dev";
|
|
5366
5381
|
OS_RELEASE = "6.0.0-slicc";
|
|
5367
5382
|
}
|
|
5368
5383
|
});
|