Optionalcallbacks: KernelCallbacksReadonlyframebuffersPID for this kernel instance (set by the worker)
Currently-configured /dev/dsp channel count (1 = mono, 2 = stereo).
0 if the kernel isn't instantiated yet.
Bytes currently buffered in the /dev/dsp ring. Lets the host
estimate how much audio is queued ahead of the AudioContext clock.
Currently-configured /dev/dsp sample rate (Hz). 0 if the kernel
isn't instantiated yet.
Drain up to out.byteLength bytes of PCM audio buffered in
/dev/dsp into the host-provided buffer. Returns the number of
bytes copied. Reads stop at whole-frame boundaries so the host
never receives a torn L/R pair.
Returns 0 if the kernel hasn't been instantiated, no scratch buffer can be allocated, or the ring is empty — the caller doesn't have to special-case any of those.
Duplicate fd with flags. Unlike dup2, returns error if oldfd == newfd.
Change file mode via fd.
Change file owner/group via fd.
Synchronize file data to storage (alias for fsync in Wasm).
Synchronize file state to storage.
Truncate file to specified length.
Access the Wasm instance (e.g. to call exported functions).
Access the Wasm memory (e.g. for tests or advanced use).
Get process group ID.
Get resource usage. Returns 144-byte rusage struct.
Returns all registered shared pipes (for transferring during exec).
Get session ID.
Get a socket option value.
Load and instantiate the kernel Wasm module.
The compiled kernel Wasm binary
Like init(), but uses an existing shared WebAssembly.Memory instead of creating a new one. Used by thread workers that share the parent's memory.
Push one PS/2 mouse packet into the kernel's /dev/input/mice
queue. Silently dropped if the kernel module hasn't been
instantiated yet — a canvas can fire mousemove before the program
registers the device. dy is in PS/2 sense (positive-up); the
caller must invert browser deltaY before calling.
Perform an ioctl operation. For TIOCGWINSZ (0x5413): returns 8-byte buffer (ws_row, ws_col, ws_xpixel, ws_ypixel as u16 LE) For TIOCSWINSZ (0x5414): pass 8-byte buffer to set window size
Optionalbuf: Uint8Array<ArrayBufferLike>Merge additional callbacks into the existing set. Existing callbacks not specified in the argument are preserved.
Create pipe with flags (O_NONBLOCK, O_CLOEXEC). Returns [readFd, writeFd].
Poll file descriptors for I/O readiness. Returns array of {fd, events, revents} with revents filled in.
Receive data from a connected socket. Returns the received data.
select() — synchronous I/O multiplexing. Takes fd arrays for read/write/except monitoring, returns arrays of ready fds.
Send data on a connected socket. Returns bytes sent.
Set effective group ID.
Set effective user ID.
Set real and effective group ID.
Set process group ID.
Set the user program's indirect function table so signal handlers registered by the program can be called from the kernel.
Create new session.
Set a socket option value.
Set real and effective user ID.
Shut down part of a full-duplex socket connection.
Set signal handler (legacy API). Returns previous handler value. handler: 0=SIG_DFL, 1=SIG_IGN, or function pointer index
Create a socket. Returns the fd or throws on error.
Create a connected pair of Unix domain stream sockets. Returns [fd0, fd1].
Get configurable system variable value.
Get terminal attributes (48 bytes: c_iflag, c_oflag, c_cflag, c_lflag + c_cc).
Set terminal attributes. action: 0=TCSANOW, 1=TCSADRAIN, 2=TCSAFLUSH
Truncate a file by path to specified length.
Set file creation mask. Returns previous mask.
Get system identification. Returns object with sysname, nodename, release, version, machine.
Live
/dev/fb0mappings the kernel has reported viahost_bind_framebuffer. Renderers (canvas in browser, no-op in Node) read this on each frame.