@ai-ecoverse/slicc-kernel 1.116.1 → 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 +19 -1
- package/dist/kernel-worker.js +147 -25
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +24 -8
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +147 -25
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +24 -8
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/opfs.d.ts +1 -0
- 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 });
|
|
@@ -2563,6 +2575,7 @@ var init_wasi_fds = __esm({
|
|
|
2563
2575
|
}
|
|
2564
2576
|
regular(path, s, oflags, rights, fdflags, mode) {
|
|
2565
2577
|
if (s?.isFifo) return this.kernelFifo(path, s, oflags, rights, fdflags);
|
|
2578
|
+
if (s?.isSocket) throw new WasiError("ENXIO");
|
|
2566
2579
|
if (this.shared || this.kernelHolds(path, s)) {
|
|
2567
2580
|
return this.kernelFile(path, s, oflags, rights, fdflags, mode);
|
|
2568
2581
|
}
|
|
@@ -3980,7 +3993,9 @@ var init_wasi_host = __esm({
|
|
|
3980
3993
|
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
3981
3994
|
},
|
|
3982
3995
|
locked: () => this.fds.holdLocks(),
|
|
3996
|
+
promote: (fd) => this.fds.promote(fd),
|
|
3983
3997
|
calls: {
|
|
3998
|
+
flock: (fd, kind, wait2) => void this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} }),
|
|
3984
3999
|
set: (target, kind, start2, len, wait2) => void this.o.kernel.call({
|
|
3985
4000
|
op: "lk-set",
|
|
3986
4001
|
...target,
|
|
@@ -4462,7 +4477,8 @@ var init_wasi_host = __esm({
|
|
|
4462
4477
|
size: () => file.size()
|
|
4463
4478
|
};
|
|
4464
4479
|
}
|
|
4465
|
-
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 };
|
|
4466
4482
|
return {
|
|
4467
4483
|
target: { fd },
|
|
4468
4484
|
offset: () => this.o.kernel.sys.seek(fd, 0, WHENCE.CUR),
|
|
@@ -5361,7 +5377,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
5361
5377
|
var init_version = __esm({
|
|
5362
5378
|
"src/version.ts"() {
|
|
5363
5379
|
"use strict";
|
|
5364
|
-
KERNEL_VERSION = true ? "1.
|
|
5380
|
+
KERNEL_VERSION = true ? "1.117.0" : "0.0.0-dev";
|
|
5365
5381
|
OS_RELEASE = "6.0.0-slicc";
|
|
5366
5382
|
}
|
|
5367
5383
|
});
|