@ai-ecoverse/slicc-kernel 1.53.1 → 1.53.3
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.
|
@@ -8655,7 +8655,14 @@ var init_dylink = __esm({
|
|
|
8655
8655
|
});
|
|
8656
8656
|
|
|
8657
8657
|
// src/process/wasi/wasi-module.ts
|
|
8658
|
-
|
|
8658
|
+
function libcVersion(module) {
|
|
8659
|
+
for (const section2 of WebAssembly.Module.customSections(module, "slicc.libc")) {
|
|
8660
|
+
const found = LIBC_MARK.exec(new TextDecoder().decode(section2));
|
|
8661
|
+
if (found) return Number(found[1]);
|
|
8662
|
+
}
|
|
8663
|
+
return void 0;
|
|
8664
|
+
}
|
|
8665
|
+
var RESERVED_NAMESPACES, LIBC_MARK;
|
|
8659
8666
|
var init_wasi_module = __esm({
|
|
8660
8667
|
"src/process/wasi/wasi-module.ts"() {
|
|
8661
8668
|
"use strict";
|
|
@@ -8665,6 +8672,7 @@ var init_wasi_module = __esm({
|
|
|
8665
8672
|
"wasi",
|
|
8666
8673
|
"env"
|
|
8667
8674
|
]);
|
|
8675
|
+
LIBC_MARK = /^wasix-sysroot \d{4}\.\d+\.\d+-(\d+)/;
|
|
8668
8676
|
}
|
|
8669
8677
|
});
|
|
8670
8678
|
|
|
@@ -10290,13 +10298,14 @@ function posixSignal(sig) {
|
|
|
10290
10298
|
function nsToMs(ns) {
|
|
10291
10299
|
return Math.ceil(Number(ns) / 1e6);
|
|
10292
10300
|
}
|
|
10293
|
-
var FDFLAGSEXT_CLOEXEC, SPAWN_OP_SIZE, SPAWN_OPS, RIGHTS_FD_WRITE, ICANON2, ECHO2, FUTEX_SLICE_MS, MAIN_HANDLE, WasixHost;
|
|
10301
|
+
var FDFLAGSEXT_CLOEXEC, SPAWN_OP_SIZE, SPAWN_OPS, RIGHTS_FD_WRITE, ICANON2, ECHO2, FUTEX_SLICE_MS, EINTR_LIBC, MAIN_HANDLE, WasixHost;
|
|
10294
10302
|
var init_wasix_host = __esm({
|
|
10295
10303
|
"src/process/wasi/wasix-host.ts"() {
|
|
10296
10304
|
"use strict";
|
|
10297
10305
|
init_wasi_abi();
|
|
10298
10306
|
init_wasi_files();
|
|
10299
10307
|
init_wasi_host();
|
|
10308
|
+
init_wasi_module();
|
|
10300
10309
|
init_wasi_threads();
|
|
10301
10310
|
init_wasix_ffi();
|
|
10302
10311
|
init_wasix_linker();
|
|
@@ -10311,6 +10320,7 @@ var init_wasix_host = __esm({
|
|
|
10311
10320
|
ICANON2 = 2;
|
|
10312
10321
|
ECHO2 = 8;
|
|
10313
10322
|
FUTEX_SLICE_MS = 50;
|
|
10323
|
+
EINTR_LIBC = 22;
|
|
10314
10324
|
MAIN_HANDLE = 2147483647;
|
|
10315
10325
|
WasixHost = class _WasixHost {
|
|
10316
10326
|
process;
|
|
@@ -10331,7 +10341,7 @@ var init_wasix_host = __esm({
|
|
|
10331
10341
|
);
|
|
10332
10342
|
if (module && !WebAssembly.Module.imports(module).some((i) => i.name === "fd_fdflags_set")) {
|
|
10333
10343
|
host.fds.implicitCloexec = true;
|
|
10334
|
-
host.interruptWakes =
|
|
10344
|
+
host.interruptWakes = (libcVersion(module) ?? 0) < EINTR_LIBC;
|
|
10335
10345
|
}
|
|
10336
10346
|
}
|
|
10337
10347
|
get mem() {
|
|
@@ -11325,6 +11335,15 @@ var NODE_SLOTS = [
|
|
|
11325
11335
|
"setImmediate",
|
|
11326
11336
|
"clearImmediate"
|
|
11327
11337
|
];
|
|
11338
|
+
function zeroedBuffers(buffer) {
|
|
11339
|
+
const alloc = buffer.alloc.bind(buffer);
|
|
11340
|
+
const fixed = (value2) => ({ value: value2, writable: false, configurable: false });
|
|
11341
|
+
Object.defineProperties(buffer, {
|
|
11342
|
+
allocUnsafe: fixed((size) => alloc(size)),
|
|
11343
|
+
allocUnsafeSlow: fixed((size) => alloc(size)),
|
|
11344
|
+
poolSize: fixed(0)
|
|
11345
|
+
});
|
|
11346
|
+
}
|
|
11328
11347
|
function refused(specifier) {
|
|
11329
11348
|
return Object.assign(new Error(`slicc-kernel: a JS program cannot import ${specifier}`), {
|
|
11330
11349
|
code: "ERR_ACCESS_DENIED"
|
|
@@ -11341,6 +11360,7 @@ function refuseModules() {
|
|
|
11341
11360
|
});
|
|
11342
11361
|
}
|
|
11343
11362
|
function nodeLockdown(scope2 = globalThis) {
|
|
11363
|
+
zeroedBuffers(Buffer);
|
|
11344
11364
|
lockdown(scope2);
|
|
11345
11365
|
hide(scope2, NODE_GLOBALS);
|
|
11346
11366
|
vacate(scope2, NODE_SLOTS);
|