@ai-ecoverse/slicc-kernel 1.83.0 → 1.84.1
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 +10 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +208 -45
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +27 -5
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +289 -68
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +27 -5
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
|
@@ -4210,6 +4210,13 @@ function brokenPipe(err, info) {
|
|
|
4210
4210
|
function written(r, fallback) {
|
|
4211
4211
|
return r.ok && r.kind === "json" && typeof r.json === "number" ? r.json : fallback;
|
|
4212
4212
|
}
|
|
4213
|
+
function statFsOf(json2) {
|
|
4214
|
+
const usage = parseSyncFsUsage(json2);
|
|
4215
|
+
const blocks = usage ? Math.ceil(usage.quota / BLOCK) : 0;
|
|
4216
|
+
const free = usage ? Math.max(0, Math.floor((usage.quota - usage.usage) / BLOCK)) : 0;
|
|
4217
|
+
const bytes = { quota: usage?.quota ?? 0, usage: usage?.usage ?? 0 };
|
|
4218
|
+
return { type: 0, bsize: BLOCK, blocks, bfree: free, bavail: free, files: 0, ffree: 0, ...bytes };
|
|
4219
|
+
}
|
|
4213
4220
|
function joined(parts, length) {
|
|
4214
4221
|
if (parts.length === 1) return parts[0];
|
|
4215
4222
|
const out = new Uint8Array(length);
|
|
@@ -4253,16 +4260,18 @@ function openRequest(abs, o) {
|
|
|
4253
4260
|
function index2(n, what) {
|
|
4254
4261
|
if (!Number.isSafeInteger(n) || n < 0) throw new JsCallError("EINVAL", what);
|
|
4255
4262
|
}
|
|
4256
|
-
var CHUNK, MAX_IO, O_WRONLY3, O_RDWR3, O_APPEND3;
|
|
4263
|
+
var CHUNK, MAX_IO, O_WRONLY3, O_RDWR3, O_APPEND3, BLOCK;
|
|
4257
4264
|
var init_js_io = __esm({
|
|
4258
4265
|
"src/process/js/js-io.ts"() {
|
|
4259
4266
|
"use strict";
|
|
4267
|
+
init_sync_fs_wire();
|
|
4260
4268
|
init_js_kernel();
|
|
4261
4269
|
CHUNK = 64 * 1024;
|
|
4262
4270
|
MAX_IO = 1024 * 1024;
|
|
4263
4271
|
O_WRONLY3 = 1;
|
|
4264
4272
|
O_RDWR3 = 2;
|
|
4265
4273
|
O_APPEND3 = 1024;
|
|
4274
|
+
BLOCK = 4096;
|
|
4266
4275
|
}
|
|
4267
4276
|
});
|
|
4268
4277
|
|
|
@@ -5648,6 +5657,11 @@ function syncPathOps(kernel, resolve, statOf, open) {
|
|
|
5648
5657
|
if (inDev(abs)) return devSync(kernel, devReadlink(abs));
|
|
5649
5658
|
return String(kernel.json({ op: "readlink", path: abs }));
|
|
5650
5659
|
},
|
|
5660
|
+
statfs(path) {
|
|
5661
|
+
const abs = resolve(path);
|
|
5662
|
+
statOf("stat", abs);
|
|
5663
|
+
return statFsOf(kernel.json({ op: "statfs", path: abs }));
|
|
5664
|
+
},
|
|
5651
5665
|
readFile(path) {
|
|
5652
5666
|
const abs = resolve(path);
|
|
5653
5667
|
if (inDev(abs)) return readWholeSync(open(abs));
|
|
@@ -6345,6 +6359,11 @@ function pathOps(kernel, resolve, statOf, open) {
|
|
|
6345
6359
|
if (inDev(abs)) return devAsync(kernel, devReadlink(abs));
|
|
6346
6360
|
return String(await kernel.json({ op: "readlink", path: abs }));
|
|
6347
6361
|
},
|
|
6362
|
+
async statfs(path) {
|
|
6363
|
+
const abs = resolve(path);
|
|
6364
|
+
await statOf("stat", abs);
|
|
6365
|
+
return statFsOf(await kernel.json({ op: "statfs", path: abs }));
|
|
6366
|
+
},
|
|
6348
6367
|
async readFile(path) {
|
|
6349
6368
|
const abs = resolve(path);
|
|
6350
6369
|
if (inDev(abs)) return readWhole(await open(abs));
|
|
@@ -10169,9 +10188,11 @@ function reportGrowth(imports, publish, glue) {
|
|
|
10169
10188
|
return grown;
|
|
10170
10189
|
});
|
|
10171
10190
|
}
|
|
10172
|
-
function holdWhileStopped(imports, header, glue) {
|
|
10191
|
+
function holdWhileStopped(imports, header, glue, poll = () => void 0) {
|
|
10173
10192
|
const hold = () => {
|
|
10174
10193
|
while (Atomics.load(header, SAB_I_STOP) === 1) Atomics.wait(header, SAB_I_STOP, 1);
|
|
10194
|
+
const due = Atomics.load(header, SAB_I_SIGNALS) | Atomics.load(header, SAB_I_TIMERS) | Atomics.load(header, SAB_I_KILLED);
|
|
10195
|
+
if (due !== 0) poll();
|
|
10175
10196
|
};
|
|
10176
10197
|
for (const name2 of ["fdWrite", "fdRead", "sleepMs"]) {
|
|
10177
10198
|
wrapImport(
|
|
@@ -10179,7 +10200,7 @@ function holdWhileStopped(imports, header, glue) {
|
|
|
10179
10200
|
name2,
|
|
10180
10201
|
glue,
|
|
10181
10202
|
(original) => (...args) => {
|
|
10182
|
-
|
|
10203
|
+
while (Atomics.load(header, SAB_I_STOP) === 1) Atomics.wait(header, SAB_I_STOP, 1);
|
|
10183
10204
|
const done = original(...args);
|
|
10184
10205
|
hold();
|
|
10185
10206
|
return done;
|
|
@@ -10212,7 +10233,7 @@ function kernelWrappers(imports, module, deps) {
|
|
|
10212
10233
|
positionalIo(imports, { glue, fs: fsOf, sys, memory });
|
|
10213
10234
|
const grown = () => publishMemory(init.sab, memory()?.buffer.byteLength ?? 0);
|
|
10214
10235
|
reportGrowth(imports, grown, kernelGlue);
|
|
10215
|
-
holdWhileStopped(imports, new Int32Array(init.sab, 0, SAB_HEADER_I32), kernelGlue);
|
|
10236
|
+
holdWhileStopped(imports, new Int32Array(init.sab, 0, SAB_HEADER_I32), kernelGlue, deps.poll);
|
|
10216
10237
|
}
|
|
10217
10238
|
async function runWasmProcess(init, port3, deps = {}) {
|
|
10218
10239
|
const signals = new SignalGate(
|
|
@@ -10282,7 +10303,8 @@ async function runWasmProcess(init, port3, deps = {}) {
|
|
|
10282
10303
|
transport,
|
|
10283
10304
|
sys,
|
|
10284
10305
|
memory: () => memory,
|
|
10285
|
-
ppid: () => identify(transport, init).ppid
|
|
10306
|
+
ppid: () => identify(transport, init).ppid,
|
|
10307
|
+
poll: () => void signals.interrupt()
|
|
10286
10308
|
});
|
|
10287
10309
|
return WebAssembly.instantiate(init.program.module, imports);
|
|
10288
10310
|
}).then((instance) => {
|