@ai-ecoverse/slicc-kernel 1.102.6 → 1.103.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 +1 -1
- package/dist/kernel-worker.js +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +1 -1
- package/dist/process-worker.js +1 -1
- package/dist/types/body-idle.d.ts +3 -0
- package/dist/types/bytes.d.ts +1 -0
- package/dist/types/cdp/facade.d.ts +27 -0
- package/dist/types/cdp/hosts.d.ts +14 -0
- package/dist/types/cdp/port.d.ts +24 -0
- package/dist/types/cdp/types.d.ts +12 -0
- package/dist/types/cdp/websocket.d.ts +61 -0
- package/dist/types/client/attach.d.ts +132 -0
- package/dist/types/client/dial-stream.d.ts +23 -0
- package/dist/types/client/loopback-fetch.d.ts +5 -0
- package/dist/types/client/protocol.d.ts +153 -0
- package/dist/types/client/serve-client.d.ts +18 -0
- package/dist/types/clipboard-relay.d.ts +25 -0
- package/dist/types/commands.d.ts +38 -0
- package/dist/types/cron/clock.d.ts +13 -0
- package/dist/types/driver.d.ts +3 -0
- package/dist/types/facade/hosts.d.ts +12 -0
- package/dist/types/facade/port.d.ts +16 -0
- package/dist/types/facade/types.d.ts +23 -0
- package/dist/types/fs/access.d.ts +29 -0
- package/dist/types/fs/attest.d.ts +41 -0
- package/dist/types/fs/changes.d.ts +19 -0
- package/dist/types/fs/commands.d.ts +4 -0
- package/dist/types/fs/dac.d.ts +64 -0
- package/dist/types/fs/dev-removal.d.ts +9 -0
- package/dist/types/fs/fresh-modules.d.ts +9 -0
- package/dist/types/fs/integrity.d.ts +53 -0
- package/dist/types/fs/meta.d.ts +85 -0
- package/dist/types/fs/opfs.d.ts +141 -0
- package/dist/types/fs/owners.d.ts +17 -0
- package/dist/types/fs/pages.d.ts +41 -0
- package/dist/types/fs/path-map.d.ts +16 -0
- package/dist/types/fs/physical-path.d.ts +14 -0
- package/dist/types/fs/protect.d.ts +27 -0
- package/dist/types/fs/ranged.d.ts +73 -0
- package/dist/types/fs/remote.d.ts +45 -0
- package/dist/types/fs/types.d.ts +115 -0
- package/dist/types/fs/unlinked.d.ts +75 -0
- package/dist/types/fs/view.d.ts +1 -0
- package/dist/types/fs/walk.d.ts +12 -0
- package/dist/types/fs/watch.d.ts +23 -0
- package/dist/types/index.d.ts +159 -0
- package/dist/types/integrity-relay.d.ts +18 -0
- package/dist/types/kernel/children.d.ts +90 -0
- package/dist/types/kernel/clipboard.d.ts +49 -0
- package/dist/types/kernel/cpu-clock.d.ts +56 -0
- package/dist/types/kernel/cred.d.ts +17 -0
- package/dist/types/kernel/dgram.d.ts +56 -0
- package/dist/types/kernel/dial.d.ts +20 -0
- package/dist/types/kernel/epoll.d.ts +67 -0
- package/dist/types/kernel/eventfd.d.ts +19 -0
- package/dist/types/kernel/exec-ticket.d.ts +25 -0
- package/dist/types/kernel/fd-table.d.ts +107 -0
- package/dist/types/kernel/host-ops.d.ts +98 -0
- package/dist/types/kernel/host.d.ts +116 -0
- package/dist/types/kernel/jobs.d.ts +50 -0
- package/dist/types/kernel/locks.d.ts +40 -0
- package/dist/types/kernel/net/datagram-wire.d.ts +8 -0
- package/dist/types/kernel/net/http-syscalls.d.ts +58 -0
- package/dist/types/kernel/net/http1.d.ts +48 -0
- package/dist/types/kernel/net/loopback-names.d.ts +14 -0
- package/dist/types/kernel/net/loopback-transport.d.ts +13 -0
- package/dist/types/kernel/net/network.d.ts +29 -0
- package/dist/types/kernel/net/proxy-service.d.ts +70 -0
- package/dist/types/kernel/net/realm-ca.d.ts +28 -0
- package/dist/types/kernel/net/redirect-hops.d.ts +5 -0
- package/dist/types/kernel/net/remote-transport.d.ts +98 -0
- package/dist/types/kernel/net/resolver.d.ts +29 -0
- package/dist/types/kernel/net/routes.d.ts +15 -0
- package/dist/types/kernel/net/tls-engine.d.ts +46 -0
- package/dist/types/kernel/net/tls-tunnel.d.ts +35 -0
- package/dist/types/kernel/net/transport.d.ts +64 -0
- package/dist/types/kernel/net/uplink-socket.d.ts +11 -0
- package/dist/types/kernel/net/uplink.d.ts +163 -0
- package/dist/types/kernel/net/ws-queue.d.ts +21 -0
- package/dist/types/kernel/net/ws-syscalls.d.ts +45 -0
- package/dist/types/kernel/net/x509.d.ts +34 -0
- package/dist/types/kernel/pipe.d.ts +29 -0
- package/dist/types/kernel/proc-info.d.ts +44 -0
- package/dist/types/kernel/process.d.ts +525 -0
- package/dist/types/kernel/protocol.d.ts +126 -0
- package/dist/types/kernel/pty.d.ts +84 -0
- package/dist/types/kernel/run-child.d.ts +39 -0
- package/dist/types/kernel/scrub-file.d.ts +13 -0
- package/dist/types/kernel/sealed.d.ts +74 -0
- package/dist/types/kernel/select.d.ts +7 -0
- package/dist/types/kernel/sem.d.ts +72 -0
- package/dist/types/kernel/settling.d.ts +16 -0
- package/dist/types/kernel/signals.d.ts +44 -0
- package/dist/types/kernel/socket-syscalls.d.ts +74 -0
- package/dist/types/kernel/socket.d.ts +125 -0
- package/dist/types/kernel/timer.d.ts +4 -0
- package/dist/types/kernel/tty.d.ts +53 -0
- package/dist/types/kernel/vfs-file.d.ts +149 -0
- package/dist/types/launcher.d.ts +359 -0
- package/dist/types/local-proxy-transport.d.ts +39 -0
- package/dist/types/meta.d.ts +11 -0
- package/dist/types/mount/chunked.d.ts +9 -0
- package/dist/types/mount/connection.d.ts +35 -0
- package/dist/types/mount/driver.d.ts +50 -0
- package/dist/types/mount/fsa.d.ts +26 -0
- package/dist/types/mount/fstab.d.ts +17 -0
- package/dist/types/mount/host.d.ts +24 -0
- package/dist/types/mount/hostfs.d.ts +129 -0
- package/dist/types/mount/media.d.ts +8 -0
- package/dist/types/mount/medium.d.ts +12 -0
- package/dist/types/mount/mount-fs.d.ts +136 -0
- package/dist/types/mount/protocol.d.ts +140 -0
- package/dist/types/mount/syscall.d.ts +27 -0
- package/dist/types/mount/tmpfs.d.ts +2 -0
- package/dist/types/node/loopback.d.ts +11 -0
- package/dist/types/node/memory-root.d.ts +2 -0
- package/dist/types/node/ws-diagnose.d.ts +4 -0
- package/dist/types/node.d.ts +85 -0
- package/dist/types/process/fd-metadata.d.ts +4 -0
- package/dist/types/process/js/async-sab.d.ts +15 -0
- package/dist/types/process/js/js-children.d.ts +63 -0
- package/dist/types/process/js/js-context.d.ts +133 -0
- package/dist/types/process/js/js-dev.d.ts +50 -0
- package/dist/types/process/js/js-exit.d.ts +15 -0
- package/dist/types/process/js/js-fetch.d.ts +2 -0
- package/dist/types/process/js/js-io.d.ts +81 -0
- package/dist/types/process/js/js-kernel.d.ts +61 -0
- package/dist/types/process/js/js-net.d.ts +42 -0
- package/dist/types/process/js/js-proc.d.ts +31 -0
- package/dist/types/process/js/js-run.d.ts +35 -0
- package/dist/types/process/js/js-sync.d.ts +86 -0
- package/dist/types/process/js/js-tty.d.ts +30 -0
- package/dist/types/process/js/js-websocket.d.ts +21 -0
- package/dist/types/process/kernel-streams.d.ts +196 -0
- package/dist/types/process/process-fds.d.ts +95 -0
- package/dist/types/process/process-locks.d.ts +29 -0
- package/dist/types/process/process-pty.d.ts +20 -0
- package/dist/types/process/process-signals.d.ts +33 -0
- package/dist/types/process/procfs.d.ts +41 -0
- package/dist/types/process/wasi/dylink.d.ts +9 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +26 -0
- package/dist/types/process/wasi/slicc-sem.d.ts +3 -0
- package/dist/types/process/wasi/wasi-abi.d.ts +156 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +130 -0
- package/dist/types/process/wasi/wasi-files.d.ts +99 -0
- package/dist/types/process/wasi/wasi-host.d.ts +104 -0
- package/dist/types/process/wasi/wasi-memory.d.ts +16 -0
- package/dist/types/process/wasi/wasi-module.d.ts +13 -0
- package/dist/types/process/wasi/wasi-poll.d.ts +13 -0
- package/dist/types/process/wasi/wasi-procfs.d.ts +36 -0
- package/dist/types/process/wasi/wasi-sigmask.d.ts +19 -0
- package/dist/types/process/wasi/wasi-signals.d.ts +43 -0
- package/dist/types/process/wasi/wasi-termios.d.ts +10 -0
- package/dist/types/process/wasi/wasix-fork.d.ts +63 -0
- package/dist/types/process/wasi/wasix-linker.d.ts +108 -0
- package/dist/types/process/wasi/wasix-sockets.d.ts +9 -0
- package/dist/types/process/wasi/wasix-trampoline.d.ts +18 -0
- package/dist/types/process/wasi/wasm-functypes.d.ts +25 -0
- package/dist/types/process/wasi-errno.d.ts +1 -0
- package/dist/types/realm/emscripten-vfs-hook.d.ts +19 -0
- package/dist/types/realm/live-vfs-fs.d.ts +186 -0
- package/dist/types/realm/sync-fs-dispatch.d.ts +26 -0
- package/dist/types/realm/sync-fs-token-registry.d.ts +36 -0
- package/dist/types/realm/sync-fs-wire.d.ts +118 -0
- package/dist/types/realm/sync-sab-bridge.d.ts +21 -0
- package/dist/types/realm/sync-sab-responder.d.ts +16 -0
- package/dist/types/realm/sync-sab-wire.d.ts +64 -0
- package/dist/types/sealed-relay.d.ts +26 -0
- package/dist/types/serve.d.ts +190 -0
- package/dist/types/sudo-command.d.ts +4 -0
- package/dist/types/sudo.d.ts +105 -0
- package/dist/types/testing.d.ts +46 -0
- package/dist/types/transport.d.ts +25 -0
- package/dist/types/users.d.ts +86 -0
- package/dist/types/version.d.ts +3 -0
- package/dist/types/websocket-transport.d.ts +12 -0
- package/package.json +22 -6
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { HeldMeta, PollState } from '../kernel/fd-table.js';
|
|
2
|
+
import type { MountLine, ProcessListing } from '../kernel/proc-info.js';
|
|
3
|
+
import type { Termios } from '../kernel/tty.js';
|
|
4
|
+
import type { EmscriptenFsForHook } from '../realm/emscripten-vfs-hook.js';
|
|
5
|
+
export declare const O_NONBLOCK = 2048;
|
|
6
|
+
export declare class ProcessExit extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
constructor(status: number);
|
|
9
|
+
}
|
|
10
|
+
export declare class SyscallError extends Error {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
constructor(code: string);
|
|
13
|
+
}
|
|
14
|
+
export interface ReadOptions {
|
|
15
|
+
nonblock?: boolean;
|
|
16
|
+
peek?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ProcessSys {
|
|
19
|
+
read(fd: number, max: number, opts?: ReadOptions): Uint8Array;
|
|
20
|
+
write(fd: number, bytes: Uint8Array, opts?: {
|
|
21
|
+
nonblock?: boolean;
|
|
22
|
+
}): number;
|
|
23
|
+
close(fd: number): void;
|
|
24
|
+
pipe(): [number, number];
|
|
25
|
+
poll(fd: number): PollState;
|
|
26
|
+
openVfs(path: string, flags: number, position: number, opts?: {
|
|
27
|
+
contents?: Uint8Array;
|
|
28
|
+
orphan?: boolean;
|
|
29
|
+
truncate?: boolean;
|
|
30
|
+
create?: boolean;
|
|
31
|
+
created?: boolean;
|
|
32
|
+
pin?: {
|
|
33
|
+
version: string;
|
|
34
|
+
size: number;
|
|
35
|
+
};
|
|
36
|
+
handle?: number;
|
|
37
|
+
}): number;
|
|
38
|
+
seek(fd: number, offset: number, whence: number): number;
|
|
39
|
+
flush(fd: number): void;
|
|
40
|
+
pread?(fd: number, max: number, at: number): Uint8Array;
|
|
41
|
+
pwrite?(fd: number, bytes: Uint8Array, at: number): number;
|
|
42
|
+
isatty?(fd: number): boolean;
|
|
43
|
+
ttyName?(fd: number): string | undefined;
|
|
44
|
+
kind?(fd: number): string | undefined;
|
|
45
|
+
heldMeta?(fd: number): HeldMeta | undefined;
|
|
46
|
+
access?(fd: number): 'read' | 'write' | undefined;
|
|
47
|
+
size?(fd: number): number;
|
|
48
|
+
fdStat?(fd: number): object | undefined;
|
|
49
|
+
fdChmod?(fd: number, mode: number): void;
|
|
50
|
+
fdChown?(fd: number, uid: number | undefined, gid: number | undefined): void;
|
|
51
|
+
fdUtimes?(fd: number, atimeMs: number | null, mtimeMs: number | null, now: boolean): void;
|
|
52
|
+
openTty?(name?: string): number;
|
|
53
|
+
ttyNames?(): string[];
|
|
54
|
+
ttyOwner?(name: string): TtyOwner | null;
|
|
55
|
+
tcgets?(fd: number): Termios;
|
|
56
|
+
tcsets?(fd: number, termios: Termios, flush?: boolean): void;
|
|
57
|
+
winsize?(fd: number): [number, number];
|
|
58
|
+
openPty?(): number;
|
|
59
|
+
openPts?(n: number, noctty: boolean): number;
|
|
60
|
+
ptyNumbers?(): number[];
|
|
61
|
+
openSealed?(flags: number): number;
|
|
62
|
+
openClipboard?(flags: number): number;
|
|
63
|
+
clipboardAbort?(fd: number): void;
|
|
64
|
+
procList?(): ProcessListing;
|
|
65
|
+
mountList?(): MountLine[];
|
|
66
|
+
}
|
|
67
|
+
export interface StreamOps {
|
|
68
|
+
getattr?: (stream: ProcessStream) => object;
|
|
69
|
+
llseek?: (stream: ProcessStream, offset: number, whence: number) => number;
|
|
70
|
+
read?: (stream: ProcessStream, buffer: Uint8Array, offset: number, length: number) => number;
|
|
71
|
+
write?: (stream: ProcessStream, buffer: Uint8Array, offset: number, length: number) => number;
|
|
72
|
+
close?: (stream: ProcessStream) => void;
|
|
73
|
+
dup?: (stream: ProcessStream) => void;
|
|
74
|
+
poll?: (stream: ProcessStream) => number;
|
|
75
|
+
fsync?: (stream: ProcessStream) => unknown;
|
|
76
|
+
mmap?: unknown;
|
|
77
|
+
}
|
|
78
|
+
export interface ProcessStream {
|
|
79
|
+
fd: number;
|
|
80
|
+
stream_ops: StreamOps;
|
|
81
|
+
sliccKernelFd?: number;
|
|
82
|
+
sliccKernelFile?: boolean;
|
|
83
|
+
sliccCloexec?: boolean;
|
|
84
|
+
sliccKernelSocket?: boolean;
|
|
85
|
+
path?: string;
|
|
86
|
+
flags: number;
|
|
87
|
+
position: number;
|
|
88
|
+
tty?: unknown;
|
|
89
|
+
node: {
|
|
90
|
+
mode: number;
|
|
91
|
+
mount?: {
|
|
92
|
+
type?: unknown;
|
|
93
|
+
};
|
|
94
|
+
node_ops?: {
|
|
95
|
+
getattr?: (node: ProcessStream['node']) => object;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
shared: object;
|
|
99
|
+
}
|
|
100
|
+
export interface ProcessFs extends EmscriptenFsForHook {
|
|
101
|
+
streams: (ProcessStream | null | undefined)[];
|
|
102
|
+
getStream(fd: number): ProcessStream | null;
|
|
103
|
+
open(path: string, flags: number, mode?: number): ProcessStream;
|
|
104
|
+
dupStream(stream: ProcessStream, fd: number): ProcessStream;
|
|
105
|
+
closeStream(fd: number): void;
|
|
106
|
+
close?(stream: ProcessStream): void;
|
|
107
|
+
isFile(mode: number): boolean;
|
|
108
|
+
mkdirTree(path: string): void;
|
|
109
|
+
cwd(): string;
|
|
110
|
+
read(stream: ProcessStream, buffer: Uint8Array, offset: number, length: number, position?: number): number;
|
|
111
|
+
write(stream: ProcessStream, buffer: Uint8Array, offset: number, length: number): number;
|
|
112
|
+
stat?(path: string, dontFollow?: boolean): object;
|
|
113
|
+
writeFile?(path: string, data: string | Uint8Array): void;
|
|
114
|
+
fstat?(fd: number): object;
|
|
115
|
+
symlink?(target: string, path: string): void;
|
|
116
|
+
lookupPath?(path: string, opts?: {
|
|
117
|
+
follow?: boolean;
|
|
118
|
+
}): {
|
|
119
|
+
node: object;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface ProcessPipeFs {
|
|
123
|
+
createPipe(): {
|
|
124
|
+
readable_fd: number;
|
|
125
|
+
writable_fd: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export interface KernelStreamOptions {
|
|
129
|
+
sigpipe?: () => boolean;
|
|
130
|
+
restartable?: () => boolean;
|
|
131
|
+
owners?: boolean;
|
|
132
|
+
program?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface TtyOwner {
|
|
135
|
+
uid: number;
|
|
136
|
+
gid: number;
|
|
137
|
+
mode?: number;
|
|
138
|
+
}
|
|
139
|
+
export declare class KernelStreams {
|
|
140
|
+
private readonly refs;
|
|
141
|
+
private socketRoot;
|
|
142
|
+
private sockets;
|
|
143
|
+
private readonly descriptions;
|
|
144
|
+
private described;
|
|
145
|
+
private readonly Fs;
|
|
146
|
+
private readonly sys;
|
|
147
|
+
private readonly options;
|
|
148
|
+
constructor(Fs: ProcessFs, sys: ProcessSys, options?: KernelStreamOptions);
|
|
149
|
+
attach(stream: ProcessStream, kfd: number, terminal?: boolean): void;
|
|
150
|
+
attachSocket(stream: ProcessStream, kfd: number): void;
|
|
151
|
+
socketStream(flags: number): ProcessStream;
|
|
152
|
+
nameTerminal(stream: ProcessStream): void;
|
|
153
|
+
private nameStream;
|
|
154
|
+
nameDevice(stream: ProcessStream, kind: 'sealed' | 'clipboard'): void;
|
|
155
|
+
private listSealed;
|
|
156
|
+
private openNode;
|
|
157
|
+
private readonly reporting;
|
|
158
|
+
reportClose(kfd: number): void;
|
|
159
|
+
quitting: boolean;
|
|
160
|
+
private atExit;
|
|
161
|
+
private failedAtExit;
|
|
162
|
+
private readonly committed;
|
|
163
|
+
exiting(): () => void;
|
|
164
|
+
private commitStdout;
|
|
165
|
+
exitStatus(status: number): number;
|
|
166
|
+
private reportedClose;
|
|
167
|
+
private stdoutFailed;
|
|
168
|
+
private creatingTerminal;
|
|
169
|
+
private useTerminalNodes;
|
|
170
|
+
private ttyNode;
|
|
171
|
+
private ttyOps;
|
|
172
|
+
attachFile(stream: ProcessStream, kfd: number): void;
|
|
173
|
+
sizeFromKernel(stream: ProcessStream, kfd: number): void;
|
|
174
|
+
describe(stream: ProcessStream, name: string, getattr: () => object): void;
|
|
175
|
+
private useDescriptions;
|
|
176
|
+
useKernelFdMetadata(): void;
|
|
177
|
+
useControllingTerminal(): void;
|
|
178
|
+
private openRacing;
|
|
179
|
+
private refuseExclusiveLink;
|
|
180
|
+
private openPty;
|
|
181
|
+
private openSealed;
|
|
182
|
+
private openClipboard;
|
|
183
|
+
private vessel;
|
|
184
|
+
private usePtyPaths;
|
|
185
|
+
private ownedTty;
|
|
186
|
+
private owned;
|
|
187
|
+
private existingPty;
|
|
188
|
+
private devicePath;
|
|
189
|
+
private terminalExists;
|
|
190
|
+
private openNamedTerminal;
|
|
191
|
+
private stdioTerminal;
|
|
192
|
+
usePipes(pipefs: ProcessPipeFs): void;
|
|
193
|
+
private restarting;
|
|
194
|
+
private call;
|
|
195
|
+
private ops;
|
|
196
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { MountLine } from '../kernel/proc-info.js';
|
|
2
|
+
import type { ProcessFs, ProcessStream, ProcessSys } from './kernel-streams.js';
|
|
3
|
+
import { type LockDeps } from './process-locks.js';
|
|
4
|
+
import { type PtyKernel } from './process-pty.js';
|
|
5
|
+
export declare const O_CLOEXEC = 524288;
|
|
6
|
+
type CloexecStream = Pick<ProcessStream, 'sliccCloexec'>;
|
|
7
|
+
export declare function closesOnExec(stream: CloexecStream): boolean;
|
|
8
|
+
export declare function setCloseOnExec(stream: CloexecStream, on: boolean): void;
|
|
9
|
+
export declare function trackCloseOnExec(Fs: ProcessFs): void;
|
|
10
|
+
export type GlueSyscall = (...args: number[]) => number;
|
|
11
|
+
export interface GlueSyscalls {
|
|
12
|
+
fcntl?: GlueSyscall;
|
|
13
|
+
pipe2?: GlueSyscall;
|
|
14
|
+
dup3?: GlueSyscall;
|
|
15
|
+
socket?: GlueSyscall;
|
|
16
|
+
accept4?: GlueSyscall;
|
|
17
|
+
ioctl?: GlueSyscall;
|
|
18
|
+
setitimer?: GlueSyscall;
|
|
19
|
+
}
|
|
20
|
+
export interface CloexecDeps {
|
|
21
|
+
fs(): ProcessFs | undefined;
|
|
22
|
+
heap(): Int32Array | undefined;
|
|
23
|
+
pty?: PtyKernel;
|
|
24
|
+
timer?: {
|
|
25
|
+
arm(ms: number): void;
|
|
26
|
+
};
|
|
27
|
+
locks?: Omit<LockDeps, 'fs'>;
|
|
28
|
+
}
|
|
29
|
+
export declare function wrapCloexecSyscalls(imports: WebAssembly.Imports, glue: GlueSyscalls | undefined, deps: CloexecDeps): void;
|
|
30
|
+
export declare function pathOpensLinks(Fs: ProcessFs): void;
|
|
31
|
+
type Syscall = (...args: number[]) => number;
|
|
32
|
+
export interface KernelImports {
|
|
33
|
+
openat?: unknown;
|
|
34
|
+
mkdirat?: unknown;
|
|
35
|
+
mknodat?: unknown;
|
|
36
|
+
umask?: unknown;
|
|
37
|
+
faccessat?: unknown;
|
|
38
|
+
linkat?: unknown;
|
|
39
|
+
symlinkat?: unknown;
|
|
40
|
+
uname?: unknown;
|
|
41
|
+
utimensat?: unknown;
|
|
42
|
+
getppid?: unknown;
|
|
43
|
+
resizeHeap?: unknown;
|
|
44
|
+
fdWrite?: unknown;
|
|
45
|
+
fdRead?: unknown;
|
|
46
|
+
sleepMs?: unknown;
|
|
47
|
+
}
|
|
48
|
+
export declare function importKey(namespace: WebAssembly.ModuleImports, name: keyof KernelImports, glue: KernelImports | undefined): string | undefined;
|
|
49
|
+
export declare function wrapImport(imports: WebAssembly.Imports, name: keyof KernelImports, glue: KernelImports | undefined, wrap: (original: Syscall) => Syscall, optional?: boolean): void;
|
|
50
|
+
export interface UmaskDeps {
|
|
51
|
+
initial: number;
|
|
52
|
+
memory(): WebAssembly.Memory | undefined;
|
|
53
|
+
set(mask: number): void;
|
|
54
|
+
glue?: KernelImports | undefined;
|
|
55
|
+
}
|
|
56
|
+
export declare function kernelUmask(imports: WebAssembly.Imports, deps: UmaskDeps): void;
|
|
57
|
+
export declare function noFollowUtimes(imports: WebAssembly.Imports, fs: () => ProcessFs | undefined, glue?: unknown, memory?: () => WebAssembly.Memory | undefined): void;
|
|
58
|
+
export interface FdImports {
|
|
59
|
+
fd_sync?: unknown;
|
|
60
|
+
fd_pread?: unknown;
|
|
61
|
+
fd_pwrite?: unknown;
|
|
62
|
+
}
|
|
63
|
+
export declare function syncFsync(imports: WebAssembly.Imports, fs: () => ProcessFs | undefined, glue?: FdImports): void;
|
|
64
|
+
interface PositionalDeps {
|
|
65
|
+
glue?: FdImports | undefined;
|
|
66
|
+
fs: () => ProcessFs | undefined;
|
|
67
|
+
sys: Pick<ProcessSys, 'pread' | 'pwrite'>;
|
|
68
|
+
memory: () => WebAssembly.Memory | undefined;
|
|
69
|
+
}
|
|
70
|
+
export declare function positionalIo(imports: WebAssembly.Imports, deps: PositionalDeps): void;
|
|
71
|
+
export type Memalign = (alignment: number, size: number) => number;
|
|
72
|
+
export interface MmapDeps {
|
|
73
|
+
sys: Pick<ProcessSys, 'pread'>;
|
|
74
|
+
memory: () => WebAssembly.Memory | undefined;
|
|
75
|
+
memalign: () => Memalign | undefined;
|
|
76
|
+
}
|
|
77
|
+
export declare function useFileMmap(Fs: ProcessFs, deps: MmapDeps): void;
|
|
78
|
+
export declare function wasmMemory(instance: WebAssembly.Instance, imports: WebAssembly.Imports): WebAssembly.Memory | undefined;
|
|
79
|
+
export declare function fdOfPath(path: string, cwd: string): number | undefined;
|
|
80
|
+
export declare function useZeroDevices(Fs: ProcessFs): void;
|
|
81
|
+
export declare function useDevRemoval(Fs: ProcessFs): void;
|
|
82
|
+
export declare function useDevFd(Fs: ProcessFs): void;
|
|
83
|
+
export declare function pinRootKind(): void;
|
|
84
|
+
export declare function mountTable(mounts?: MountLine[]): string;
|
|
85
|
+
export declare function accounts(env?: Record<string, string>): {
|
|
86
|
+
passwd: string;
|
|
87
|
+
group: string;
|
|
88
|
+
};
|
|
89
|
+
export declare function useMounts(Fs: ProcessFs, env?: Record<string, string>, live?: boolean): void;
|
|
90
|
+
export declare function kernelAccess(imports: WebAssembly.Imports, fs: () => ProcessFs | undefined, memory: () => WebAssembly.Memory | undefined, glue?: KernelImports): void;
|
|
91
|
+
export declare function kernelLink(imports: WebAssembly.Imports, fs: () => ProcessFs | undefined, memory: () => WebAssembly.Memory | undefined, glue?: KernelImports): void;
|
|
92
|
+
export declare function devCreations(imports: WebAssembly.Imports, fs: () => ProcessFs | undefined, memory: () => WebAssembly.Memory | undefined, glue?: KernelImports): void;
|
|
93
|
+
export declare function kernelUname(imports: WebAssembly.Imports, hostname: string, memory: () => WebAssembly.Memory | undefined, glue?: KernelImports): void;
|
|
94
|
+
export declare function linuxDevices(Fs: ProcessFs): void;
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProcessFs, ProcessStream } from './kernel-streams.js';
|
|
2
|
+
export declare const F_GETLK = 12;
|
|
3
|
+
export declare const F_SETLK = 13;
|
|
4
|
+
export declare const F_SETLKW = 14;
|
|
5
|
+
export type LockKind = 'read' | 'write';
|
|
6
|
+
export interface LockTarget {
|
|
7
|
+
path?: string;
|
|
8
|
+
fd?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface LockHeld {
|
|
11
|
+
kind: LockKind;
|
|
12
|
+
pid: number;
|
|
13
|
+
start: number;
|
|
14
|
+
len: number;
|
|
15
|
+
}
|
|
16
|
+
export interface LockKernel {
|
|
17
|
+
setLock(target: LockTarget, kind: LockKind | 'unlock', start: number, len: number, wait: boolean): void;
|
|
18
|
+
getLock(target: LockTarget, kind: LockKind, start: number, len: number): LockHeld | null;
|
|
19
|
+
closeLocks(target: LockTarget): void;
|
|
20
|
+
}
|
|
21
|
+
export interface LockDeps {
|
|
22
|
+
fs(): ProcessFs | undefined;
|
|
23
|
+
memory(): ArrayBufferLike | undefined;
|
|
24
|
+
kernel: LockKernel;
|
|
25
|
+
flush(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function lockTarget(stream: ProcessStream): LockTarget | undefined;
|
|
28
|
+
export declare function recordLock(fcntl: (fd: number, cmd: number, varargs: number) => number, deps: LockDeps): (fd: number, cmd: number, varargs: number) => number;
|
|
29
|
+
export declare function closeDropsLocks(Fs: ProcessFs, kernel: LockKernel): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProcessFs } from './kernel-streams.js';
|
|
2
|
+
import type { GlueSyscall } from './process-fds.js';
|
|
3
|
+
export declare const TIOCGPTN = 2147767344;
|
|
4
|
+
export declare const TIOCSPTLCK = 1074025521;
|
|
5
|
+
export declare const TIOCSCTTY = 21518;
|
|
6
|
+
export declare const TIOCSWINSZ = 21524;
|
|
7
|
+
export declare const TIOCPKT = 21536;
|
|
8
|
+
export interface PtyKernel {
|
|
9
|
+
ptyNumber(kfd: number): number;
|
|
10
|
+
ptyLock(kfd: number, lock: boolean): void;
|
|
11
|
+
setControllingTerminal(kfd: number): void;
|
|
12
|
+
setPacketMode(kfd: number, on: boolean): void;
|
|
13
|
+
setWinsize(kfd: number, rows: number, cols: number): void;
|
|
14
|
+
}
|
|
15
|
+
export interface PtyIoctlDeps {
|
|
16
|
+
fs(): ProcessFs | undefined;
|
|
17
|
+
heap(): Int32Array | undefined;
|
|
18
|
+
kernel: PtyKernel;
|
|
19
|
+
}
|
|
20
|
+
export declare function ptyIoctl(ioctl: GlueSyscall, deps: PtyIoctlDeps): GlueSyscall;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SyncSabTransport } from '../realm/sync-sab-bridge.js';
|
|
2
|
+
export interface SignalHooks {
|
|
3
|
+
masks(): {
|
|
4
|
+
caught: number;
|
|
5
|
+
ignored: number;
|
|
6
|
+
restart: number;
|
|
7
|
+
defaults?: number;
|
|
8
|
+
} | null;
|
|
9
|
+
raise(sig: number): void;
|
|
10
|
+
timer?(which: number): void;
|
|
11
|
+
killed?(code: number): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class SignalGate {
|
|
14
|
+
private reported;
|
|
15
|
+
private restart;
|
|
16
|
+
private lastDelivered;
|
|
17
|
+
private depth;
|
|
18
|
+
private reporting;
|
|
19
|
+
private unwinding;
|
|
20
|
+
private quieted;
|
|
21
|
+
private delivered;
|
|
22
|
+
private readonly raw;
|
|
23
|
+
private readonly header;
|
|
24
|
+
private readonly hooks;
|
|
25
|
+
constructor(raw: SyncSabTransport, header: Int32Array, hooks: SignalHooks);
|
|
26
|
+
transport(): SyncSabTransport;
|
|
27
|
+
deliveries(): number;
|
|
28
|
+
restartable(): boolean;
|
|
29
|
+
private report;
|
|
30
|
+
quiet<T>(fn: () => T): T;
|
|
31
|
+
interrupt(): boolean;
|
|
32
|
+
deliver(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MountLine, ProcessInfo, ProcessListing } from '../kernel/proc-info.js';
|
|
2
|
+
export declare const PID_FILES: readonly ['cmdline', 'comm', 'stat', 'statm', 'status'];
|
|
3
|
+
export declare const SYSTEM_FILES: readonly ['loadavg', 'meminfo', 'stat', 'uptime', 'version'];
|
|
4
|
+
export interface ProcSysTree {
|
|
5
|
+
readonly [name: string]: string | ProcSysTree;
|
|
6
|
+
}
|
|
7
|
+
export declare const SYS_TREE: ProcSysTree;
|
|
8
|
+
export declare function sysEntry(parts: readonly string[]): string | ProcSysTree | undefined;
|
|
9
|
+
type PidFile = (typeof PID_FILES)[number];
|
|
10
|
+
type SystemFile = (typeof SYSTEM_FILES)[number];
|
|
11
|
+
export interface ProcSys {
|
|
12
|
+
procList?(): ProcessListing;
|
|
13
|
+
mountList?(): MountLine[];
|
|
14
|
+
}
|
|
15
|
+
export interface MemorySource {
|
|
16
|
+
deviceMemory?: number;
|
|
17
|
+
usedHeap?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function commOf(info: ProcessInfo): string;
|
|
20
|
+
export declare function ttyNumber(tty: string | null): number;
|
|
21
|
+
export declare function pidStat(info: ProcessInfo, boot: number, state?: string): string;
|
|
22
|
+
export declare function taskStat(info: ProcessInfo, tid: number, boot: number): string | undefined;
|
|
23
|
+
export declare function taskIds(info: ProcessInfo): number[];
|
|
24
|
+
export declare function pidStatus(info: ProcessInfo): string;
|
|
25
|
+
export declare function pidFile(name: PidFile, info: ProcessInfo, boot: number): string;
|
|
26
|
+
export declare function memoryInfo(source: MemorySource, used?: number): string;
|
|
27
|
+
export declare function systemFile(name: SystemFile, listing: ProcessListing, now: number, memory: MemorySource): string;
|
|
28
|
+
export declare function memorySource(scope?: object): MemorySource;
|
|
29
|
+
export interface ProcFs {
|
|
30
|
+
lookupPath?(path: string, opts?: {
|
|
31
|
+
follow?: boolean;
|
|
32
|
+
}): {
|
|
33
|
+
node: object;
|
|
34
|
+
};
|
|
35
|
+
createNode?(parent: object, name: string, mode: number, rdev: number): object;
|
|
36
|
+
hashRemoveNode?(node: object): void;
|
|
37
|
+
streams?: unknown[];
|
|
38
|
+
ErrnoError: new (errno: number) => Error;
|
|
39
|
+
}
|
|
40
|
+
export declare function useProcfs(Fs: ProcFs, sys: ProcSys, pid: number, memory?: MemorySource): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LockHeld, LockKind, LockTarget } from '../process-locks.js';
|
|
2
|
+
import type { WasiFunction } from './wasi-host.js';
|
|
3
|
+
import type { WasiMemory } from './wasi-memory.js';
|
|
4
|
+
export declare const F_GETLK = 12;
|
|
5
|
+
export declare const F_SETLK = 13;
|
|
6
|
+
export declare const F_SETLKW = 14;
|
|
7
|
+
export interface LockedFile {
|
|
8
|
+
target: LockTarget;
|
|
9
|
+
path?: string;
|
|
10
|
+
readable?: boolean;
|
|
11
|
+
writable?: boolean;
|
|
12
|
+
offset(): number;
|
|
13
|
+
size(): number;
|
|
14
|
+
}
|
|
15
|
+
export interface LockCalls {
|
|
16
|
+
set(target: LockTarget, kind: LockKind | 'unlock', start: number, len: number, wait: boolean): void;
|
|
17
|
+
get(target: LockTarget, kind: LockKind, start: number, len: number): LockHeld | null;
|
|
18
|
+
}
|
|
19
|
+
export interface LockHost {
|
|
20
|
+
mem: WasiMemory;
|
|
21
|
+
file(fd: number): LockedFile;
|
|
22
|
+
flush(file: LockedFile): void;
|
|
23
|
+
locked(): void;
|
|
24
|
+
calls: LockCalls;
|
|
25
|
+
}
|
|
26
|
+
export declare function lockImports(host: LockHost): Record<string, WasiFunction>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export declare const E: {
|
|
2
|
+
readonly SUCCESS: 0;
|
|
3
|
+
readonly '2BIG': 1;
|
|
4
|
+
readonly ACCES: 2;
|
|
5
|
+
readonly ADDRINUSE: 3;
|
|
6
|
+
readonly ADDRNOTAVAIL: 4;
|
|
7
|
+
readonly AFNOSUPPORT: 5;
|
|
8
|
+
readonly AGAIN: 6;
|
|
9
|
+
readonly ALREADY: 7;
|
|
10
|
+
readonly BADF: 8;
|
|
11
|
+
readonly BADMSG: 9;
|
|
12
|
+
readonly BUSY: 10;
|
|
13
|
+
readonly CANCELED: 11;
|
|
14
|
+
readonly CHILD: 12;
|
|
15
|
+
readonly CONNABORTED: 13;
|
|
16
|
+
readonly CONNREFUSED: 14;
|
|
17
|
+
readonly CONNRESET: 15;
|
|
18
|
+
readonly DEADLK: 16;
|
|
19
|
+
readonly DESTADDRREQ: 17;
|
|
20
|
+
readonly DOM: 18;
|
|
21
|
+
readonly DQUOT: 19;
|
|
22
|
+
readonly EXIST: 20;
|
|
23
|
+
readonly FAULT: 21;
|
|
24
|
+
readonly FBIG: 22;
|
|
25
|
+
readonly HOSTUNREACH: 23;
|
|
26
|
+
readonly IDRM: 24;
|
|
27
|
+
readonly ILSEQ: 25;
|
|
28
|
+
readonly INPROGRESS: 26;
|
|
29
|
+
readonly INTR: 27;
|
|
30
|
+
readonly INVAL: 28;
|
|
31
|
+
readonly IO: 29;
|
|
32
|
+
readonly ISCONN: 30;
|
|
33
|
+
readonly ISDIR: 31;
|
|
34
|
+
readonly LOOP: 32;
|
|
35
|
+
readonly MFILE: 33;
|
|
36
|
+
readonly MLINK: 34;
|
|
37
|
+
readonly MSGSIZE: 35;
|
|
38
|
+
readonly MULTIHOP: 36;
|
|
39
|
+
readonly NAMETOOLONG: 37;
|
|
40
|
+
readonly NETDOWN: 38;
|
|
41
|
+
readonly NETRESET: 39;
|
|
42
|
+
readonly NETUNREACH: 40;
|
|
43
|
+
readonly NFILE: 41;
|
|
44
|
+
readonly NOBUFS: 42;
|
|
45
|
+
readonly NODEV: 43;
|
|
46
|
+
readonly NOENT: 44;
|
|
47
|
+
readonly NOEXEC: 45;
|
|
48
|
+
readonly NOLCK: 46;
|
|
49
|
+
readonly NOLINK: 47;
|
|
50
|
+
readonly NOMEM: 48;
|
|
51
|
+
readonly NOMSG: 49;
|
|
52
|
+
readonly NOPROTOOPT: 50;
|
|
53
|
+
readonly NOSPC: 51;
|
|
54
|
+
readonly NOSYS: 52;
|
|
55
|
+
readonly NOTCONN: 53;
|
|
56
|
+
readonly NOTDIR: 54;
|
|
57
|
+
readonly NOTEMPTY: 55;
|
|
58
|
+
readonly NOTRECOVERABLE: 56;
|
|
59
|
+
readonly NOTSOCK: 57;
|
|
60
|
+
readonly NOTSUP: 58;
|
|
61
|
+
readonly NOTTY: 59;
|
|
62
|
+
readonly NXIO: 60;
|
|
63
|
+
readonly OVERFLOW: 61;
|
|
64
|
+
readonly OWNERDEAD: 62;
|
|
65
|
+
readonly PERM: 63;
|
|
66
|
+
readonly PIPE: 64;
|
|
67
|
+
readonly PROTO: 65;
|
|
68
|
+
readonly PROTONOSUPPORT: 66;
|
|
69
|
+
readonly PROTOTYPE: 67;
|
|
70
|
+
readonly RANGE: 68;
|
|
71
|
+
readonly ROFS: 69;
|
|
72
|
+
readonly SPIPE: 70;
|
|
73
|
+
readonly SRCH: 71;
|
|
74
|
+
readonly STALE: 72;
|
|
75
|
+
readonly TIMEDOUT: 73;
|
|
76
|
+
readonly TXTBSY: 74;
|
|
77
|
+
readonly XDEV: 75;
|
|
78
|
+
readonly NOTCAPABLE: 76;
|
|
79
|
+
};
|
|
80
|
+
export declare function wasiErrnoOf(code: string | undefined): number;
|
|
81
|
+
export declare const FILETYPE: {
|
|
82
|
+
readonly UNKNOWN: 0;
|
|
83
|
+
readonly BLOCK_DEVICE: 1;
|
|
84
|
+
readonly CHARACTER_DEVICE: 2;
|
|
85
|
+
readonly DIRECTORY: 3;
|
|
86
|
+
readonly REGULAR_FILE: 4;
|
|
87
|
+
readonly SOCKET_DGRAM: 5;
|
|
88
|
+
readonly SOCKET_STREAM: 6;
|
|
89
|
+
readonly SYMBOLIC_LINK: 7;
|
|
90
|
+
};
|
|
91
|
+
export declare const RIGHTS: {
|
|
92
|
+
readonly FD_DATASYNC: bigint;
|
|
93
|
+
readonly FD_READ: bigint;
|
|
94
|
+
readonly FD_SEEK: bigint;
|
|
95
|
+
readonly FD_FDSTAT_SET_FLAGS: bigint;
|
|
96
|
+
readonly FD_SYNC: bigint;
|
|
97
|
+
readonly FD_TELL: bigint;
|
|
98
|
+
readonly FD_WRITE: bigint;
|
|
99
|
+
readonly ALL: bigint;
|
|
100
|
+
};
|
|
101
|
+
export declare const OFLAGS: {
|
|
102
|
+
readonly CREAT: 1;
|
|
103
|
+
readonly DIRECTORY: 2;
|
|
104
|
+
readonly EXCL: 4;
|
|
105
|
+
readonly TRUNC: 8;
|
|
106
|
+
};
|
|
107
|
+
export declare const FDFLAGS: {
|
|
108
|
+
readonly APPEND: 1;
|
|
109
|
+
readonly DSYNC: 2;
|
|
110
|
+
readonly NONBLOCK: 4;
|
|
111
|
+
readonly RSYNC: 8;
|
|
112
|
+
readonly SYNC: 16;
|
|
113
|
+
};
|
|
114
|
+
export declare const LOOKUP_SYMLINK_FOLLOW = 1;
|
|
115
|
+
export declare const WHENCE: {
|
|
116
|
+
readonly SET: 0;
|
|
117
|
+
readonly CUR: 1;
|
|
118
|
+
readonly END: 2;
|
|
119
|
+
};
|
|
120
|
+
export declare const CLOCK: {
|
|
121
|
+
readonly REALTIME: 0;
|
|
122
|
+
readonly MONOTONIC: 1;
|
|
123
|
+
readonly PROCESS_CPUTIME: 2;
|
|
124
|
+
readonly THREAD_CPUTIME: 3;
|
|
125
|
+
};
|
|
126
|
+
export declare const FSTFLAGS: {
|
|
127
|
+
readonly ATIM: 1;
|
|
128
|
+
readonly ATIM_NOW: 2;
|
|
129
|
+
readonly MTIM: 4;
|
|
130
|
+
readonly MTIM_NOW: 8;
|
|
131
|
+
};
|
|
132
|
+
export declare const EVENTTYPE: {
|
|
133
|
+
readonly CLOCK: 0;
|
|
134
|
+
readonly FD_READ: 1;
|
|
135
|
+
readonly FD_WRITE: 2;
|
|
136
|
+
};
|
|
137
|
+
export declare const SUBCLOCK_ABSTIME = 1;
|
|
138
|
+
export declare const EVENT_FD_READWRITE_HANGUP = 1;
|
|
139
|
+
export declare const RIFLAGS: {
|
|
140
|
+
readonly PEEK: 1;
|
|
141
|
+
readonly WAITALL: 2;
|
|
142
|
+
};
|
|
143
|
+
export declare const SDFLAGS: {
|
|
144
|
+
readonly RD: 1;
|
|
145
|
+
readonly WR: 2;
|
|
146
|
+
};
|
|
147
|
+
export declare const PREOPENTYPE_DIR = 0;
|
|
148
|
+
export declare const SIZE: {
|
|
149
|
+
readonly FILESTAT: 64;
|
|
150
|
+
readonly FDSTAT: 24;
|
|
151
|
+
readonly DIRENT: 24;
|
|
152
|
+
readonly SUBSCRIPTION: 48;
|
|
153
|
+
readonly EVENT: 32;
|
|
154
|
+
};
|
|
155
|
+
export declare const WASI_SIGNAL_TO_POSIX: Readonly<Record<number, number>>;
|
|
156
|
+
export declare function wasixSignal(sig: number): number | undefined;
|