feat: HTML man pages
This commit is contained in:
@@ -0,0 +1,884 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="MontaukOS manual page: syscalls(2) - overview of MontaukOS system calls">
|
||||
<title>syscalls(2) - MontaukOS Manual</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Open Sans', Arial, sans-serif;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 1em;
|
||||
line-height: 1.5;
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
}
|
||||
p { margin: 0 0 0.5em; }
|
||||
h2 { margin: 0.5em 0; }
|
||||
.sidebar {
|
||||
width: 160px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.sidebar li {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
.sidebar a {
|
||||
color: #0066CC;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
.sidebar a:hover {
|
||||
color: #004499;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.sidebar .current {
|
||||
color: #004499;
|
||||
}
|
||||
.sidebar hr {
|
||||
border: none;
|
||||
border-top: 1px solid #999;
|
||||
margin: 0.75em 0;
|
||||
}
|
||||
.main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
a { color: #0000EE; }
|
||||
a:visited { color: #0066CC; }
|
||||
hr { border-style: solid; border-width: 1px 0 0 0; border-color: #999; }
|
||||
pre { background: #f0f0f0; padding: 0.5em; overflow-x: auto; }
|
||||
code { background: #f0f0f0; padding: 0 0.15em; }
|
||||
pre code { padding: 0; }
|
||||
.center { text-align: center; }
|
||||
.box {
|
||||
border: 1px solid #999;
|
||||
padding: 0.5em;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="sidebar">
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a></li>
|
||||
<li><a href="../index.html">Documentation</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<ul>
|
||||
<li><a href="index.html" class="current">Man Pages</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="center">
|
||||
<h1>syscalls(2)</h1>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<pre><code><strong>NAME</strong>
|
||||
syscalls - overview of MontaukOS system calls
|
||||
|
||||
<strong>DESCRIPTION</strong>
|
||||
MontaukOS provides 150 system calls (numbers 0-149, sparsely
|
||||
assigned -- not every number in the range is in use) for
|
||||
userspace programs. Syscalls use the x86-64 SYSCALL instruction
|
||||
with the following register convention:
|
||||
|
||||
RAX Syscall number (in) / return value (out)
|
||||
RDI Argument 1
|
||||
RSI Argument 2
|
||||
RDX Argument 3
|
||||
R10 Argument 4
|
||||
R8 Argument 5
|
||||
R9 Argument 6
|
||||
|
||||
Include <Api/Syscall.hpp> for the numeric SYS_* constants and
|
||||
ABI structs, and <montauk/syscall.h> for typed wrappers in the
|
||||
montauk:: namespace. This page groups syscalls the same way the
|
||||
kernel source does (one subsystem header per group).
|
||||
|
||||
<strong>PROCESS MANAGEMENT</strong>
|
||||
<strong>SYS_EXIT (0)</strong>
|
||||
Terminate the calling process.
|
||||
[[noreturn]] void montauk::exit(int code = 0);
|
||||
|
||||
<strong>SYS_YIELD (1)</strong>
|
||||
Yield the remainder of the time slice.
|
||||
void montauk::yield();
|
||||
|
||||
<strong>SYS_SLEEP_MS (2)</strong>
|
||||
Sleep for at least the given number of milliseconds.
|
||||
void montauk::sleep_ms(uint64_t ms);
|
||||
|
||||
<strong>SYS_GETPID (3)</strong>
|
||||
Return the PID of the calling process.
|
||||
int montauk::getpid();
|
||||
|
||||
<strong>SYS_SPAWN (20)</strong>
|
||||
Spawn a new process from an ELF binary on the VFS.
|
||||
int montauk::spawn(const char* path, const char* args = nullptr);
|
||||
|
||||
<strong>SYS_WAITPID (23)</strong>
|
||||
Block until the given process has exited.
|
||||
void montauk::waitpid(int pid);
|
||||
|
||||
<strong>SYS_GETARGS (25)</strong>
|
||||
Get the argument string passed to this process at spawn time.
|
||||
int montauk::getargs(char* buf, uint64_t maxLen);
|
||||
|
||||
<strong>SYS_PROCLIST (61)</strong>
|
||||
List running processes (pid, parent, state, name, heap usage,
|
||||
accumulated CPU time).
|
||||
int montauk::proclist(montauk::abi::ProcInfo* buf, int max);
|
||||
|
||||
<strong>SYS_KILL (62)</strong>
|
||||
Terminate another process by PID.
|
||||
int montauk::kill(int pid);
|
||||
|
||||
<strong>SYS_CHDIR (96)</strong>
|
||||
Change the calling process's current working directory.
|
||||
int montauk::chdir(const char* path);
|
||||
|
||||
<strong>SYS_GETCWD (95)</strong>
|
||||
Get the calling process's current working directory.
|
||||
int montauk::getcwd(char* buf, uint64_t maxLen);
|
||||
|
||||
<strong>SYS_SETUSER (92)</strong>
|
||||
Associate a process with a logged-in user name (used by login/session
|
||||
management).
|
||||
int montauk::setuser(int pid, const char* name);
|
||||
|
||||
<strong>SYS_GETUSER (93)</strong>
|
||||
Get the user name associated with the calling process.
|
||||
int montauk::getuser(char* buf, uint64_t maxLen);
|
||||
|
||||
<strong>THREADING</strong>
|
||||
Threads share the spawning process's address space and heap
|
||||
(see montauk/heap.h for the heap lock). Declared in
|
||||
montauk/thread.h.
|
||||
|
||||
<strong>SYS_THREAD_SPAWN (130)</strong>
|
||||
Spawn a new thread in the calling process. Returns a positive
|
||||
TID on success, -1 on failure.
|
||||
int montauk::thread_spawn(ThreadEntry entry, void* arg,
|
||||
uint64_t stack_bytes = 0);
|
||||
|
||||
<strong>SYS_THREAD_EXIT (131)</strong>
|
||||
Terminate only the calling thread. If it is the main thread,
|
||||
the whole process exits.
|
||||
[[noreturn]] void montauk::thread_exit(int code = 0);
|
||||
|
||||
<strong>SYS_THREAD_JOIN (132)</strong>
|
||||
Block until the given TID exits, then reclaim its kernel state.
|
||||
int montauk::thread_join(int tid, int* out_code = nullptr);
|
||||
|
||||
<strong>SYS_THREAD_SELF (133)</strong>
|
||||
Return the calling thread's TID (equals getpid() for the main
|
||||
thread).
|
||||
int montauk::thread_self();
|
||||
|
||||
<strong>CONSOLE I/O</strong>
|
||||
<strong>SYS_PRINT (4)</strong>
|
||||
Write a null-terminated string to the terminal.
|
||||
void montauk::print(const char* text);
|
||||
|
||||
<strong>SYS_PUTCHAR (5)</strong>
|
||||
Write a single character to the terminal.
|
||||
void montauk::putchar(char c);
|
||||
|
||||
<strong>FILE I/O</strong>
|
||||
<strong>SYS_OPEN (6)</strong>
|
||||
Open a file. Returns a handle or negative on error.
|
||||
int montauk::open(const char* path);
|
||||
|
||||
<strong>SYS_READ (7)</strong>
|
||||
Read bytes from a file at a given offset.
|
||||
int montauk::read(int h, uint8_t* buf, uint64_t off, uint64_t sz);
|
||||
|
||||
<strong>SYS_GETSIZE (8)</strong>
|
||||
Get the size of an open file in bytes.
|
||||
uint64_t montauk::getsize(int handle);
|
||||
|
||||
<strong>SYS_CLOSE (9)</strong>
|
||||
Close a file handle.
|
||||
void montauk::close(int handle);
|
||||
|
||||
<strong>SYS_READDIR (10)</strong>
|
||||
List directory entries (max 256 per call for VFS directories,
|
||||
128 for driver-backed listings such as 0:/os/). For larger
|
||||
directories use SYS_READDIR_AT.
|
||||
int montauk::readdir(const char* path, const char** names, int max);
|
||||
|
||||
<strong>SYS_READDIR_AT (136)</strong>
|
||||
Paginated directory read. Returns entries starting at
|
||||
startIndex; call repeatedly with startIndex advanced by the
|
||||
returned count until it returns 0 to enumerate directories of
|
||||
any size.
|
||||
int montauk::readdir_at(const char* path, const char** names,
|
||||
int max, int startIndex);
|
||||
|
||||
<strong>SYS_FWRITE (41)</strong>
|
||||
Write bytes to a file at a given offset.
|
||||
int montauk::fwrite(int handle, const uint8_t* buf,
|
||||
uint64_t offset, uint64_t size);
|
||||
|
||||
<strong>SYS_FCREATE (42)</strong>
|
||||
Create a new file on the target volume. Returns a handle or
|
||||
negative on error.
|
||||
int montauk::fcreate(const char* path);
|
||||
|
||||
<strong>SYS_FDELETE (77)</strong>
|
||||
Delete a file.
|
||||
int montauk::fdelete(const char* path);
|
||||
|
||||
<strong>SYS_FMKDIR (78)</strong>
|
||||
Create a directory.
|
||||
int montauk::fmkdir(const char* path);
|
||||
|
||||
<strong>SYS_FRENAME (94)</strong>
|
||||
Rename or move a file/directory (used as the basis for file
|
||||
manager move operations).
|
||||
int montauk::frename(const char* oldPath, const char* newPath);
|
||||
|
||||
<strong>SYS_DRIVELIST (79)</strong>
|
||||
List mounted drive numbers.
|
||||
int montauk::drivelist(int* outDrives, int max);
|
||||
|
||||
<strong>SYS_DRIVELABEL (124)</strong>
|
||||
Get the volume label of a drive.
|
||||
int montauk::drivelabel(int drive, char* outLabel, int maxLen);
|
||||
|
||||
<strong>SYS_DRIVEKIND (127)</strong>
|
||||
Get the block device kind backing a drive: 0=unknown/ramdisk,
|
||||
1=SATA, 2=SATAPI, 3=NVMe, 4=USB mass storage.
|
||||
int montauk::drivekind(int drive);
|
||||
|
||||
<strong>MEMORY</strong>
|
||||
<strong>SYS_ALLOC (11)</strong>
|
||||
Map zeroed pages into the process address space.
|
||||
void* montauk::alloc(uint64_t size);
|
||||
|
||||
<strong>SYS_FREE (12)</strong>
|
||||
Reserved (currently a no-op).
|
||||
void montauk::free(void* ptr);
|
||||
|
||||
<strong>SYS_MEMSTATS (67)</strong>
|
||||
Get kernel-wide physical memory usage (total/free/used bytes,
|
||||
page size).
|
||||
void montauk::memstats(montauk::abi::MemStats* out);
|
||||
|
||||
<strong>TIMEKEEPING</strong>
|
||||
<strong>SYS_GETTICKS (13)</strong>
|
||||
Get APIC timer ticks since boot.
|
||||
uint64_t montauk::get_ticks();
|
||||
|
||||
<strong>SYS_GETMILLISECONDS (14)</strong>
|
||||
Get milliseconds elapsed since boot.
|
||||
uint64_t montauk::get_milliseconds();
|
||||
|
||||
<strong>SYS_GETTIME (28)</strong>
|
||||
Get the current wall-clock date and time (UTC).
|
||||
Fills a montauk::abi::DateTime struct with Year, Month, Day,
|
||||
Hour, Minute, and Second fields.
|
||||
void montauk::gettime(montauk::abi::DateTime* out);
|
||||
|
||||
<strong>SYS_SETTZ (90)</strong>
|
||||
Set the process/system timezone offset, in minutes from UTC.
|
||||
void montauk::settz(int offset_minutes);
|
||||
|
||||
<strong>SYS_GETTZ (91)</strong>
|
||||
Get the current timezone offset, in minutes from UTC.
|
||||
int montauk::gettz();
|
||||
|
||||
<strong>SYSTEM</strong>
|
||||
<strong>SYS_GETINFO (15)</strong>
|
||||
Get OS name, version string, API version, max process count,
|
||||
and the monotonic kernel build number.
|
||||
void montauk::get_info(montauk::abi::SysInfo* info);
|
||||
|
||||
<strong>KEYBOARD</strong>
|
||||
<strong>SYS_ISKEYAVAILABLE (16)</strong>
|
||||
Check if a key event is pending (non-blocking).
|
||||
bool montauk::is_key_available();
|
||||
|
||||
<strong>SYS_GETKEY (17)</strong>
|
||||
Get the next key event (press or release).
|
||||
void montauk::getkey(montauk::abi::KeyEvent* out);
|
||||
|
||||
<strong>SYS_GETCHAR (18)</strong>
|
||||
Block until a printable character is typed.
|
||||
char montauk::getchar();
|
||||
|
||||
<strong>SYS_INPUT_WAIT (123)</strong>
|
||||
Block until the input serial number differs from
|
||||
observedSerial or the timeout elapses; used to sleep
|
||||
efficiently between input-driven redraws.
|
||||
uint64_t montauk::input_wait(uint64_t observedSerial, uint64_t timeoutMs);
|
||||
|
||||
<strong>MOUSE</strong>
|
||||
<strong>SYS_MOUSESTATE (47)</strong>
|
||||
Get the current mouse position, scroll delta, and button mask.
|
||||
void montauk::mouse_state(montauk::abi::MouseState* out);
|
||||
|
||||
<strong>SYS_SETMOUSEBOUNDS (48)</strong>
|
||||
Set the maximum X/Y the mouse cursor may reach (e.g. framebuffer
|
||||
dimensions).
|
||||
void montauk::set_mouse_bounds(int32_t maxX, int32_t maxY);
|
||||
|
||||
<strong>NETWORKING</strong>
|
||||
<strong>SYS_PING (19)</strong>
|
||||
Send an ICMP echo request and wait for reply.
|
||||
int32_t montauk::ping(uint32_t ip, uint32_t timeoutMs = 3000);
|
||||
|
||||
<strong>SYS_RESOLVE (44)</strong>
|
||||
Resolve a hostname to an IPv4 address via DNS. Sends a UDP
|
||||
query to the configured DNS server and waits up to 5 seconds
|
||||
for a reply. Returns the IP in network byte order, or 0 on
|
||||
failure. IP address strings (e.g. "10.0.0.1") are detected
|
||||
and returned directly without a DNS query.
|
||||
uint32_t montauk::resolve(const char* hostname);
|
||||
|
||||
<strong>SYS_GETNETCFG (37)</strong>
|
||||
Get the current network configuration (IP, mask, gateway, MAC,
|
||||
DNS server).
|
||||
void montauk::get_netcfg(montauk::abi::NetCfg* out);
|
||||
|
||||
<strong>SYS_SETNETCFG (38)</strong>
|
||||
Set the network configuration (IP, mask, gateway, DNS server).
|
||||
int montauk::set_netcfg(const montauk::abi::NetCfg* cfg);
|
||||
|
||||
<strong>SYS_NETSTATUS (125)</strong>
|
||||
Get adapter status including driver name, link state, polling mode,
|
||||
and RX/TX packet counters.
|
||||
int montauk::net_status(montauk::abi::NetStatus* out);
|
||||
|
||||
<strong>SOCKETS</strong>
|
||||
<strong>SYS_SOCKET (29)</strong>
|
||||
Create a socket. type=SOCK_TCP (1) or SOCK_UDP (2).
|
||||
Returns fd or -1.
|
||||
int montauk::socket(int type);
|
||||
|
||||
<strong>SYS_CONNECT (30)</strong>
|
||||
Connect a TCP socket to a remote host.
|
||||
int montauk::connect(int fd, uint32_t ip, uint16_t port);
|
||||
|
||||
<strong>SYS_BIND (31)</strong>
|
||||
Bind a socket to a local port for listening.
|
||||
int montauk::bind(int fd, uint16_t port);
|
||||
|
||||
<strong>SYS_LISTEN (32)</strong>
|
||||
Start listening for incoming TCP connections.
|
||||
int montauk::listen(int fd);
|
||||
|
||||
<strong>SYS_ACCEPT (33)</strong>
|
||||
Accept an incoming connection on a listening socket.
|
||||
Returns a new socket fd for the client connection.
|
||||
int montauk::accept(int fd);
|
||||
|
||||
<strong>SYS_SEND (34)</strong>
|
||||
Send data on a connected socket. Returns bytes sent.
|
||||
int montauk::send(int fd, const void* data, uint32_t len);
|
||||
|
||||
<strong>SYS_RECV (35)</strong>
|
||||
Receive data from a connected socket. Returns bytes
|
||||
received, 0 if no data available, or -1 on close/error.
|
||||
int montauk::recv(int fd, void* buf, uint32_t maxLen);
|
||||
|
||||
<strong>SYS_CLOSESOCK (36)</strong>
|
||||
Close a socket and release its resources.
|
||||
int montauk::closesocket(int fd);
|
||||
|
||||
<strong>SYS_SENDTO (39)</strong>
|
||||
Send a UDP datagram to a specific destination.
|
||||
int montauk::sendto(int fd, const void* data, uint32_t len,
|
||||
uint32_t destIp, uint16_t destPort);
|
||||
|
||||
<strong>SYS_RECVFROM (40)</strong>
|
||||
Receive a UDP datagram. Returns the source address.
|
||||
int montauk::recvfrom(int fd, void* buf, uint32_t maxLen,
|
||||
uint32_t* srcIp, uint16_t* srcPort);
|
||||
|
||||
<strong>FRAMEBUFFER</strong>
|
||||
<strong>SYS_FBINFO (21)</strong>
|
||||
Get framebuffer dimensions and format.
|
||||
void montauk::fb_info(montauk::abi::FbInfo* info);
|
||||
|
||||
<strong>SYS_FBMAP (22)</strong>
|
||||
Map the framebuffer into process memory.
|
||||
void* montauk::fb_map();
|
||||
|
||||
<strong>TERMINAL</strong>
|
||||
<strong>SYS_TERMSIZE (24)</strong>
|
||||
Get terminal dimensions (columns and rows).
|
||||
void montauk::termsize(int* cols, int* rows);
|
||||
|
||||
<strong>SYS_TERMSCALE (43)</strong>
|
||||
Get or set the terminal font scale factor. When scale_x is 0,
|
||||
returns the current scale as (scale_y << 32 | scale_x). When
|
||||
scale_x is non-zero, sets the font scale and returns the new
|
||||
terminal dimensions as (rows << 32 | cols).
|
||||
void montauk::termscale(int scale_x, int scale_y);
|
||||
void montauk::get_termscale(int* scale_x, int* scale_y);
|
||||
|
||||
<strong>RANDOM</strong>
|
||||
<strong>SYS_GETRANDOM (45)</strong>
|
||||
Fill a buffer with random bytes using RDTSC-seeded entropy.
|
||||
Returns the number of bytes written.
|
||||
int64_t montauk::getrandom(void* buf, uint32_t len);
|
||||
|
||||
<strong>POWER MANAGEMENT</strong>
|
||||
<strong>SYS_RESET (26)</strong>
|
||||
Reboot the system.
|
||||
[[noreturn]] void montauk::reset();
|
||||
|
||||
<strong>SYS_SHUTDOWN (27)</strong>
|
||||
Shut down the system.
|
||||
[[noreturn]] void montauk::shutdown();
|
||||
|
||||
<strong>SYS_SUSPEND (89)</strong>
|
||||
Enter ACPI S3 sleep. Returns after wake, 0 on success.
|
||||
int montauk::suspend();
|
||||
|
||||
<strong>SYS_POWER_REQUEST (135)</strong>
|
||||
Cross-process graceful power-off request channel. The desktop
|
||||
posts a pending action (POWER_REQ_SHUTDOWN / POWER_REQ_REBOOT)
|
||||
then exits; login.elf reads it with POWER_REQ_QUERY
|
||||
(read-and-clear), runs the shutdown stages, and finally calls
|
||||
shutdown()/reset(). See montauk::abi::PowerRequestAction.
|
||||
int montauk::power_request(int action);
|
||||
|
||||
<strong>SYS_POWERINFO (149)</strong>
|
||||
Get the CPU power/thermal snapshot (HWP state, throttling,
|
||||
package temperature, base/max/effective frequency). Returns 0
|
||||
on success, -1 if unsupported by the running hardware.
|
||||
int montauk::syscall1(SYS_POWERINFO, (uint64_t)&out);
|
||||
// out: montauk::abi::PowerInfo*
|
||||
|
||||
<strong>KERNEL LOG</strong>
|
||||
<strong>SYS_KLOG (46)</strong>
|
||||
Read from the kernel ring log buffer.
|
||||
int64_t montauk::read_klog(char* buf, uint64_t size);
|
||||
|
||||
<strong>I/O REDIRECTION</strong>
|
||||
Used by the terminal app and similar programs to run a child
|
||||
process with its console I/O captured instead of going directly
|
||||
to the framebuffer console.
|
||||
|
||||
<strong>SYS_SPAWN_REDIR (49)</strong>
|
||||
Spawn a process with its console I/O redirected to the caller.
|
||||
int montauk::spawn_redir(const char* path, const char* args = nullptr);
|
||||
|
||||
<strong>SYS_CHILDIO_READ (50)</strong>
|
||||
Read buffered output produced by a redirected child.
|
||||
int montauk::childio_read(int childPid, char* buf, int maxLen);
|
||||
|
||||
<strong>SYS_CHILDIO_WRITE (51)</strong>
|
||||
Write text input to a redirected child's stdin.
|
||||
int montauk::childio_write(int childPid, const char* data, int len);
|
||||
|
||||
<strong>SYS_CHILDIO_WRITEKEY (52)</strong>
|
||||
Forward a raw key event to a redirected child.
|
||||
int montauk::childio_writekey(int childPid, const montauk::abi::KeyEvent* key);
|
||||
|
||||
<strong>SYS_CHILDIO_SETTERMSZ (53)</strong>
|
||||
Tell a redirected child its terminal dimensions changed.
|
||||
int montauk::childio_settermsz(int childPid, int cols, int rows);
|
||||
|
||||
<strong>WINDOW SERVER</strong>
|
||||
Window server syscalls are used by GUI programs to create and
|
||||
drive an on-screen window (see montauk/Window.hpp for the
|
||||
higher-level win_create/win_poll/win_present wrappers built on
|
||||
top of these).
|
||||
|
||||
<strong>SYS_WINCREATE (54)</strong>
|
||||
Create a window and get its pixel buffer.
|
||||
int montauk::win_create(const char* title, int w, int h,
|
||||
montauk::abi::WinCreateResult* result);
|
||||
|
||||
<strong>SYS_WINDESTROY (55)</strong>
|
||||
Destroy a window.
|
||||
int montauk::win_destroy(int id);
|
||||
|
||||
<strong>SYS_WINPRESENT (56)</strong>
|
||||
Flush the pixel buffer to the screen.
|
||||
uint64_t montauk::win_present(int id);
|
||||
|
||||
<strong>SYS_WINPOLL (57)</strong>
|
||||
Poll the next event (key, mouse, resize, close, scale) for a
|
||||
window.
|
||||
int montauk::win_poll(int id, montauk::abi::WinEvent* event);
|
||||
|
||||
<strong>SYS_WINENUM (58)</strong>
|
||||
Enumerate all windows currently managed by the window server.
|
||||
int montauk::win_enumerate(montauk::abi::WinInfo* info, int max);
|
||||
|
||||
<strong>SYS_WINMAP (59)</strong>
|
||||
Map (or re-map) a window's pixel buffer into the caller's
|
||||
address space.
|
||||
uint64_t montauk::win_map(int id);
|
||||
|
||||
<strong>SYS_WINUNMAP (97)</strong>
|
||||
Unmap a window's pixel buffer from the caller's address space.
|
||||
int montauk::win_unmap(int id);
|
||||
|
||||
<strong>SYS_WINSENDEVENT (60)</strong>
|
||||
Inject an event into a window's event queue.
|
||||
int montauk::win_sendevent(int id, const montauk::abi::WinEvent* event);
|
||||
|
||||
<strong>SYS_WINRESIZE (64)</strong>
|
||||
Resize a window and its pixel buffer.
|
||||
uint64_t montauk::win_resize(int id, int w, int h);
|
||||
|
||||
<strong>SYS_WINSETSCALE (65)</strong>
|
||||
Set the desktop-wide UI scale factor.
|
||||
int montauk::win_setscale(int scale);
|
||||
|
||||
<strong>SYS_WINGETSCALE (66)</strong>
|
||||
Get the desktop-wide UI scale factor.
|
||||
int montauk::win_getscale();
|
||||
|
||||
<strong>SYS_WINSETCURSOR (68)</strong>
|
||||
Set the mouse cursor shown while over a window (0=arrow,
|
||||
1=resize_h, 2=resize_v).
|
||||
int montauk::win_setcursor(int id, int cursor);
|
||||
|
||||
<strong>SYS_WINSETFLAGS (126)</strong>
|
||||
Set window flags (e.g. WIN_FLAG_FULLSCREEN).
|
||||
int montauk::win_setflags(int id, uint32_t flags);
|
||||
|
||||
<strong>DEVICES</strong>
|
||||
<strong>SYS_DEVLIST (63)</strong>
|
||||
Enumerate detected devices (CPU, interrupts, timers, input,
|
||||
USB, network, display, storage, PCI, audio, ACPI) for the
|
||||
device explorer app.
|
||||
int montauk::devlist(montauk::abi::DevInfo* buf, int max);
|
||||
|
||||
<strong>SYS_DISKINFO (69)</strong>
|
||||
Get detailed info for one block device (model, serial, sector
|
||||
size, NCQ/TRIM/SMART support, etc.).
|
||||
int montauk::diskinfo(montauk::abi::DiskInfo* buf, int port);
|
||||
|
||||
<strong>STORAGE</strong>
|
||||
<strong>SYS_PARTLIST (70)</strong>
|
||||
Enumerate GPT partitions across all block devices.
|
||||
int montauk::partlist(montauk::abi::PartInfo* buf, int max);
|
||||
|
||||
<strong>SYS_DISKREAD (71)</strong>
|
||||
Raw, driver-agnostic sector read from a block device.
|
||||
int64_t montauk::disk_read(int blockDev, uint64_t lba,
|
||||
uint32_t sectorCount, void* buf);
|
||||
|
||||
<strong>SYS_DISKWRITE (72)</strong>
|
||||
Raw, driver-agnostic sector write to a block device.
|
||||
int64_t montauk::disk_write(int blockDev, uint64_t lba,
|
||||
uint32_t sectorCount, const void* buf);
|
||||
|
||||
<strong>SYS_GPTINIT (73)</strong>
|
||||
Initialize a fresh GPT partition table on a block device.
|
||||
int montauk::gpt_init(int blockDev);
|
||||
|
||||
<strong>SYS_GPTADD (74)</strong>
|
||||
Add a partition to an existing GPT table.
|
||||
int montauk::gpt_add(const montauk::abi::GptAddParams* params);
|
||||
|
||||
<strong>SYS_FSMOUNT (75)</strong>
|
||||
Mount a partition's filesystem onto a drive number.
|
||||
int montauk::fs_mount(int partIndex, int driveNum);
|
||||
|
||||
<strong>SYS_FSFORMAT (76)</strong>
|
||||
Format a partition with a filesystem (FS_TYPE_FAT32 or
|
||||
FS_TYPE_EXT2).
|
||||
int montauk::fs_format(const montauk::abi::FsFormatParams* params);
|
||||
|
||||
<strong>SYS_FS_SYNC (134)</strong>
|
||||
Flush all block-device write caches and cleanly unmount
|
||||
disk-backed volumes ahead of power-off. Returns the number of
|
||||
volumes unmounted. Part of the graceful shutdown sequence
|
||||
(see SYS_POWER_REQUEST).
|
||||
int montauk::fs_sync();
|
||||
|
||||
<strong>AUDIO</strong>
|
||||
<strong>SYS_AUDIOOPEN (80)</strong>
|
||||
Open a mixer output stream at the given sample rate, channel
|
||||
count, and bit depth. Returns a stream handle.
|
||||
int montauk::audio_open(uint32_t sampleRate, uint8_t channels,
|
||||
uint8_t bitsPerSample);
|
||||
|
||||
<strong>SYS_AUDIOCLOSE (81)</strong>
|
||||
Close an audio stream.
|
||||
void montauk::audio_close(int handle);
|
||||
|
||||
<strong>SYS_AUDIOWRITE (82)</strong>
|
||||
Write PCM samples to an audio stream.
|
||||
int montauk::audio_write(int handle, const void* data, uint32_t size);
|
||||
|
||||
<strong>SYS_AUDIOCTL (83)</strong>
|
||||
Control an audio stream or the global mixer. Commands 0-3 act
|
||||
on the stream named by the handle argument; commands 4-12 act
|
||||
on that stream's routing/mute state or the global master and
|
||||
ignore or reuse the handle as documented below.
|
||||
int montauk::audio_ctl(int handle, int cmd, int value);
|
||||
|
||||
Convenience wrappers (all thin calls onto audio_ctl):
|
||||
audio_set_volume, audio_get_volume AUDIO_CTL_{SET,GET}_VOLUME (0/1)
|
||||
audio_get_pos AUDIO_CTL_GET_POS (2)
|
||||
audio_pause, audio_resume AUDIO_CTL_PAUSE (3)
|
||||
audio_get_output AUDIO_CTL_GET_OUTPUT (4): 0=HDA, 1=Bluetooth
|
||||
(SET_OUTPUT, 5) switch a stream's output route
|
||||
audio_bt_status AUDIO_CTL_BT_STATUS (6)
|
||||
audio_set_master_volume, _get_ AUDIO_CTL_{SET,GET}_MASTER_VOLUME (7/8), 0-100
|
||||
audio_set_mute, audio_get_mute AUDIO_CTL_{SET,GET}_MUTE (9/10), per-stream
|
||||
audio_set_master_mute, _get_ AUDIO_CTL_{SET,GET}_MASTER_MUTE (11/12)
|
||||
|
||||
<strong>SYS_AUDIOLIST (128)</strong>
|
||||
Enumerate active mixer streams (owner PID, name, format,
|
||||
volume, mute/pause state).
|
||||
int montauk::audio_list(montauk::abi::AudioStreamInfo* buf, int maxCount);
|
||||
|
||||
<strong>SYS_AUDIOWAIT (129)</strong>
|
||||
Return the current mixer state serial. With timeoutMs > 0,
|
||||
blocks until the serial differs from prevSerial or the timeout
|
||||
elapses; with timeoutMs == 0 it returns immediately.
|
||||
uint64_t montauk::audio_wait(uint64_t prevSerial, uint64_t timeoutMs);
|
||||
|
||||
<strong>BLUETOOTH</strong>
|
||||
<strong>SYS_BTSCAN (84)</strong>
|
||||
Scan for discoverable Bluetooth devices for up to timeoutMs.
|
||||
int montauk::bt_scan(montauk::abi::BtScanResult* buf, int maxCount,
|
||||
uint32_t timeoutMs);
|
||||
|
||||
<strong>SYS_BTCONNECT (85)</strong>
|
||||
Connect (and pair/bond if needed) to a device by BD_ADDR.
|
||||
int montauk::bt_connect(const uint8_t* bdAddr);
|
||||
|
||||
<strong>SYS_BTDISCONNECT (86)</strong>
|
||||
Disconnect from a device by BD_ADDR.
|
||||
int montauk::bt_disconnect(const uint8_t* bdAddr);
|
||||
|
||||
<strong>SYS_BTLIST (87)</strong>
|
||||
List currently connected devices.
|
||||
int montauk::bt_list(montauk::abi::BtDevInfo* buf, int maxCount);
|
||||
|
||||
<strong>SYS_BTINFO (88)</strong>
|
||||
Get local adapter info (BD_ADDR, name, init/scanning state).
|
||||
int montauk::bt_info(montauk::abi::BtAdapterInfo* buf);
|
||||
|
||||
<strong>SYS_BTSETADDR (137)</strong>
|
||||
Change the adapter's BD_ADDR (6-byte buffer, byte 0 is the
|
||||
least-significant octet). Volatile -- apply after the last
|
||||
controller reset and persist separately to bluetooth.toml.
|
||||
int montauk::bt_set_addr(const uint8_t* bdAddr);
|
||||
|
||||
<strong>SYS_BTBONDS (138)</strong>
|
||||
List bonded (paired) devices.
|
||||
int montauk::bt_bonds(montauk::abi::BtBondInfo* buf, int maxCount);
|
||||
|
||||
<strong>SYS_BTFORGET (139)</strong>
|
||||
Forget a paired device; it must re-pair next time.
|
||||
int montauk::bt_forget(const uint8_t* bdAddr);
|
||||
|
||||
<strong>SOFTWARE-DEFINED RADIO</strong>
|
||||
Receive-only SDR API. Receivers are enumerated by index in
|
||||
[0, SYS_SDR_COUNT); SYS_SDR_OPEN returns a handle used by the
|
||||
rest of the calls. Samples are delivered as interleaved 8-bit
|
||||
unsigned I/Q (CU8, SDR_FORMAT_CU8) from the device's ring
|
||||
buffer. Backed by an RTL-SDR (RTL2832U + R820T2) driver.
|
||||
|
||||
<strong>SYS_SDR_COUNT (140)</strong>
|
||||
Number of available SDR receivers.
|
||||
int montauk::sdr_count();
|
||||
|
||||
<strong>SYS_SDR_INFO (141)</strong>
|
||||
Get static/dynamic info for one receiver by index (name, tuner,
|
||||
frequency/sample-rate ranges, gain steps, present/streaming
|
||||
flags).
|
||||
int montauk::sdr_info(int index, montauk::abi::SdrDeviceInfo* out);
|
||||
|
||||
<strong>SYS_SDR_OPEN (142)</strong>
|
||||
Open a receiver by index. Returns a handle.
|
||||
int montauk::sdr_open(int index);
|
||||
|
||||
<strong>SYS_SDR_CLOSE (143)</strong>
|
||||
Close a receiver handle.
|
||||
int montauk::sdr_close(int handle);
|
||||
|
||||
<strong>SYS_SDR_START (144)</strong>
|
||||
Begin streaming samples.
|
||||
int montauk::sdr_start(int handle);
|
||||
|
||||
<strong>SYS_SDR_STOP (145)</strong>
|
||||
Stop streaming samples.
|
||||
int montauk::sdr_stop(int handle);
|
||||
|
||||
<strong>SYS_SDR_READ (146)</strong>
|
||||
Non-blocking read of queued I/Q samples. Returns bytes copied.
|
||||
int montauk::sdr_read(int handle, void* buf, uint32_t len);
|
||||
|
||||
<strong>SYS_SDR_SETPARAM (147)</strong>
|
||||
Set a tunable parameter (see SDR_PARAM_* below).
|
||||
int montauk::sdr_set_param(int handle, int param, uint64_t value);
|
||||
|
||||
<strong>SYS_SDR_GETPARAM (148)</strong>
|
||||
Get a tunable parameter's current value.
|
||||
int64_t montauk::sdr_get_param(int handle, int param);
|
||||
|
||||
Parameters (montauk::abi::SDR_PARAM_*): FREQ (center frequency,
|
||||
Hz), SAMPLE_RATE (Hz), GAIN_MODE (0=auto/AGC, 1=manual), GAIN
|
||||
(tenths of dB), FREQ_CORR (ppm), AGC (demod digital AGC, 0/1),
|
||||
DIRECT_SAMP (0=off, 1=I, 2=Q). Convenience wrappers exist for
|
||||
each: sdr_set_freq/sdr_get_freq, sdr_set_sample_rate/
|
||||
sdr_get_sample_rate, sdr_set_gain_mode, sdr_set_gain,
|
||||
sdr_set_freq_correction, sdr_set_agc.
|
||||
|
||||
<strong>CLIPBOARD</strong>
|
||||
<strong>SYS_CLIPBOARD_SET_TEXT (119)</strong>
|
||||
Set the system clipboard's text contents (max
|
||||
CLIPBOARD_MAX_TEXT_BYTES, 256 KiB).
|
||||
int montauk::clipboard_set_text(const char* data, uint32_t len);
|
||||
|
||||
<strong>SYS_CLIPBOARD_GET_INFO (120)</strong>
|
||||
Get the clipboard's current size and serial number (for
|
||||
change detection).
|
||||
int montauk::clipboard_get_info(montauk::abi::ClipboardInfo* out);
|
||||
|
||||
<strong>SYS_CLIPBOARD_GET_TEXT (121)</strong>
|
||||
Read the clipboard's text contents.
|
||||
int montauk::clipboard_get_text(char* buf, uint32_t bufLen,
|
||||
uint32_t* outLen, uint64_t* outSerial = nullptr);
|
||||
|
||||
<strong>SYS_CLIPBOARD_CLEAR (122)</strong>
|
||||
Clear the clipboard.
|
||||
int montauk::clipboard_clear();
|
||||
|
||||
<strong>GENERIC IPC</strong>
|
||||
Handle-based IPC primitives underlying streams, mailboxes,
|
||||
waitsets, and shared-memory surfaces (see kernel/src/Ipc/Ipc.hpp).
|
||||
All are accessed via numeric handles with rights-based security
|
||||
and can be waited on with SYS_WAIT_HANDLE or a waitset.
|
||||
|
||||
<strong>SYS_DUPHANDLE (98)</strong>
|
||||
Duplicate a handle (e.g. to hand a copy to a child process).
|
||||
int montauk::dup_handle(int handle);
|
||||
|
||||
<strong>SYS_WAIT_HANDLE (99)</strong>
|
||||
Block until a handle's signals intersect wantedSignals, or
|
||||
timeoutMs elapses. See IPC_SIGNAL_* (READABLE, WRITABLE,
|
||||
PEER_CLOSED, EXITED, READY).
|
||||
uint32_t montauk::wait_handle(int handle, uint32_t wantedSignals,
|
||||
uint64_t timeoutMs = ~0ULL);
|
||||
|
||||
<strong>SYS_STREAM_CREATE (100)</strong>
|
||||
Create a byte-pipe stream, returning a read handle and a write
|
||||
handle.
|
||||
int montauk::stream_create(int* outReadHandle, int* outWriteHandle,
|
||||
uint32_t capacity = 0);
|
||||
|
||||
<strong>SYS_STREAM_READ (101)</strong>
|
||||
Read bytes from a stream handle.
|
||||
int montauk::stream_read(int handle, void* buf, int maxLen);
|
||||
|
||||
<strong>SYS_STREAM_WRITE (102)</strong>
|
||||
Write bytes to a stream handle.
|
||||
int montauk::stream_write(int handle, const void* data, int len);
|
||||
|
||||
<strong>SYS_MAILBOX_CREATE (103)</strong>
|
||||
Create a message-queue mailbox, returning a send handle and a
|
||||
receive handle.
|
||||
int montauk::mailbox_create(int* outSendHandle, int* outRecvHandle);
|
||||
|
||||
<strong>SYS_MAILBOX_SEND (104)</strong>
|
||||
Send a typed message, optionally attaching a handle to
|
||||
transfer to the receiver.
|
||||
int montauk::mailbox_send(int handle, uint32_t msgType, const void* data,
|
||||
uint16_t len, int attachHandle = -1);
|
||||
|
||||
<strong>SYS_MAILBOX_RECV (105)</strong>
|
||||
Receive a message.
|
||||
int montauk::mailbox_recv(int handle, uint32_t* outMsgType, void* data,
|
||||
uint16_t* inOutLen, int* outAttachHandle = nullptr);
|
||||
|
||||
<strong>SYS_WAITSET_CREATE (106)</strong>
|
||||
Create a waitset for multiplexing waits across many handles.
|
||||
int montauk::waitset_create();
|
||||
|
||||
<strong>SYS_WAITSET_ADD (107)</strong>
|
||||
Add a handle and its signal mask to a waitset.
|
||||
int montauk::waitset_add(int waitsetHandle, int targetHandle,
|
||||
uint32_t signals);
|
||||
|
||||
<strong>SYS_WAITSET_REMOVE (108)</strong>
|
||||
Remove an entry from a waitset by index.
|
||||
int montauk::waitset_remove(int waitsetHandle, int index);
|
||||
|
||||
<strong>SYS_WAITSET_WAIT (109)</strong>
|
||||
Block until any member handle's watched signals fire, or
|
||||
timeoutMs elapses.
|
||||
int montauk::waitset_wait(int waitsetHandle, montauk::abi::IpcWaitResult* outReady,
|
||||
uint64_t timeoutMs = ~0ULL);
|
||||
|
||||
<strong>SYS_PROC_OPEN (110)</strong>
|
||||
Open a handle to another process by PID (for waiting on its
|
||||
exit via IPC_SIGNAL_EXITED, etc.).
|
||||
int montauk::proc_open(int pid);
|
||||
|
||||
<strong>SYS_SURFACE_CREATE (111)</strong>
|
||||
Create a shared pixel-buffer surface of byteSize bytes.
|
||||
int montauk::surface_create(uint64_t byteSize);
|
||||
|
||||
<strong>SYS_SURFACE_MAP (112)</strong>
|
||||
Map a surface into the caller's address space.
|
||||
void* montauk::surface_map(int handle);
|
||||
|
||||
<strong>SYS_SURFACE_RESIZE (113)</strong>
|
||||
Resize a surface.
|
||||
int montauk::surface_resize(int handle, uint64_t newSize);
|
||||
|
||||
<strong>SHARED LIBRARIES</strong>
|
||||
<strong>SYS_LOAD_LIB (114)</strong>
|
||||
Load a shared library ELF (.lib) into the caller's address
|
||||
space.
|
||||
int montauk::load_lib(const char* path);
|
||||
|
||||
<strong>SYS_UNLOAD_LIB (115)</strong>
|
||||
Unload a previously loaded library.
|
||||
int montauk::unload_lib(int handle);
|
||||
|
||||
<strong>SYS_DLSYM (116)</strong>
|
||||
Resolve a symbol offset within a loaded library to a callable
|
||||
address.
|
||||
void* montauk::dlsym(int handle, uint64_t symbolOffset);
|
||||
|
||||
<strong>SYS_GETLIBBASE (117)</strong>
|
||||
Get the base virtual address a loaded library was mapped at.
|
||||
uint64_t montauk::get_libbase(int handle);
|
||||
|
||||
<strong>CRASH REPORTING</strong>
|
||||
<strong>SYS_CRASH_REPORT (118)</strong>
|
||||
Retrieve the kernel-filled crash report for the last faulting
|
||||
process (exception vector/name, faulting address, register
|
||||
state, page-fault error bits). Used by the crashpad app.
|
||||
int montauk::crash_report(montauk::abi::CrashReportInfo* out);
|
||||
|
||||
<strong>SEE ALSO</strong>
|
||||
spawn(2), file(2), framebuffer(2), malloc(3), intro(1)</code></pre>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="center">
|
||||
<a href="../index.html">Back to Documentation Index</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user