@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
package/dist/process-worker.js
CHANGED
|
@@ -2542,7 +2542,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2542
2542
|
var init_version = __esm({
|
|
2543
2543
|
"src/version.ts"() {
|
|
2544
2544
|
"use strict";
|
|
2545
|
-
KERNEL_VERSION = true ? "1.
|
|
2545
|
+
KERNEL_VERSION = true ? "1.117.0" : "0.0.0-dev";
|
|
2546
2546
|
OS_RELEASE = "6.0.0-slicc";
|
|
2547
2547
|
}
|
|
2548
2548
|
});
|
|
@@ -6931,6 +6931,12 @@ function writeHolder2(view, at, found) {
|
|
|
6931
6931
|
}
|
|
6932
6932
|
function lockImports(host) {
|
|
6933
6933
|
return {
|
|
6934
|
+
flock: (fd, op) => {
|
|
6935
|
+
host.promote(fd);
|
|
6936
|
+
const kind = FLOCK_OPS[op & ~LOCK_NB];
|
|
6937
|
+
if (!kind) throw new WasiError("EINVAL");
|
|
6938
|
+
host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
6939
|
+
},
|
|
6934
6940
|
fcntl_lock: (fd, cmd, at) => {
|
|
6935
6941
|
if (cmd !== F_GETLK2 && cmd !== F_SETLK2 && cmd !== F_SETLKW2) throw new WasiError("EINVAL");
|
|
6936
6942
|
const file = host.file(fd);
|
|
@@ -6951,7 +6957,7 @@ function lockImports(host) {
|
|
|
6951
6957
|
}
|
|
6952
6958
|
};
|
|
6953
6959
|
}
|
|
6954
|
-
var F_GETLK2, F_SETLK2, F_SETLKW2, F_RDLCK2, F_WRLCK2, F_UNLCK2, SEEK_SET, SEEK_CUR3, SEEK_END3;
|
|
6960
|
+
var F_GETLK2, F_SETLK2, F_SETLKW2, F_RDLCK2, F_WRLCK2, F_UNLCK2, SEEK_SET, SEEK_CUR3, SEEK_END3, LOCK_NB, FLOCK_OPS;
|
|
6955
6961
|
var init_slicc_lock = __esm({
|
|
6956
6962
|
"src/process/wasi/slicc-lock.ts"() {
|
|
6957
6963
|
"use strict";
|
|
@@ -6965,6 +6971,8 @@ var init_slicc_lock = __esm({
|
|
|
6965
6971
|
SEEK_SET = 0;
|
|
6966
6972
|
SEEK_CUR3 = 1;
|
|
6967
6973
|
SEEK_END3 = 2;
|
|
6974
|
+
LOCK_NB = 4;
|
|
6975
|
+
FLOCK_OPS = { 1: "shared", 2: "exclusive", 8: "unlock" };
|
|
6968
6976
|
}
|
|
6969
6977
|
});
|
|
6970
6978
|
|
|
@@ -7414,12 +7422,12 @@ var init_wasi_fds = __esm({
|
|
|
7414
7422
|
dup(fd, min, cloexec) {
|
|
7415
7423
|
const e = this.get(fd);
|
|
7416
7424
|
let at;
|
|
7417
|
-
if (e.type
|
|
7425
|
+
if (e.type !== "file") {
|
|
7418
7426
|
at = this.kernel.call({ op: "fd-dup", fd, min: Math.max(3, min) });
|
|
7419
7427
|
this.table.set(at, { ...e });
|
|
7420
7428
|
} else {
|
|
7421
|
-
|
|
7422
|
-
at = this.install(e
|
|
7429
|
+
e.file.refs++;
|
|
7430
|
+
at = this.install(e, min);
|
|
7423
7431
|
}
|
|
7424
7432
|
if (cloexec) this.setCloexec(at, true);
|
|
7425
7433
|
this.bump(at);
|
|
@@ -7444,11 +7452,15 @@ var init_wasi_fds = __esm({
|
|
|
7444
7452
|
}
|
|
7445
7453
|
this.bump();
|
|
7446
7454
|
}
|
|
7447
|
-
|
|
7455
|
+
promote(fd) {
|
|
7456
|
+
const e = this.get(fd);
|
|
7457
|
+
if (e.type === "file") this.promoteFiles(e.file.buffer);
|
|
7458
|
+
}
|
|
7459
|
+
promoteFiles(only) {
|
|
7448
7460
|
const promoted = /* @__PURE__ */ new Map();
|
|
7449
7461
|
const handed = /* @__PURE__ */ new Set();
|
|
7450
7462
|
for (const [fd, e] of [...this.table]) {
|
|
7451
|
-
if (e.type !== "file") continue;
|
|
7463
|
+
if (e.type !== "file" || only && e.file.buffer !== only) continue;
|
|
7452
7464
|
const first = promoted.get(e.file);
|
|
7453
7465
|
if (first !== void 0) {
|
|
7454
7466
|
this.kernel.call({ op: "fd-promote", fd, share: first });
|
|
@@ -9142,7 +9154,9 @@ var init_wasi_host = __esm({
|
|
|
9142
9154
|
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
9143
9155
|
},
|
|
9144
9156
|
locked: () => this.fds.holdLocks(),
|
|
9157
|
+
promote: (fd) => this.fds.promote(fd),
|
|
9145
9158
|
calls: {
|
|
9159
|
+
flock: (fd, kind, wait2) => void this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} }),
|
|
9146
9160
|
set: (target, kind, start2, len, wait2) => void this.o.kernel.call({
|
|
9147
9161
|
op: "lk-set",
|
|
9148
9162
|
...target,
|
|
@@ -9624,7 +9638,8 @@ var init_wasi_host = __esm({
|
|
|
9624
9638
|
size: () => file.size()
|
|
9625
9639
|
};
|
|
9626
9640
|
}
|
|
9627
|
-
if (e.type !== "kernel"
|
|
9641
|
+
if (e.type !== "kernel") throw new WasiError("EBADF");
|
|
9642
|
+
if (this.fds.kind(fd, e) !== "file") return { target: { fd }, offset: () => 0, size: () => 0 };
|
|
9628
9643
|
return {
|
|
9629
9644
|
target: { fd },
|
|
9630
9645
|
offset: () => this.o.kernel.sys.seek(fd, 0, WHENCE.CUR),
|