@ai-ecoverse/slicc-kernel 1.121.1 → 1.122.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 +8 -0
- package/dist/kernel-worker.js +1 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +38 -3
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +1 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +42 -7
- package/dist/process-worker.js.map +3 -3
- package/dist/types/process/process-fds.d.ts +1 -0
- package/dist/types/process/process-locks.d.ts +6 -0
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -2553,7 +2553,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2553
2553
|
var init_version = __esm({
|
|
2554
2554
|
"src/version.ts"() {
|
|
2555
2555
|
"use strict";
|
|
2556
|
-
KERNEL_VERSION = true ? "1.
|
|
2556
|
+
KERNEL_VERSION = true ? "1.122.0" : "0.0.0-dev";
|
|
2557
2557
|
OS_RELEASE = "6.0.0-slicc";
|
|
2558
2558
|
}
|
|
2559
2559
|
});
|
|
@@ -2650,7 +2650,24 @@ function closeDropsLocks(Fs, kernel) {
|
|
|
2650
2650
|
}
|
|
2651
2651
|
};
|
|
2652
2652
|
}
|
|
2653
|
-
|
|
2653
|
+
function kernelFlock(deps) {
|
|
2654
|
+
return (fd, op) => {
|
|
2655
|
+
const kind = FLOCK_KINDS[op & ~LOCK_NB];
|
|
2656
|
+
if (!kind) return -wasiErrno("EINVAL");
|
|
2657
|
+
const Fs = deps.fs();
|
|
2658
|
+
const stream = Fs?.getStream(fd);
|
|
2659
|
+
if (!Fs || !stream) return -wasiErrno("EBADF");
|
|
2660
|
+
if (stream.sliccKernelFd === void 0) lockPromoters.get(Fs)?.()(stream);
|
|
2661
|
+
if (stream.sliccKernelFd === void 0) return 0;
|
|
2662
|
+
try {
|
|
2663
|
+
deps.flock(stream.sliccKernelFd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
2664
|
+
return 0;
|
|
2665
|
+
} catch (err) {
|
|
2666
|
+
return -errnoOf(err);
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
var F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_WRLCK, F_UNLCK, SEEK_CUR2, SEEK_END2, O_ACCMODE2, O_RDONLY, O_WRONLY, lockPromoters, held, LOCK_NB, FLOCK_KINDS;
|
|
2654
2671
|
var init_process_locks = __esm({
|
|
2655
2672
|
"src/process/process-locks.ts"() {
|
|
2656
2673
|
"use strict";
|
|
@@ -2669,6 +2686,12 @@ var init_process_locks = __esm({
|
|
|
2669
2686
|
O_WRONLY = 1;
|
|
2670
2687
|
lockPromoters = /* @__PURE__ */ new WeakMap();
|
|
2671
2688
|
held = /* @__PURE__ */ new WeakMap();
|
|
2689
|
+
LOCK_NB = 4;
|
|
2690
|
+
FLOCK_KINDS = {
|
|
2691
|
+
1: "shared",
|
|
2692
|
+
2: "exclusive",
|
|
2693
|
+
8: "unlock"
|
|
2694
|
+
};
|
|
2672
2695
|
}
|
|
2673
2696
|
});
|
|
2674
2697
|
|
|
@@ -3568,7 +3591,8 @@ var init_process_fds = __esm({
|
|
|
3568
3591
|
resizeHeap: "emscripten_resize_heap",
|
|
3569
3592
|
fdWrite: "fd_write",
|
|
3570
3593
|
fdRead: "fd_read",
|
|
3571
|
-
sleepMs: "slicc_sleep_ms"
|
|
3594
|
+
sleepMs: "slicc_sleep_ms",
|
|
3595
|
+
flock: "__syscall_flock"
|
|
3572
3596
|
};
|
|
3573
3597
|
UTIME_NOW = 1073741823;
|
|
3574
3598
|
UTIME_OMIT = 1073741822;
|
|
@@ -5692,6 +5716,9 @@ function kernelSys(transport) {
|
|
|
5692
5716
|
closeLocks(target) {
|
|
5693
5717
|
call2({ op: "lk-close", ...target }, "lk-close");
|
|
5694
5718
|
},
|
|
5719
|
+
flock(fd, kind, wait2) {
|
|
5720
|
+
call2({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} }, `flock ${fd}`);
|
|
5721
|
+
},
|
|
5695
5722
|
ptyNumber(fd) {
|
|
5696
5723
|
return json2(call2({ op: "pty-number", fd }, `pty-number ${fd}`));
|
|
5697
5724
|
},
|
|
@@ -5825,6 +5852,13 @@ function kernelWrappers(imports, module, deps) {
|
|
|
5825
5852
|
kernelLink(imports, fsOf, memory, kernelGlue);
|
|
5826
5853
|
devCreations(imports, fsOf, memory, kernelGlue);
|
|
5827
5854
|
kernelUname(imports, hostnameOf(init.env), memory, kernelGlue);
|
|
5855
|
+
wrapImport(
|
|
5856
|
+
imports,
|
|
5857
|
+
"flock",
|
|
5858
|
+
kernelGlue,
|
|
5859
|
+
() => kernelFlock({ fs: fsOf, flock: (fd, kind, wait2) => sys.flock?.(fd, kind, wait2) }),
|
|
5860
|
+
true
|
|
5861
|
+
);
|
|
5828
5862
|
const glue = ownValue(module, "sliccFdImports");
|
|
5829
5863
|
syncFsync(imports, fsOf, glue);
|
|
5830
5864
|
positionalIo(imports, { glue, fs: fsOf, sys, memory });
|
|
@@ -6158,6 +6192,7 @@ var init_process_runtime = __esm({
|
|
|
6158
6192
|
" fdWrite: typeof _fd_write === 'function' ? _fd_write : undefined,",
|
|
6159
6193
|
" fdRead: typeof _fd_read === 'function' ? _fd_read : undefined,",
|
|
6160
6194
|
" sleepMs: typeof slicc_sleep_ms === 'function' ? slicc_sleep_ms : undefined,",
|
|
6195
|
+
" flock: typeof __syscall_flock === 'function' ? __syscall_flock : undefined,",
|
|
6161
6196
|
"};",
|
|
6162
6197
|
"Module.sliccFdImports ??= {",
|
|
6163
6198
|
" fd_sync: typeof _fd_sync === 'function' ? _fd_sync : undefined,",
|
|
@@ -6966,9 +7001,9 @@ function lockImports(host) {
|
|
|
6966
7001
|
return {
|
|
6967
7002
|
flock: (fd, op) => {
|
|
6968
7003
|
host.promote(fd);
|
|
6969
|
-
const kind = FLOCK_OPS[op & ~
|
|
7004
|
+
const kind = FLOCK_OPS[op & ~LOCK_NB2];
|
|
6970
7005
|
if (!kind) throw new WasiError("EINVAL");
|
|
6971
|
-
const shared = host.calls.flock(fd, kind, kind !== "unlock" && (op &
|
|
7006
|
+
const shared = host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB2) === 0);
|
|
6972
7007
|
if (kind !== "unlock" && shared === true) host.reread(fd);
|
|
6973
7008
|
},
|
|
6974
7009
|
fcntl_lock: (fd, cmd, at) => {
|
|
@@ -6994,7 +7029,7 @@ function lockImports(host) {
|
|
|
6994
7029
|
}
|
|
6995
7030
|
};
|
|
6996
7031
|
}
|
|
6997
|
-
var F_GETLK2, F_SETLK2, F_SETLKW2, F_RDLCK2, F_WRLCK2, F_UNLCK2, SEEK_SET, SEEK_CUR3, SEEK_END3,
|
|
7032
|
+
var F_GETLK2, F_SETLK2, F_SETLKW2, F_RDLCK2, F_WRLCK2, F_UNLCK2, SEEK_SET, SEEK_CUR3, SEEK_END3, LOCK_NB2, FLOCK_OPS;
|
|
6998
7033
|
var init_slicc_lock = __esm({
|
|
6999
7034
|
"src/process/wasi/slicc-lock.ts"() {
|
|
7000
7035
|
"use strict";
|
|
@@ -7008,7 +7043,7 @@ var init_slicc_lock = __esm({
|
|
|
7008
7043
|
SEEK_SET = 0;
|
|
7009
7044
|
SEEK_CUR3 = 1;
|
|
7010
7045
|
SEEK_END3 = 2;
|
|
7011
|
-
|
|
7046
|
+
LOCK_NB2 = 4;
|
|
7012
7047
|
FLOCK_OPS = { 1: "shared", 2: "exclusive", 8: "unlock" };
|
|
7013
7048
|
}
|
|
7014
7049
|
});
|