@ai-ecoverse/slicc-kernel 1.54.0 → 1.54.2
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 +1 -1
- package/dist/kernel-worker.js +13 -2
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +46 -11
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +17 -3
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +46 -11
- package/dist/process-worker.js.map +3 -3
- package/package.json +3 -2
|
@@ -1760,7 +1760,7 @@ function readTermios(mem, ptr) {
|
|
|
1760
1760
|
c_cc: Array.from({ length: NCCS }, (_, i) => v.getUint8(ptr + C_CC + i))
|
|
1761
1761
|
};
|
|
1762
1762
|
}
|
|
1763
|
-
function sliccTty(mem, fds, kernel) {
|
|
1763
|
+
function sliccTty(mem, fds, kernel, interrupted = () => void 0) {
|
|
1764
1764
|
const { sys } = kernel;
|
|
1765
1765
|
const terminal = (fd) => {
|
|
1766
1766
|
const e = fds.find(fd);
|
|
@@ -1772,13 +1772,19 @@ function sliccTty(mem, fds, kernel) {
|
|
|
1772
1772
|
if (value2 === void 0) throw new WasiError("ENOTTY");
|
|
1773
1773
|
return value2;
|
|
1774
1774
|
};
|
|
1775
|
+
const getAttr = (fd, ptr) => {
|
|
1776
|
+
interrupted();
|
|
1777
|
+
writeTermios(mem, ptr, needs(sys.tcgets?.(terminal(fd))));
|
|
1778
|
+
};
|
|
1775
1779
|
const setAttr = (fd, actions, ptr) => {
|
|
1780
|
+
interrupted();
|
|
1776
1781
|
if (actions < 0 || actions > TCSAFLUSH) throw new WasiError("EINVAL");
|
|
1777
1782
|
const at = terminal(fd);
|
|
1778
1783
|
needs(sys.tcsets);
|
|
1779
1784
|
sys.tcsets?.(at, readTermios(mem, ptr), actions === TCSAFLUSH);
|
|
1780
1785
|
};
|
|
1781
1786
|
const size = (fd, ptr) => {
|
|
1787
|
+
interrupted();
|
|
1782
1788
|
const [rows, cols] = needs(sys.winsize?.(terminal(fd)));
|
|
1783
1789
|
mem.bytes(ptr, 8).fill(0);
|
|
1784
1790
|
const v = mem.view();
|
|
@@ -1786,7 +1792,7 @@ function sliccTty(mem, fds, kernel) {
|
|
|
1786
1792
|
v.setUint16(ptr + 2, cols, true);
|
|
1787
1793
|
};
|
|
1788
1794
|
return {
|
|
1789
|
-
tcgetattr: (fd, ptr) => void
|
|
1795
|
+
tcgetattr: (fd, ptr) => void getAttr(fd, ptr),
|
|
1790
1796
|
tcsetattr: (fd, actions, ptr) => void setAttr(fd, actions, ptr),
|
|
1791
1797
|
winsize: (fd, ptr) => void size(fd, ptr)
|
|
1792
1798
|
};
|
|
@@ -1935,7 +1941,7 @@ var init_wasi_host = __esm({
|
|
|
1935
1941
|
if (umask !== DEFAULT_UMASK) this.o.fs.chmod(path, mode & ~umask);
|
|
1936
1942
|
}
|
|
1937
1943
|
sliccTtyImports() {
|
|
1938
|
-
return wrap(sliccTty(this.mem, this.fds, this.o.kernel));
|
|
1944
|
+
return wrap(sliccTty(this.mem, this.fds, this.o.kernel, () => this.interrupted?.()));
|
|
1939
1945
|
}
|
|
1940
1946
|
sliccFsImports() {
|
|
1941
1947
|
const { mem, fds } = this;
|
|
@@ -2156,6 +2162,7 @@ var init_wasi_host = __esm({
|
|
|
2156
2162
|
return {
|
|
2157
2163
|
path_open: (dirfd, _lookup, p, l, oflags, rights, _inheriting, fdflags, out) => {
|
|
2158
2164
|
const path = at(dirfd, p, l);
|
|
2165
|
+
if (deviceOf(path)) this.interrupted?.();
|
|
2159
2166
|
const fresh = (oflags & OFLAGS.CREAT) !== 0 && !o.fs.exists(path);
|
|
2160
2167
|
mem.view().setUint32(out, fds.open(path, oflags, rights, fdflags), true);
|
|
2161
2168
|
if (fresh) this.created(path, 438);
|
|
@@ -2271,7 +2278,9 @@ var init_wasi_host = __esm({
|
|
|
2271
2278
|
}
|
|
2272
2279
|
positional(fd, access) {
|
|
2273
2280
|
const e = this.fds.get(fd);
|
|
2274
|
-
|
|
2281
|
+
const kind = e.type === "kernel" ? this.fds.kind(fd, e) : e.type;
|
|
2282
|
+
if (kind === "device") this.interrupted?.();
|
|
2283
|
+
if (kind !== "file" || e.type !== "kernel") return this.file(fd, access);
|
|
2275
2284
|
const kernel = this.o.kernel;
|
|
2276
2285
|
return {
|
|
2277
2286
|
pread: (max, at) => {
|
|
@@ -2299,6 +2308,7 @@ var init_wasi_host = __esm({
|
|
|
2299
2308
|
}
|
|
2300
2309
|
}
|
|
2301
2310
|
if (e.type === "device") {
|
|
2311
|
+
this.interrupted?.();
|
|
2302
2312
|
if (e.access === "read") throw new WasiError("EBADF");
|
|
2303
2313
|
if (e.device === "full" && data.length > 0) throw new WasiError("ENOSPC");
|
|
2304
2314
|
return data.length;
|
|
@@ -2311,6 +2321,7 @@ var init_wasi_host = __esm({
|
|
|
2311
2321
|
return this.o.kernel.sys.read(fd, Math.min(max, MAX_READ), { nonblock: e.nonblock });
|
|
2312
2322
|
}
|
|
2313
2323
|
if (e.type === "device") {
|
|
2324
|
+
this.interrupted?.();
|
|
2314
2325
|
if (e.access === "write") throw new WasiError("EBADF");
|
|
2315
2326
|
if (e.device === "null") return new Uint8Array(0);
|
|
2316
2327
|
const out = new Uint8Array(Math.min(max, 65536));
|
|
@@ -2318,15 +2329,19 @@ var init_wasi_host = __esm({
|
|
|
2318
2329
|
}
|
|
2319
2330
|
return this.file(fd, "read").read(max);
|
|
2320
2331
|
}
|
|
2332
|
+
local(answer2) {
|
|
2333
|
+
this.interrupted?.();
|
|
2334
|
+
return answer2;
|
|
2335
|
+
}
|
|
2321
2336
|
seek(fd, offset, whence) {
|
|
2322
2337
|
const e = this.fds.get(fd);
|
|
2323
2338
|
if (e.type === "kernel") {
|
|
2324
2339
|
const kind = this.fds.kind(fd, e);
|
|
2325
|
-
if (kind === "device") return 0;
|
|
2340
|
+
if (kind === "device") return this.local(0);
|
|
2326
2341
|
if (kind !== "file") throw new WasiError("ESPIPE");
|
|
2327
2342
|
return this.o.kernel.sys.seek(fd, offset, whence);
|
|
2328
2343
|
}
|
|
2329
|
-
if (e.type === "device") return 0;
|
|
2344
|
+
if (e.type === "device") return this.local(0);
|
|
2330
2345
|
const file = this.file(fd);
|
|
2331
2346
|
const base = whence === WHENCE.SET ? 0 : whence === WHENCE.CUR ? file.offset : file.size();
|
|
2332
2347
|
if (whence > WHENCE.END || base + offset < 0) throw new WasiError("EINVAL");
|
|
@@ -2336,15 +2351,23 @@ var init_wasi_host = __esm({
|
|
|
2336
2351
|
sync(fd) {
|
|
2337
2352
|
const e = this.fds.get(fd);
|
|
2338
2353
|
if (e.type === "file") e.file.flush();
|
|
2339
|
-
else if (e.type === "
|
|
2354
|
+
else if (e.type === "device") this.interrupted?.();
|
|
2355
|
+
else if (e.type === "kernel") {
|
|
2356
|
+
const kind = this.fds.kind(fd, e);
|
|
2357
|
+
if (kind === "file") this.o.kernel.sys.flush(fd);
|
|
2358
|
+
else if (kind === "device") this.interrupted?.();
|
|
2359
|
+
}
|
|
2340
2360
|
}
|
|
2341
2361
|
fdstat(fd, out) {
|
|
2342
2362
|
const e = this.fds.get(fd);
|
|
2363
|
+
if (e.type === "device") this.interrupted?.();
|
|
2343
2364
|
let filetype = FILETYPE.CHARACTER_DEVICE;
|
|
2344
2365
|
let seeks = true;
|
|
2345
2366
|
let flags = 0;
|
|
2346
2367
|
if (e.type === "kernel") {
|
|
2347
|
-
|
|
2368
|
+
const kind = this.fds.kind(fd, e);
|
|
2369
|
+
if (kind === "device") this.interrupted?.();
|
|
2370
|
+
({ filetype, seeks } = kernelFiletype(kind));
|
|
2348
2371
|
if (e.nonblock) flags |= FDFLAGS.NONBLOCK;
|
|
2349
2372
|
if (e.append) flags |= FDFLAGS.APPEND;
|
|
2350
2373
|
} else if (e.type === "file") {
|
|
@@ -2379,7 +2402,7 @@ var init_wasi_host = __esm({
|
|
|
2379
2402
|
if (vfs.path) return this.statOrphanable(vfs.path, vfs.size, vfs.orphan);
|
|
2380
2403
|
}
|
|
2381
2404
|
const filetype = kind ? kernelFiletype(kind).filetype : FILETYPE.CHARACTER_DEVICE;
|
|
2382
|
-
return { filetype, size: 0n, ino: BigInt(fd + 1), mtimeNs: 0n };
|
|
2405
|
+
return this.local({ filetype, size: 0n, ino: BigInt(fd + 1), mtimeNs: 0n });
|
|
2383
2406
|
}
|
|
2384
2407
|
statOrphanable(path, size, orphan = false) {
|
|
2385
2408
|
let s;
|
|
@@ -2396,7 +2419,12 @@ var init_wasi_host = __esm({
|
|
|
2396
2419
|
}
|
|
2397
2420
|
pathFilestat(path, lookup) {
|
|
2398
2421
|
if (deviceOf(path)) {
|
|
2399
|
-
return
|
|
2422
|
+
return this.local({
|
|
2423
|
+
filetype: FILETYPE.CHARACTER_DEVICE,
|
|
2424
|
+
size: 0n,
|
|
2425
|
+
ino: pathInode(path),
|
|
2426
|
+
mtimeNs: 0n
|
|
2427
|
+
});
|
|
2400
2428
|
}
|
|
2401
2429
|
this.fds.flushPath(path);
|
|
2402
2430
|
const follow2 = (lookup & LOOKUP_SYMLINK_FOLLOW) !== 0;
|
|
@@ -3564,7 +3592,11 @@ function dataResponse(request) {
|
|
|
3564
3592
|
if (type.startsWith(";")) type = `text/plain${type}`;
|
|
3565
3593
|
const response = new Response(
|
|
3566
3594
|
request.method === "HEAD" ? null : body,
|
|
3567
|
-
{
|
|
3595
|
+
{
|
|
3596
|
+
status: 200,
|
|
3597
|
+
statusText: "OK",
|
|
3598
|
+
headers: { "content-type": mimeType(type) ?? "text/plain;charset=US-ASCII" }
|
|
3599
|
+
}
|
|
3568
3600
|
);
|
|
3569
3601
|
return withMeta(response, url, false);
|
|
3570
3602
|
}
|
|
@@ -7556,6 +7588,7 @@ var init_process_signals = __esm({
|
|
|
7556
7588
|
}
|
|
7557
7589
|
}
|
|
7558
7590
|
interrupt() {
|
|
7591
|
+
this.report();
|
|
7559
7592
|
const header = this.header;
|
|
7560
7593
|
const pending = Atomics.load(header, SAB_I_SIGNALS) | Atomics.load(header, SAB_I_TIMERS) | Atomics.load(header, SAB_I_KILLED);
|
|
7561
7594
|
if (pending === 0) return false;
|
|
@@ -10671,6 +10704,7 @@ var init_wasix_host = __esm({
|
|
|
10671
10704
|
}
|
|
10672
10705
|
ttyGet(ptr) {
|
|
10673
10706
|
const { host, mem } = this;
|
|
10707
|
+
host.interrupted?.();
|
|
10674
10708
|
const v = mem.view();
|
|
10675
10709
|
mem.bytes(ptr, 24).fill(0);
|
|
10676
10710
|
const fd = this.ttyFd();
|
|
@@ -10690,6 +10724,7 @@ var init_wasix_host = __esm({
|
|
|
10690
10724
|
v.setUint8(ptr + 20, termios && termios.c_lflag & ICANON2 ? 1 : 0);
|
|
10691
10725
|
}
|
|
10692
10726
|
ttySet(ptr) {
|
|
10727
|
+
this.host.interrupted?.();
|
|
10693
10728
|
const fd = this.ttyFd();
|
|
10694
10729
|
if (fd === void 0) throw new WasiError("ENOTTY");
|
|
10695
10730
|
const { sys } = this.host.o.kernel;
|