diff --git a/docs/man/dhcp.html b/docs/man/dhcp.html index 5a432d9..52e4a92 100644 --- a/docs/man/dhcp.html +++ b/docs/man/dhcp.html @@ -111,9 +111,11 @@
NAME
dhcp - obtain network configuration via DHCP
+
SYNOPSIS
dhcp
+
DESCRIPTION
The DHCP client automatically obtains an IP address, subnet mask,
default gateway, and other network parameters from a DHCP server
@@ -126,6 +128,7 @@
The client is run automatically by the init system at boot, but
may also be invoked manually from the shell.
+
PROTOCOL
The client performs the standard four-message DHCP exchange:
@@ -140,11 +143,13 @@
Each step has a 10-second timeout. If no response is received
the client exits with an error and restores the previous config.
+
OUTPUT
On success the client prints the assigned configuration:
IP Address, Subnet Mask, Gateway, DNS Server, Lease Time
+
OPTIONS
The DHCP client requests the following options from the server:
@@ -153,9 +158,9 @@
6 DNS Server
51 Lease Time
-SEE ALSO
- ifconfig(1), shell(1), syscalls(2)
+SEE ALSO
+ ifconfig(1), shell(1), syscalls(2)
NAME
edit - text editor for MontaukOS
+
SYNOPSIS
edit [filename]
+
DESCRIPTION
edit is an interactive text editor. When invoked with a filename,
it opens the file for editing. If the file does not exist, a new
@@ -122,8 +124,10 @@
When invoked without arguments, edit opens an empty buffer. You
will be prompted for a filename when saving.
+
KEYBOARD SHORTCUTS
+
Navigation
Arrow Keys Move cursor up/down/left/right
Home Move to start of line
@@ -131,18 +135,21 @@
Page Up Scroll up one page
Page Down Scroll down one page
+
Editing
Backspace Delete character before cursor
Delete Delete character at cursor
Enter Insert new line
Tab Insert 4 spaces
+
Commands
Ctrl+S Save file
Ctrl+Q Quit (warns if unsaved changes)
Ctrl+F Search for text
Ctrl+G Find next occurrence
+
DISPLAY
The top line shows the filename, a modified indicator [+],
and the current cursor position (Ln, Col).
@@ -152,13 +159,14 @@
Line numbers are displayed in a gutter on the left side.
Lines past the end of the file are marked with ~.
+
EXAMPLES
edit intro.1 Edit a file
edit Open a new empty buffer
-SEE ALSO
- cat(1), shell(1)
+SEE ALSO
+ cat(1), shell(1)
NAME
fetch - HTTP/HTTPS client for MontaukOS
+
SYNOPSIS
fetch [-v] <url>
fetch [-v] <host> <port> [path]
+
DESCRIPTION
fetch performs an HTTP/1.0 GET request and prints the response
body to the terminal. Supports both plain HTTP and HTTPS (TLS 1.2)
@@ -131,12 +133,14 @@
If no path is given, "/" is used.
+
OPTIONS
--v
+ -v
Verbose mode. Print connection info, trust anchor count, TLS
handshake progress, and the HTTP status/size header before
the body.
+
EXAMPLES
fetch https://icanhazip.com
Print your public IP address over HTTPS.
@@ -156,6 +160,7 @@
fetch 10.0.68.1 80 /
Fetch from a local server by IP (legacy syntax).
+
TLS SUPPORT
HTTPS connections use BearSSL for TLS 1.2. Server certificates
are validated against the system CA bundle at
@@ -164,12 +169,13 @@
Entropy for the TLS handshake is provided by RDTSC-seeded
random data via the SYS_GETRANDOM syscall.
+
KEYBOARD
Ctrl+Q Abort the request
-SEE ALSO
- ping(1), nslookup(1), tcpconnect(1), shell(1), syscalls(2)
+SEE ALSO
+ ping(1), nslookup(1), tcpconnect(1), shell(1), syscalls(2)
NAME
open, read, getsize, close, readdir - file I/O system calls
+
SYNOPSIS
- int montauk::open(const char* path);
- int montauk::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size);
- uint64_t montauk::getsize(int handle);
- void montauk::close(int handle);
- int montauk::readdir(const char* path, const char** names, int max);
+ int montauk::open(const char* path);
+ int montauk::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size);
+ uint64_t montauk::getsize(int handle);
+ void montauk::close(int handle);
+ int montauk::readdir(const char* path, const char** names, int max);
+
DESCRIPTION
MontaukOS provides a Virtual File System (VFS) with read/write
support. Drive 0 is the boot ramdisk; additional drives may be
mounted from GPT partitions backed by FAT32 or ext2 (see
- syscalls(2), STORAGE section). Files are accessed via paths in
+ syscalls(2), STORAGE section). Files are accessed via paths in
the format "<drive>:/<path>".
+
open
Opens a file and returns a non-negative handle on success, or a
negative value on error (file not found, no free handles).
int h = montauk::open("0:/os/hello.elf");
+
read
Reads up to 'size' bytes starting at 'offset' into 'buf'.
Returns the number of bytes actually read, or negative on error.
@@ -140,16 +144,19 @@
uint8_t buf[512];
int n = montauk::read(h, buf, 0, 512);
+
getsize
Returns the total size in bytes of the file.
uint64_t sz = montauk::getsize(h);
+
close
Closes the file handle and frees kernel resources.
montauk::close(h);
+
readdir
Lists entries in a directory. Up to 'max' entry names (VFS cap
256, driver-backed listings such as 0:/os/ cap 128) are written
@@ -165,6 +172,7 @@
call, use montauk::readdir_at(path, names, max, startIndex) and
advance startIndex by the returned count until it returns 0.
+
READING PATTERN
The standard pattern for reading a file:
@@ -183,12 +191,13 @@
}
montauk::close(h);
+
WRITING, DELETING, RENAMING
- int montauk::fcreate(const char* path);
- int montauk::fwrite(int handle, const uint8_t* buf, uint64_t offset, uint64_t size);
- int montauk::fdelete(const char* path);
- int montauk::fmkdir(const char* path);
- int montauk::frename(const char* oldPath, const char* newPath);
+ int montauk::fcreate(const char* path);
+ int montauk::fwrite(int handle, const uint8_t* buf, uint64_t offset, uint64_t size);
+ int montauk::fdelete(const char* path);
+ int montauk::fmkdir(const char* path);
+ int montauk::frename(const char* oldPath, const char* newPath);
fcreate creates a new file and returns a handle. fwrite writes
bytes at the given offset. fdelete removes a file, fmkdir
@@ -201,15 +210,16 @@
montauk::fs_mount), changes are written through to storage; use
montauk::fs_sync() to flush caches before power-off.
+
NOTES
Drive 0 is loaded at boot from a USTAR tar archive into RAM.
Other drives are mounted on demand from GPT partitions on
- SATA/NVMe/USB block devices; see syscalls(2), STORAGE and
+ SATA/NVMe/USB block devices; see syscalls(2), STORAGE and
DEVICES sections.
-SEE ALSO
- syscalls(2), spawn(2), malloc(3)
+SEE ALSO
+ syscalls(2), spawn(2), malloc(3)
NAME
fontscale - get or set terminal font scale
+
SYNOPSIS
fontscale
fontscale <n>
fontscale <x> <y>
+
DESCRIPTION
Controls the terminal font scale factor. The Flanterm terminal
emulator renders text at a configurable scale multiplier.
@@ -135,6 +137,7 @@
Valid scale values are 1 through 8. After rescaling, the screen
is cleared.
+
OUTPUT
fontscale
Scale: 1x1 (160 cols x 50 rows)
@@ -142,15 +145,16 @@
fontscale 2
Scale set to 2x2 (80 cols x 25 rows)
+
EXAMPLES
fontscale Show current scale and dimensions
fontscale 2 Double the font size
fontscale 3 2 3x horizontal, 2x vertical
fontscale 1 Reset to default size
-SEE ALSO
- shell(1), syscalls(2)
+SEE ALSO
+ shell(1), syscalls(2)
NAME
fb_info, fb_map - direct framebuffer access
+
SYNOPSIS
- void montauk::fb_info(montauk::abi::FbInfo* info);
- void* montauk::fb_map();
+ void montauk::fb_info(montauk::abi::FbInfo* info);
+ void* montauk::fb_map();
+
DESCRIPTION
These syscalls allow userspace programs to access the linear
framebuffer directly for graphical output.
+
fb_info
Fills in an FbInfo structure with the framebuffer geometry:
@@ -129,15 +132,18 @@
The pitch is the number of bytes per scanline (may be larger
than width * 4 due to alignment). bpp is always 32.
+
fb_map
- Maps the physical framebuffer into the process address space at
- a fixed virtual address (0x50000000) and returns that address.
+ Maps the physical framebuffer into a dedicated region of the process
+ address space and returns its address. Programs must use the returned
+ pointer rather than assuming a particular virtual address.
uint32_t* pixels = (uint32_t*)montauk::fb_map();
Each pixel is a 32-bit value in 0xAARRGGBB format (blue in the
low byte). Writing to this memory directly updates the screen.
+
PIXEL FORMAT
Bits 31-24: Alpha (unused, typically 0xFF)
Bits 23-16: Red
@@ -146,6 +152,7 @@
Example: red = 0x00FF0000, green = 0x0000FF00, blue = 0x000000FF
+
EXAMPLE
Fill the screen with blue:
@@ -160,6 +167,7 @@
}
}
+
NOTES
After mapping, the cursor overlay is not composited. Programs
that use the framebuffer take full control of screen output.
@@ -167,9 +175,9 @@
Only one mapping per process is supported. Calling fb_map()
multiple times returns the same address.
-SEE ALSO
- syscalls(2), malloc(3)
+SEE ALSO
+ syscalls(2), malloc(3)
introduction to MontaukOS userspace
-MontaukOS interactive command shell
-MontaukOS init system
-obtain network configuration via DHCP
HTTP/HTTPS client for MontaukOS
-send ICMP echo requests
-DNS hostname lookup
-get or set terminal font scale
-text editor for MontaukOS
HTTP/HTTPS client for MontaukOS
+get or set terminal font scale
+MontaukOS init system
+introduction to MontaukOS userspace
+display manual pages
DNS hostname lookup
+send ICMP echo requests
+configure printers and submit print jobs
@@ -188,6 +183,26 @@ Manual pages for MontaukOS, viewable in-system with the man(1MontaukOS userspace print spooler daemon
MontaukOS interactive command shell
+MontaukOS SSH-2 server
+list mounted volumes
+scan for wireless networks and inspect the Wi-Fi adapter
+Wikipedia article viewer for MontaukOS
@@ -200,8 +215,13 @@ Manual pages for MontaukOS, viewable in-system with the man(1overview of MontaukOS system calls
+ file(2) +file I/O system calls
+direct framebuffer access
file I/O system calls
-direct framebuffer access
+ syscalls(2) +overview of MontaukOS system calls
userspace heap allocation
userspace RTL2832U and R820T2 radio driver
+NAME
init - MontaukOS init system
+
SYNOPSIS
Spawned automatically by the kernel as PID 0.
+
DESCRIPTION
init is the first userspace process started by the MontaukOS
- kernel. It chains system services in sequence, then launches
- the interactive shell.
+ kernel. It discovers system services from 0:/config/init.toml
+ and starts them in the order their tables appear in that file.
- Each service is spawned as a child process. init waits for it
- to exit before starting the next one. If a service fails to
- spawn, init logs an error and continues to the next stage.
+ Each enabled service is spawned as a child process. Services may
+ run in the background or block startup until they exit. Disabled
+ services are logged and skipped.
Log output is timestamped and color-coded:
HH:MM:SS INFO init Starting dhcp
HH:MM:SS OK init dhcp finished (pid 1)
-BOOT SEQUENCE
- The following services are started in order:
- 1. 0:/os/dhcp.elf Obtain network configuration via DHCP
- 2. 0:/os/shell.elf Launch the interactive shell
+CONFIGURATION
+ Each service is declared as a named TOML table:
+
+ [services.dhcp]
+ path = "0:/os/dhcp.elf"
+ enabled = true
+ wait = false
+
+ path is required. name controls the name shown in the boot log and
+ defaults to the table name. enabled and wait both default to true.
+ optional skips a service whose executable is not installed.
+
+ fallback names another configured service to start if spawning the
+ service fails. A service with fallback_only = true is available as
+ a fallback but is not started during the normal pass.
+
+ After all foreground services exit, init enters an idle loop.
- After the shell exits, init enters an idle loop.
LOG LEVELS
init uses four log levels, each with a distinct color:
@@ -144,9 +158,9 @@
WARN Yellow Non-fatal warning
FAIL Red Service failed to start
-SEE ALSO
- dhcp(1), shell(1), syscalls(2)
+SEE ALSO
+ dhcp(1), shell(1), syscalls(2)
NAME
intro - introduction to MontaukOS userspace
+
DESCRIPTION
- MontaukOS is a hobbyist 64-bit operating system written in C++20,
- currently at version 0.1.7 (API version 8). Userspace programs
+ MontaukOS is a 64-bit operating system written in C++20,
+ currently at version 0.2.0 (API version 11). Userspace programs
run in Ring 3, are loaded as static ELF64 binaries, and
communicate with the kernel through the x86-64 SYSCALL/SYSRET
- mechanism (150 syscalls -- see syscalls(2)).
+ mechanism (roughly 190 syscall numbers, 0-189 - see syscalls(2)).
+
+ Programs are built with the x86_64-montauk cross toolchain and
+ linked at virtual address 0x400000. MontaukOS has its own C
+ library along with the Montauk API (montauk:: wrappers).
- Programs are compiled with a freestanding cross-compiler and
- linked at virtual address 0x400000. There is no standard C
- library for C++ programs -- all system interaction goes through
- the montauk:: syscall wrappers. A desktop environment with a
- window server, GUI apps, and Bluetooth/audio/networking stacks
- runs on top of the same syscall API.
GETTING STARTED
To write a new system/CLI program, create a directory under
- programs/src/ with a main.cpp file. The entry point is:
-
- extern "C" void _start() { ... }
-
- There is no argc/argv. Use montauk::getargs() to retrieve any
- arguments passed by the parent process. Include <montauk/syscall.h>
- for the full typed syscall API. GUI apps additionally use
- win_create()/win_poll()/win_present() from montauk/Window.hpp
- (see framebuffer(2)).
+ programs/src/ with a main.cpp file.
Build with:
@@ -144,64 +135,65 @@
System/CLI binaries appear in programs/bin/os/; GUI app bundles
(ELF + manifest.toml + icon) appear under programs/bin/apps/<name>/.
+
RAMDISK LAYOUT
The boot ramdisk is mounted as drive 0 with the following
directory structure:
- 0:/os/ System/CLI binaries (shell, init, man, etc.),
- plus os-owned data: certs/, firmware/,
- licenses/, wallpapers/
- 0:/apps/ GUI app bundles, one directory per app
- (<app>.elf + manifest.toml + icon)
+ 0:/os/ System/CLI binaries, os data
+ 0:/apps/ App bundles
0:/config/ System-wide config TOMLs
- 0:/users/<name>/ Per-user home directories (created at
- login), with Music/, Videos/, Pictures/,
- config/ subdirectories
+ 0:/users/<name>/ User home directories
+ 0:/state/ Mutable system runtime state
+ 0:/tmp/ Scratch space
0:/fonts/ Shared fonts
0:/icons/ Shared icons
0:/man/ Manual pages
0:/www/ Web server content
- 0:/lib/ Lua and TinyCC toolchain payloads
+ 0:/sdk/ Montauk SDK (native gcc/binutils, TinyCC,
+ Lua, headers and libraries), when installed
0:/boot/ Kernel, bootloader, ramdisk image
- There is no 0:/games/, 0:/common/, 0:/home/, or 0:/etc/ --
- these were used by earlier single-user releases and no longer
- exist. Games and other GUI programs (including doom) ship as
- bundles under 0:/apps/.
SHELL
- The interactive shell is the primary way to interact with
+ The interactive shell can be used to interact with
MontaukOS. Commands are resolved against the current directory
- first, then 0:/os/. Type 'help' at the shell prompt for a list
+ first, then 0:/os/.
+
+ Type 'help' at the shell prompt for a list
of commands. Use 'man shell' for detailed shell documentation.
+
MAN PAGES
The following man pages are available:
- intro(1) This page
- shell(1) Shell commands reference
- init(1) Init system
- dhcp(1) DHCP client
- fetch(1) HTTP client
- ping(1) ICMP ping
- nslookup(1) DNS lookup
- fontscale(1) Terminal font scaling
- edit(1) Text editor
- man(1) The man command itself
- printctl(1) Printer control
- printd(1) Print spooler daemon
- wiki(1) Wikipedia article viewer
- legal(7) Copyright and legal information
- tls-errors(5) TLS/BearSSL error reference
- syscalls(2) Overview of all syscalls
- spawn(2) Process spawning
- file(2) File I/O syscalls
- framebuffer(2) Framebuffer access
- malloc(3) Memory allocation
+ intro(1) This page
+ shell(1) Shell commands reference
+ init(1) Init system
+ dhcp(1) DHCP client
+ fetch(1) HTTP client
+ ping(1) ICMP ping
+ nslookup(1) DNS lookup
+ wifi(1) Wi-Fi configuration
+ sshd(1) SSH daemon
+ fontscale(1) Terminal font scaling
+ edit(1) Text editor
+ man(1) The man command itself
+ printctl(1) Printer control
+ printd(1) Print spooler daemon
+ wiki(1) Wikipedia article viewer
+ legal(7) Copyright and legal information
+ tls-errors(5) TLS/BearSSL error reference
+ syscalls(2) Overview of all syscalls
+ spawn(2) Process spawning
+ file(2) File I/O syscalls
+ framebuffer(2) Framebuffer access
+ malloc(3) Memory allocation
+ rtlsdr(3) RTL-SDR software radio API
+
SEE ALSO
- shell(1), syscalls(2), malloc(3)
-
+ shell(1), syscalls(2), malloc(3)
NAME
MontaukOS legal/copyright information
+
DESCRIPTION
Copyright (c) 2025-2026 Daniel Hammer, et al.
(includes contributors to other projects, i.e. The Limine Bootloader. Please refer to any other project's own license.)
@@ -140,6 +141,7 @@
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
+
THIRD-PARTY COMPONENTS
MontaukOS is distributed together with third-party components that remain
under their own licenses, including:
@@ -166,7 +168,6 @@
Unsplash License
Full license texts and notices are on this system in 0:/os/licenses/.
-
NAME
malloc, mfree, realloc - userspace heap allocation
+
SYNOPSIS
- void* montauk::malloc(uint64_t size);
- void montauk::mfree(void* ptr);
- void* montauk::realloc(void* ptr, uint64_t size);
+ void* montauk::malloc(uint64_t size);
+ void montauk::mfree(void* ptr);
+ void* montauk::realloc(void* ptr, uint64_t size);
+
DESCRIPTION
The userspace heap provides dynamic memory allocation on top of
- the kernel's page-mapping syscall (SYS_ALLOC). Include the
- header <montauk/heap.h> to use these functions.
+ anonymous virtual memory. The Montauk C++ API and libc's
+ malloc/free API use the same process-wide allocator.
+
malloc
Allocates 'size' bytes from the free list. Returns a 16-byte
aligned pointer, or nullptr on failure. When the free list is
- empty, it requests more pages from the kernel via SYS_ALLOC
- (minimum 16 KiB growth, initial seed of 64 KiB).
+ empty, it reserves more pages from the kernel. Physical pages
+ are committed as they are first touched.
char* buf = (char*)montauk::malloc(1024);
+
mfree
- Returns the block to the userspace free list. No syscall is
- made -- the memory stays mapped and is immediately reusable.
+ Returns the block to the userspace allocator. Arena blocks are
+ immediately reusable; large direct mappings are returned to the
+ kernel, including their virtual address range.
Passing nullptr is a safe no-op.
montauk::mfree(buf);
+
realloc
- Resizes the allocation to 'size' bytes. Allocates a new block,
- copies the smaller of old/new sizes, and frees the old block.
+ Resizes the allocation to 'size' bytes. A block with sufficient
+ capacity is retained; otherwise a new block is allocated, the
+ smaller of old/new requested sizes is copied, and the old block
+ is freed. Integer overflow fails without changing the old block.
If ptr is nullptr, behaves like malloc.
buf = (char*)montauk::realloc(buf, 2048);
-IMPLEMENTATION
- The allocator uses a linked free-list with first-fit search.
- Blocks larger than needed are split. The allocation header is
- 16 bytes (magic + size). All allocations are 16-byte aligned.
- The heap grows by requesting pages from the kernel via
- SYS_ALLOC. These pages are never returned to the kernel (since
- SYS_FREE is currently a no-op), but mfree makes them available
- for future malloc calls within the process.
+IMPLEMENTATION
+ The allocator uses segregated size-class bins and a coalescing
+ address-ordered overflow list. Headers retain both requested size
+ and actual block extent. A process-wide lock serializes C and C++
+ allocation calls. All returned pointers are 16-byte aligned.
+
+ Allocations of 256 KiB or more use direct page mappings so they
+ can be released promptly. Smaller allocations use growing arenas.
+
LOW-LEVEL PAGE API
For large allocations or when direct page control is needed:
void* montauk::alloc(uint64_t size); // SYS_ALLOC
- void montauk::free(void* ptr); // SYS_FREE (no-op)
+ void montauk::free(void* ptr); // SYS_FREE
+
+ alloc() reserves zero-filled, read/write, non-executable pages.
+ Size is rounded up to 4 KiB. Freed ranges are reusable.
- alloc() maps zeroed pages starting at 0x40000000 and growing
- upward. Size is rounded up to 4 KiB page boundaries.
SEE ALSO
- syscalls(2), file(2)
-
+ syscalls(2), file(2)
NAME
man - display manual pages
+
SYNOPSIS
- man topic
- man section topic
+ man topic
+ man section topic
+
DESCRIPTION
The man command displays manual pages from the ramdisk in a
@@ -124,9 +126,10 @@
in order. If a section number is given, only that section is
checked.
+
KEY BINDINGS
-Navigation
+ Navigation
j, Down Arrow Scroll down one line
k, Up Arrow Scroll up one line
Space, Page Down Scroll down one page
@@ -135,12 +138,14 @@
G, End Go to bottom
q Quit
+
SECTIONS
1 User commands and programs
2 System calls (kernel interface)
3 Library functions (userspace libraries)
7 Miscellaneous (legal, conventions)
+
FILES
Man pages are stored on the ramdisk at:
@@ -148,15 +153,16 @@
For example, man intro reads 0:/man/intro.1
+
EXAMPLES
man intro View the introduction
man 2 syscalls View syscall overview (section 2)
man malloc View malloc documentation
man legal View copyright information
-SEE ALSO
- intro(1), shell(1), syscalls(2)
+SEE ALSO
+ intro(1), shell(1), syscalls(2)
NAME
nslookup - DNS hostname lookup
+
SYNOPSIS
nslookup <hostname>
+
DESCRIPTION
Resolves a hostname to an IPv4 address using the configured
DNS server and prints the result.
@@ -122,6 +124,7 @@
configured DNS server and waits up to 5 seconds for a reply.
Results are cached in an 8-entry kernel cache with TTL support.
+
OUTPUT
Server: 10.0.68.1
Name: example.com
@@ -132,18 +135,20 @@
Could not resolve: badhost.invalid
+
DNS CONFIGURATION
The DNS server address is obtained automatically via DHCP.
It can also be viewed and set with ifconfig. The default
is 10.0.68.1 (QEMU user-mode networking).
+
EXAMPLES
nslookup google.com
nslookup icanhazip.com
-SEE ALSO
- ping(1), fetch(1), dhcp(1), ifconfig(1), syscalls(2)
+SEE ALSO
+ ping(1), fetch(1), dhcp(1), ifconfig(1), syscalls(2)
NAME
ping - send ICMP echo requests
+
SYNOPSIS
ping <host>
+
DESCRIPTION
Sends 4 ICMP echo requests to the specified host and prints
the round-trip time for each reply.
@@ -124,6 +126,7 @@
Each request has a 3-second timeout. Requests are sent at
1-second intervals.
+
OUTPUT
PING example.com (93.184.216.34)
Reply from 93.184.216.34: time=12ms
@@ -135,6 +138,7 @@
Request timed out
+
EXAMPLES
ping 10.0.68.1
Ping the gateway by IP address.
@@ -142,9 +146,9 @@
ping google.com
Ping by hostname (requires DNS).
-SEE ALSO
- nslookup(1), ifconfig(1), shell(1), syscalls(2)
+SEE ALSO
+ nslookup(1), ifconfig(1), shell(1), syscalls(2)
NAME
printctl - configure printers and submit print jobs
+
SYNOPSIS
-printctl
-command
-[options]
+ printctl
+ command
+ [ options ]
+
DESCRIPTION
-printctl
+ printctl
manages the MontaukOS userspace print spooler and submits print jobs to IPP printers.
+
COMMANDS
-set-printer URI
- Store the default printer URI.
+ set-printer URI
+Store the default printer URI.
-show-printer
- Print the configured default printer URI.
+ show-printer
+Print the configured default printer URI.
-print FILE [--printer URI] [--name JOB] [--wait]
- Queue a file for printing.
+ print FILE [--printer URI] [--name JOB] [--wait]
+Queue a file for printing.
-test-page [--printer URI] [--wait] [--no-wait]
- Generate and queue a simple test page.
+ test-page [--printer URI] [--wait] [--no-wait]
+Generate and queue a simple test page.
-status [--verbose]
- Show daemon state and queued, active, completed, and failed jobs.
+ status [--verbose]
+Show daemon state and queued, active, completed, and failed jobs.
-inspect JOB-ID
- Show full metadata and debug details for a queued, active, completed, or failed job.
-
-probe [URI]
- Probe the configured printer, print host and resolution details, and show IPP capability diagnostics.
+ inspect JOB-ID
+Show full metadata and debug details for a queued, active, completed, or failed job.
+ probe [URI]
+Probe the configured printer, print host and resolution details, and show IPP capability diagnostics.
NAME
printd - MontaukOS userspace print spooler daemon
+
SYNOPSIS
-printd
+ printd
+
DESCRIPTION
-printd
+ printd
monitors the print spool directories, claims queued jobs, and delivers them to IPP printers.
It is normally launched automatically by
-init(1)
+ init (1)
and does not require direct user interaction.
-
NAME
shell - MontaukOS interactive command shell
+
DESCRIPTION
The MontaukOS shell is a command interpreter launched by init
after system services have started. It provides command
@@ -121,6 +122,7 @@
a command is not a builtin, the shell searches for a matching
ELF binary and executes it as a child process.
+
COMMAND RESOLUTION
When a non-builtin command is entered, the shell searches for
a matching binary in the following order:
@@ -144,16 +146,20 @@
Arguments after the command name are passed to the spawned
process.
+
BUILTINS
+
help
Display a categorized list of available commands.
+
ls [dir]
List files in the current directory, or in the specified
directory. Directory entries are shown with a trailing slash.
Examples: ls, ls man, ls os
+
cd [dir]
Change the working directory. With no argument, returns to the
logged-in user's home directory (0:/users/<user>); with /,
@@ -161,33 +167,42 @@
The shell prompt reflects the current directory.
Examples: cd os, cd .., cd
+
pwd
Print the current working directory as an absolute path
(e.g. "0:/os").
+
echo [-n] ...
Print the arguments. -n suppresses the trailing newline.
+
set [VAR=value]
With no argument, list all shell variables (built-in and
user-defined). With VAR=value, set a variable. With a bare
name, print that variable's value.
+
unset VAR
Remove a user-defined shell variable.
+
true / false
Return exit status 0 / 1 without doing anything. Useful with
&& and ||.
+
N:
A bare "<number>:" (e.g. "1:") switches the current drive to
drive N and resets the working directory to that drive's root.
+
exit
Terminate the shell process (with the last command's exit code).
+
SYNTAX
+
Variables
NAME=value Set a shell variable (no leading $)
$VAR or ${VAR} Expand a variable's value
@@ -196,11 +211,13 @@
home directory, current directory)
\$ Escape a literal '$'
+
Tilde expansion
A leading ~ expands to the session home directory
(0:/users/<user>) when followed by end-of-string, '/', or a
space.
+
Command chaining
cmd1 ; cmd2 Run cmd2 unconditionally after cmd1
cmd1 && cmd2 Run cmd2 only if cmd1 succeeded (exit 0)
@@ -209,25 +226,29 @@
Single and double quotes protect ;, &&, and || from being
treated as separators.
+
Comments
A '#' outside of quotes starts a comment; the rest of the line
is ignored.
+
EXTERNAL COMMANDS
All external commands live in 0:/os/ (see COMMAND RESOLUTION).
Where a dedicated man page exists it is noted below; run
'man <command>' for details.
+
File commands
cat <file> Display file contents
- edit [file] Text editor -- see edit(1)
+ edit [file] Text editor -- see edit(1)
copy <src> <dst> Copy a file
move <src> <dst> Move/rename a file
rm <file> Remove a file
touch <file> Create an empty file
+
System commands
- man <topic> View manual pages -- see man(1)
+ man <topic> View manual pages -- see man(1)
whoami Print the current username
info / mtkfetch Show system information
date Show current date and time
@@ -235,30 +256,39 @@
proclist List running processes
power CPU power/thermal status (power [watch [secs]])
clear Clear the screen and framebuffer
- fontscale [n] Get or set terminal font scale -- see fontscale(1)
+ fontscale [n] Get or set terminal font scale -- see fontscale(1)
lua Lua interpreter
tcc TinyCC (in-system C compiler)
- reset Reboot the system
- shutdown Shut down the system
+ reset / reboot Request a supervised system reboot
+ shutdown / poweroff Request a supervised system shutdown
+ suspend Enter ACPI sleep
+
+ Interactive shutdown and reboot are shell builtins: they post a
+ capability-checked request and exit the console, allowing login.elf to
+ flush filesystems and perform the final power operation. They do not grant
+ CAP_POWER_CONTROL to the shell.
+
Network commands
- ping <host> Send ICMP echo requests -- see ping(1)
- nslookup <host> DNS lookup -- see nslookup(1)
+ ping <host> Send ICMP echo requests -- see ping(1)
+ nslookup <host> DNS lookup -- see nslookup(1)
ifconfig Show/set network configuration
tcpconnect <host> <port> Interactive TCP client
irc IRC client
- dhcp DHCP client -- see dhcp(1)
- fetch <url> HTTP/HTTPS client (TLS 1.2) -- see fetch(1)
- wiki <title> Wikipedia article viewer -- see wiki(1)
+ dhcp DHCP client -- see dhcp(1)
+ fetch <url> HTTP/HTTPS client (TLS 1.2) -- see fetch(1)
+ wiki <title> Wikipedia article viewer -- see wiki(1)
httpd HTTP server
Network commands accept both IP addresses and hostnames.
Hostnames are resolved via the configured DNS server.
+
Bluetooth
btlist List connected Bluetooth devices
btbonds List bonded (paired) Bluetooth devices
+
Software-defined radio
sdr [freqMHz [rateHz]] Receive and report basic signal
statistics from an attached RTL-SDR dongle
@@ -270,22 +300,26 @@
disks, devexplorer, procmgr, powermgr, printers, timezone,
weather, wikipedia. There is no 0:/games/ directory.
+
TAB COMPLETION
Pressing Tab completes the word under the cursor against, in
order: executable names in 0:/os/, shell builtins, and file/
directory entries in the current directory. A single match is
completed inline; multiple matches are listed below the prompt.
+
INPUT
The shell uses non-blocking keyboard input via SYS_GETKEY (with
SYS_INPUT_WAIT to sleep between events) to support arrow key
detection. Lines are limited to 255 characters.
+
Editing
Backspace Delete character before cursor
Tab Tab-complete the current word
Enter Execute the command line
+
History
The shell stores the last 32 unique commands. Duplicate
consecutive entries are suppressed.
@@ -293,6 +327,7 @@
Up Arrow Recall previous command
Down Arrow Recall next command (or clear line)
+
PROMPT
The prompt displays the current drive and working directory:
@@ -300,9 +335,9 @@
0:/os> _ (in os/ directory)
1:/> _ (at root of drive 1)
-SEE ALSO
- man(1), intro(1), syscalls(2)
+SEE ALSO
+ man(1), intro(1), syscalls(2)
NAME
spawn, waitpid - create and wait for processes
+
SYNOPSIS
- int montauk::spawn(const char* path, const char* args = nullptr);
- void montauk::waitpid(int pid);
- int montauk::getargs(char* buf, uint64_t maxLen);
+ int montauk::spawn(const char* path, const char* args = nullptr);
+ void montauk::waitpid(int pid);
+ int montauk::getargs(char* buf, uint64_t maxLen);
+
DESCRIPTION
+
spawn
Loads the ELF64 binary at the given VFS path and creates a new
process. The path must include the drive prefix, for example:
@@ -136,6 +139,7 @@
Failure occurs when there are no free process slots (max 256),
the file cannot be found, or the ELF is invalid.
+
waitpid
Blocks the calling process until the process with the given PID
has exited. Internally, this yields the CPU in a loop:
@@ -146,6 +150,7 @@
it spawns a child and waits for it to complete before showing
the next prompt.
+
EXAMPLES
Spawn a program and wait for it:
@@ -157,6 +162,7 @@
montauk::print("child exited\n");
}
+
getargs
Copies the argument string into buf (up to maxLen bytes, always
null-terminated). Returns the number of characters copied, or
@@ -168,15 +174,20 @@
The argument string is set by the parent when calling spawn().
If no arguments were provided, the buffer will be empty.
+ A spawned child inherits a snapshot of its parent's environment. Libc
+ exposes it through getenv(), setenv(), and environ. posix_spawn() can
+ instead provide an explicit envp for the child.
+
+
NOTES
The _start() entry point receives no argc/argv. Use getargs()
to retrieve the argument string passed by the parent process.
Process exit codes are not yet collected by waitpid.
-SEE ALSO
- syscalls(2), file(2)
+SEE ALSO
+ syscalls(2), file(2)
NAME
syscalls - overview of MontaukOS system calls
+
DESCRIPTION
- 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:
+ MontaukOS provides 178 system calls (numbers 0-186, with numbers
+ 140-148 reserved) 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
@@ -130,119 +130,222 @@
montauk:: namespace. This page groups syscalls the same way the
kernel source does (one subsystem header per group).
+
+CAPABILITY SECURITY
+ Privileged authority is stored in kernel-owned process credentials, not
+ inferred from a process name, PID, executable path, or merely from the
+ owner name returned by SYS_GETUSER. The owner identity may namespace
+ per-user resources such as the clipboard, but no owner name implies
+ administrative authority. The kernel-created init process is
+ the root of the delegation tree. Login authenticates a user and delegates
+ the appropriate session capabilities; there is no special "system" user
+ shortcut in the kernel.
+
+ Each process has three uint64_t masks, exposed in ProcInfo:
+
+ permitted capabilities owned by the process
+ effective permitted capabilities accepted by syscall checks
+ delegable permitted capabilities that may be given to children
+
+ Effective and delegable must be subsets of permitted. SYS_SPAWN and the
+ other ordinary spawn variants give the child no capabilities. A parent
+ uses SYS_SPAWN_CAPS to make an explicit delegation. Every requested
+ permitted or delegable bit must be present in the parent's delegable mask,
+ so a non-delegable grant cannot be propagated through another generation.
+ Invalid or unauthorized requests return SYS_ERR_PERMISSION (-13).
+
+ Capability bits and protected operations are:
+
+ CAP_PROCESS_ADMIN kill unrelated processes or whole sessions
+ CAP_POWER_REQUEST post a graceful shutdown/reboot request
+ CAP_POWER_CONTROL consume power requests; reset or power off
+ CAP_SUSPEND enter ACPI sleep
+ CAP_STORAGE_ADMIN change partitions, mounts, or filesystems
+ CAP_RAW_STORAGE raw disk reads and writes
+ CAP_NETWORK_ADMIN change network/Wi-Fi configuration
+ CAP_SET_TIME set wall-clock time or timezone
+ CAP_USER_ADMIN manage users/trusted config; override owner at spawn
+ CAP_DISPLAY_ADMIN set display mode or brightness
+ CAP_DEVICE_ADMIN claim USB interfaces or change Bluetooth state
+ CAP_LOG_READ read the kernel log
+ CAP_SYSTEM_IMAGE write the program images in 0:/os and 0:/apps
+
+ CAP_STANDARD_SESSION contains CAP_POWER_REQUEST and CAP_SUSPEND.
+ CAP_ADMIN_SESSION adds the administrative capabilities above except
+ CAP_POWER_CONTROL and CAP_SYSTEM_IMAGE. Final shutdown/reset authority is
+ deliberately retained by login, the trusted session supervisor.
+ SYS_POWERINFO remains readable without a capability, so the powermgr GUI
+ and power command are monitors, not privileged power daemons.
+
+ CAP_SYSTEM_IMAGE is likewise excluded from every session and from the
+ "all" wildcard in 0:/config/capabilities.toml, and must be named
+ explicitly to be granted. Capability grants are keyed on binary path, so
+ write access to 0:/os or 0:/apps is equivalent to holding whatever those
+ images are granted the next time a launcher runs them. Partitioning or
+ formatting a volume is CAP_STORAGE_ADMIN and does not carry it.
+
+ The authentication and trusted-service configuration files users.toml,
+ setup.toml, init.toml, and ssh.toml are readable by ordinary processes but
+ require CAP_USER_ADMIN to create, replace, delete, or write. The kernel
+ also protects the 0:/config directory entry against replacement. This
+ prevents changing a userspace role string from becoming a route to new
+ kernel authority at the next login or boot.
+
+
PROCESS MANAGEMENT
-SYS_EXIT (0)
+ SYS_EXIT (0)
Terminate the calling process.
[[noreturn]] void montauk::exit(int code = 0);
-SYS_YIELD (1)
+ SYS_YIELD (1)
Yield the remainder of the time slice.
void montauk::yield();
-SYS_SLEEP_MS (2)
+ SYS_SLEEP_MS (2)
Sleep for at least the given number of milliseconds.
void montauk::sleep_ms(uint64_t ms);
-SYS_GETPID (3)
+ SYS_GETPID (3)
Return the PID of the calling process.
int montauk::getpid();
-SYS_SPAWN (20)
- Spawn a new process from an ELF binary on the VFS.
+ SYS_SPAWN (20)
+ Spawn a new process from an ELF binary on the VFS. The child inherits
+ a snapshot of the caller's environment but no capabilities.
int montauk::spawn(const char* path, const char* args = nullptr);
-SYS_WAITPID (23)
- Block until the given process has exited.
- void montauk::waitpid(int pid);
+ SYS_SPAWN_CAPS (185)
+ Spawn a child with explicit permitted, effective, and delegable masks.
+ The child masks must satisfy the subset rules described under CAPABILITY
+ SECURITY. Passing a non-null user override additionally requires the
+ caller to have effective CAP_USER_ADMIN; null inherits the parent owner.
+ int montauk::spawn_with_caps(
+ const char* path, const char* args, const char* user,
+ const montauk::abi::SpawnCapabilities& capabilities);
-SYS_GETARGS (25)
+ SYS_WAITPID (23)
+ Block until the given process has exited. Returns 0-255 for a normal
+ exit, 256 plus the signal number if it was killed or crashed, or 0 if
+ the PID is unknown or its exit record is no longer available.
+ int montauk::waitpid(int pid);
+
+ SYS_GETARGS (25)
Get the argument string passed to this process at spawn time.
int montauk::getargs(char* buf, uint64_t maxLen);
-SYS_PROCLIST (61)
+ SYS_GETEXECPATH (151)
+ Copy the absolute path from which this process was spawned into buf.
+ Returns the copied path length, or -1 on invalid arguments.
+ int mtk_getexecpath(char* buf, unsigned long maxLen);
+
+ SYS_GETENVIRON (171), SYS_SETENVIRON (172), SYS_SPAWN_ENV (173)
+ Libc process-environment transport. Environment data is encoded as
+ consecutive NAME=VALUE strings with a final empty string. Applications
+ normally use getenv(3), setenv(3), environ, and posix_spawn(3).
+
+ SYS_PROCLIST (61)
List running processes (pid, parent, state, name, heap usage,
- accumulated CPU time).
+ accumulated CPU time, and permitted/effective/delegable capability masks).
int montauk::proclist(montauk::abi::ProcInfo* buf, int max);
-SYS_KILL (62)
- Terminate another process by PID.
+ SYS_KILL (62)
+ Terminate a process by PID. Any process may terminate one of its own
+ descendants. Terminating an unrelated process requires
+ CAP_PROCESS_ADMIN.
int montauk::kill(int pid);
-SYS_CHDIR (96)
+ SYS_SETSESSION (174)
+ Make the calling process the leader of a new process session. Processes
+ spawned afterward inherit the session identifier.
+ int montauk::setsession();
+
+ SYS_KILLSESSION (175)
+ Terminate all live processes in a process session. Returns the number of
+ members signalled; repeat until zero to wait for complete teardown.
+ Requires CAP_PROCESS_ADMIN.
+ int montauk::killsession(int sessionId);
+
+ SYS_CHDIR (96)
Change the calling process's current working directory.
int montauk::chdir(const char* path);
-SYS_GETCWD (95)
- Get the calling process's current working directory.
+ SYS_GETCWD (95)
+ Get the calling process's current working directory. Returns the path
+ length on success, -2 if maxLen cannot hold the path and terminating NUL,
+ or -1 for another failure. The buffer is not modified when it is too small.
int montauk::getcwd(char* buf, uint64_t maxLen);
-SYS_SETUSER (92)
+ SYS_SETUSER (92)
Associate a process with a logged-in user name (used by login/session
- management).
+ management and per-user resource isolation). Requires CAP_USER_ADMIN.
+ The name never grants capabilities or implies administrator status.
int montauk::setuser(int pid, const char* name);
-SYS_GETUSER (93)
+ SYS_GETUSER (93)
Get the user name associated with the calling process.
int montauk::getuser(char* buf, uint64_t maxLen);
+
THREADING
- Threads share the spawning process's address space and heap
+ Threads share the calling process's address space and heap
(see montauk/heap.h for the heap lock). Declared in
montauk/thread.h.
-SYS_THREAD_SPAWN (130)
+ SYS_THREAD_SPAWN (130)
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);
-SYS_THREAD_EXIT (131)
+ SYS_THREAD_EXIT (131)
Terminate only the calling thread. If it is the main thread,
the whole process exits.
[[noreturn]] void montauk::thread_exit(int code = 0);
-SYS_THREAD_JOIN (132)
+ SYS_THREAD_JOIN (132)
Block until the given TID exits, then reclaim its kernel state.
int montauk::thread_join(int tid, int* out_code = nullptr);
-SYS_THREAD_SELF (133)
+ SYS_THREAD_SELF (133)
Return the calling thread's TID (equals getpid() for the main
thread).
int montauk::thread_self();
+
CONSOLE I/O
-SYS_PRINT (4)
+ SYS_PRINT (4)
Write a null-terminated string to the terminal.
void montauk::print(const char* text);
-SYS_PUTCHAR (5)
+ SYS_PUTCHAR (5)
Write a single character to the terminal.
void montauk::putchar(char c);
+
FILE I/O
-SYS_OPEN (6)
+ SYS_OPEN (6)
Open a file. Returns a handle or negative on error.
int montauk::open(const char* path);
-SYS_READ (7)
+ SYS_READ (7)
Read bytes from a file at a given offset.
int montauk::read(int h, uint8_t* buf, uint64_t off, uint64_t sz);
-SYS_GETSIZE (8)
+ SYS_GETSIZE (8)
Get the size of an open file in bytes.
uint64_t montauk::getsize(int handle);
-SYS_CLOSE (9)
+ SYS_CLOSE (9)
Close a file handle.
void montauk::close(int handle);
-SYS_READDIR (10)
- 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.
+ SYS_READDIR (10)
+ List directory entries (max 256 per call for ramdisk directories,
+ 128 for FAT32 and ext2 directories). For larger directories use
+ SYS_READDIR_AT.
int montauk::readdir(const char* path, const char** names, int max);
-SYS_READDIR_AT (136)
+ SYS_READDIR_AT (136)
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
@@ -250,120 +353,164 @@
int montauk::readdir_at(const char* path, const char** names,
int max, int startIndex);
-SYS_FWRITE (41)
+ SYS_FWRITE (41)
Write bytes to a file at a given offset.
int montauk::fwrite(int handle, const uint8_t* buf,
uint64_t offset, uint64_t size);
-SYS_FCREATE (42)
+ SYS_FCREATE (42)
Create a new file on the target volume. Returns a handle or
negative on error.
int montauk::fcreate(const char* path);
-SYS_FDELETE (77)
+ SYS_FDELETE (77)
Delete a file.
int montauk::fdelete(const char* path);
-SYS_FMKDIR (78)
+ SYS_FMKDIR (78)
Create a directory.
int montauk::fmkdir(const char* path);
-SYS_FRENAME (94)
+ SYS_FRENAME (94)
Rename or move a file/directory (used as the basis for file
manager move operations).
int montauk::frename(const char* oldPath, const char* newPath);
-SYS_DRIVELIST (79)
+ SYS_STAT (152)
+ Get a path's size, timestamps, mode, and directory status.
+ int montauk::stat(const char* path, montauk::abi::FileStat* out);
+
+ SYS_UTIME (167)
+ Set a path's access and modification timestamps. This is the kernel
+ transport used by the libc utime(3) interface.
+ int utime(const char* path, const struct utimbuf* times);
+
+ SYS_DRIVELIST (79)
List mounted drive numbers.
int montauk::drivelist(int* outDrives, int max);
-SYS_DRIVELABEL (124)
+ SYS_DRIVELABEL (124)
Get the volume label of a drive.
int montauk::drivelabel(int drive, char* outLabel, int maxLen);
-SYS_DRIVEKIND (127)
+ SYS_DRIVEKIND (127)
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);
+
MEMORY
-SYS_ALLOC (11)
+ SYS_ALLOC (11)
Map zeroed pages into the process address space.
void* montauk::alloc(uint64_t size);
-SYS_FREE (12)
- Reserved (currently a no-op).
+ SYS_FREE (12)
+ Release a complete mapping previously returned by SYS_ALLOC.
void montauk::free(void* ptr);
-SYS_MEMSTATS (67)
+ SYS_MMAP_ANON (168)
+ Reserve a zero-filled anonymous mapping with read/write/execute
+ protection flags. Pages are committed on first access. Writable
+ executable mappings are rejected.
+ void* mmap(void*, size_t, int, int, int, long);
+
+ SYS_MUNMAP (169)
+ Release a page-aligned range. Partial unmap splits the VM area and
+ makes the virtual range reusable.
+ int munmap(void* addr, size_t length);
+
+ SYS_MPROTECT (170)
+ Change read/write/execute permissions on an anonymous mapping.
+ int mprotect(void* addr, size_t length, int prot);
+
+ SYS_MEMSTATS (67)
Get kernel-wide physical memory usage (total/free/used bytes,
page size).
void montauk::memstats(montauk::abi::MemStats* out);
+
TIMEKEEPING
-SYS_GETTICKS (13)
+ SYS_GETTICKS (13)
Get APIC timer ticks since boot.
uint64_t montauk::get_ticks();
-SYS_GETMILLISECONDS (14)
+ SYS_GETMILLISECONDS (14)
Get milliseconds elapsed since boot.
uint64_t montauk::get_milliseconds();
-SYS_GETTIME (28)
- Get the current wall-clock date and time (UTC).
+ SYS_GETTIME (28)
+ Get the current wall-clock date and time in the configured timezone.
Fills a montauk::abi::DateTime struct with Year, Month, Day,
Hour, Minute, and Second fields.
void montauk::gettime(montauk::abi::DateTime* out);
-SYS_SETTZ (90)
- Set the process/system timezone offset, in minutes from UTC.
- void montauk::settz(int offset_minutes);
+ SYS_SETUNIXTIME (153)
+ Set the system wall clock from a UTC Unix timestamp. Returns 0 on
+ success or -1 if the timestamp is outside the supported range. Requires
+ CAP_SET_TIME.
+ int montauk::set_unix_time(int64_t unixSeconds);
-SYS_GETTZ (91)
+ SYS_SETTZ (90)
+ Set the system-wide timezone offset, in minutes from UTC. Requires
+ CAP_SET_TIME.
+ int montauk::settz(int offset_minutes);
+
+ SYS_GETTZ (91)
Get the current timezone offset, in minutes from UTC.
int montauk::gettz();
+
SYSTEM
-SYS_GETINFO (15)
+ SYS_GETINFO (15)
Get OS name, version string, API version, max process count,
and the monotonic kernel build number.
void montauk::get_info(montauk::abi::SysInfo* info);
+
KEYBOARD
-SYS_ISKEYAVAILABLE (16)
+ SYS_ISKEYAVAILABLE (16)
Check if a key event is pending (non-blocking).
bool montauk::is_key_available();
-SYS_GETKEY (17)
+ SYS_GETKEY (17)
Get the next key event (press or release).
void montauk::getkey(montauk::abi::KeyEvent* out);
-SYS_GETCHAR (18)
+ SYS_GETCHAR (18)
Block until a printable character is typed.
char montauk::getchar();
-SYS_INPUT_WAIT (123)
+ SYS_GETCHAR_NB (166)
+ Return the next printable character, or 0 when none is
+ pending. Never blocks; key events carrying no ascii are
+ drained rather than left to stall a following getchar.
+ char montauk::getchar_nb();
+
+ SYS_INPUT_WAIT (123)
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);
+ uint64_t montauk::input_wait(uint64_t observedSerial,
+ uint64_t timeoutMs);
+
MOUSE
-SYS_MOUSESTATE (47)
+ SYS_MOUSESTATE (47)
Get the current mouse position, scroll delta, and button mask.
void montauk::mouse_state(montauk::abi::MouseState* out);
-SYS_SETMOUSEBOUNDS (48)
+ SYS_SETMOUSEBOUNDS (48)
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);
+
NETWORKING
-SYS_PING (19)
+ SYS_PING (19)
Send an ICMP echo request and wait for reply.
int32_t montauk::ping(uint32_t ip, uint32_t timeoutMs = 3000);
-SYS_RESOLVE (44)
+ SYS_RESOLVE (44)
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
@@ -371,81 +518,158 @@
and returned directly without a DNS query.
uint32_t montauk::resolve(const char* hostname);
-SYS_GETNETCFG (37)
+ SYS_GETNETCFG (37)
Get the current network configuration (IP, mask, gateway, MAC,
DNS server).
void montauk::get_netcfg(montauk::abi::NetCfg* out);
-SYS_SETNETCFG (38)
- Set the network configuration (IP, mask, gateway, DNS server).
+ SYS_SETNETCFG (38)
+ Set the network configuration (IP, mask, gateway, DNS server). Requires
+ CAP_NETWORK_ADMIN.
int montauk::set_netcfg(const montauk::abi::NetCfg* cfg);
-SYS_NETSTATUS (125)
+ SYS_NETSTATUS (125)
Get adapter status including driver name, link state, polling mode,
and RX/TX packet counters.
int montauk::net_status(montauk::abi::NetStatus* out);
+ SYS_NETIFS (165)
+ List registered link-layer network interfaces. The global IP
+ configuration belongs to the entry whose active field is set.
+ int montauk::net_interfaces(montauk::abi::NetIfInfo* buf,
+ int maxCount);
+
+
+WI-FI
+ SYS_WIFI_SCAN (158)
+ Perform a channel scan and block until it finishes or timeoutMs
+ elapses. Returns the number of results, or -1 if no adapter is ready.
+ Requires CAP_NETWORK_ADMIN because it changes radio state.
+ int montauk::wifi_scan(montauk::abi::WifiNetwork* buf,
+ int maxCount, uint32_t timeoutMs);
+
+ SYS_WIFI_INFO (159)
+ Get adapter, link, scan, join, and last-error status.
+ int montauk::wifi_info(montauk::abi::WifiInfo* out);
+
+ SYS_WIFI_CONNECT (160)
+ Join a network and block until the link is up or the attempt fails.
+ Requires CAP_NETWORK_ADMIN.
+ int montauk::wifi_connect(const char* ssid,
+ const char* password);
+
+ SYS_WIFI_DISCONNECT (161)
+ Disconnect from the current Wi-Fi network. Requires CAP_NETWORK_ADMIN.
+ int montauk::wifi_disconnect();
+
+ SYS_WIFI_SCAN_START (162)
+ Start a non-blocking channel scan. Returns 0 if started, 1 if a scan
+ is already running, or -1 if no adapter is ready. Requires
+ CAP_NETWORK_ADMIN.
+ int montauk::wifi_scan_start(uint32_t timeoutMs);
+
+ SYS_WIFI_RESULTS (163)
+ Copy results from the most recent scan without accessing the radio.
+ int montauk::wifi_results(montauk::abi::WifiNetwork* buf,
+ int maxCount);
+
+ SYS_WIFI_CONNECT_ASYNC (164)
+ Start a non-blocking network join. Observe SYS_WIFI_INFO for progress
+ and the final result. Requires CAP_NETWORK_ADMIN.
+ int montauk::wifi_connect_async(const char* ssid,
+ const char* password);
+
+
SOCKETS
-SYS_SOCKET (29)
+ SYS_SOCKET (29)
Create a socket. type=SOCK_TCP (1) or SOCK_UDP (2).
Returns fd or -1.
int montauk::socket(int type);
-SYS_CONNECT (30)
+ SYS_CONNECT (30)
Connect a TCP socket to a remote host.
int montauk::connect(int fd, uint32_t ip, uint16_t port);
-SYS_BIND (31)
+ SYS_BIND (31)
Bind a socket to a local port for listening.
int montauk::bind(int fd, uint16_t port);
-SYS_LISTEN (32)
+ SYS_LISTEN (32)
Start listening for incoming TCP connections.
int montauk::listen(int fd);
-SYS_ACCEPT (33)
+ SYS_ACCEPT (33)
Accept an incoming connection on a listening socket.
Returns a new socket fd for the client connection.
int montauk::accept(int fd);
-SYS_SEND (34)
+ SYS_SEND (34)
Send data on a connected socket. Returns bytes sent.
int montauk::send(int fd, const void* data, uint32_t len);
-SYS_RECV (35)
+ SYS_RECV (35)
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);
-SYS_CLOSESOCK (36)
+ SYS_CLOSESOCK (36)
Close a socket and release its resources.
int montauk::closesocket(int fd);
-SYS_SENDTO (39)
+ SYS_SENDTO (39)
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);
-SYS_RECVFROM (40)
+ SYS_RECVFROM (40)
Receive a UDP datagram. Returns the source address.
int montauk::recvfrom(int fd, void* buf, uint32_t maxLen,
uint32_t* srcIp, uint16_t* srcPort);
+
FRAMEBUFFER
-SYS_FBINFO (21)
+ SYS_FBINFO (21)
Get framebuffer dimensions and format.
void montauk::fb_info(montauk::abi::FbInfo* info);
-SYS_FBMAP (22)
+ SYS_FBMAP (22)
Map the framebuffer into process memory.
void* montauk::fb_map();
+ SYS_FBFLIP (150)
+ Flip between double-buffered hardware scanout buffers. Index -1
+ queries support; index -2 acquires ownership and returns the current
+ front-buffer index. Flag bit 0 waits for vertical blank.
+ int64_t montauk::fb_flip(int64_t index, uint64_t flags);
+
+
+DISPLAY CONTROL
+ SYS_DISPLAYINFO (154)
+ Get connector, mode, capability, and brightness information.
+ int montauk::display_info(montauk::abi::DisplayInfo* out);
+
+ SYS_DISPLAYMODES (155)
+ Enumerate supported display modes. Returns the number written.
+ int montauk::display_modes(montauk::abi::DisplayModeInfo* out,
+ int maxCount);
+
+ SYS_DISPLAYSETMODE (156)
+ Switch to a mode returned by SYS_DISPLAYMODES. Requires
+ CAP_DISPLAY_ADMIN.
+ int montauk::display_set_mode(int modeIndex);
+
+ SYS_DISPLAYBRIGHTNESS (157)
+ Set brightness to 0-100 percent, or pass -1 to query it. Setting requires
+ CAP_DISPLAY_ADMIN; querying does not.
+ int montauk::display_brightness(int percent = -1);
+
+
TERMINAL
-SYS_TERMSIZE (24)
+ SYS_TERMSIZE (24)
Get terminal dimensions (columns and rows).
void montauk::termsize(int* cols, int* rows);
-SYS_TERMSCALE (43)
+ SYS_TERMSCALE (43)
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
@@ -453,199 +677,244 @@
void montauk::termscale(int scale_x, int scale_y);
void montauk::get_termscale(int* scale_x, int* scale_y);
+
RANDOM
-SYS_GETRANDOM (45)
+ SYS_GETRANDOM (45)
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);
+
POWER MANAGEMENT
-SYS_RESET (26)
- Reboot the system.
- [[noreturn]] void montauk::reset();
+ SYS_RESET (26)
+ Reboot the system. Requires CAP_POWER_CONTROL. A successful call does not
+ return; an unauthorized call returns SYS_ERR_PERMISSION.
+ int montauk::reset();
-SYS_SHUTDOWN (27)
- Shut down the system.
- [[noreturn]] void montauk::shutdown();
+ SYS_SHUTDOWN (27)
+ Shut down the system. Requires CAP_POWER_CONTROL. A successful call does
+ not return; an unauthorized call returns SYS_ERR_PERMISSION.
+ int montauk::shutdown();
-SYS_SUSPEND (89)
- Enter ACPI S3 sleep. Returns after wake, 0 on success.
+ SYS_SUSPEND (89)
+ Enter ACPI S3 sleep. Returns after wake, 0 on success. Requires
+ CAP_SUSPEND.
int montauk::suspend();
-SYS_POWER_REQUEST (135)
+ SYS_POWER_REQUEST (135)
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);
+ shutdown()/reset(). Posting requires CAP_POWER_REQUEST; querying and
+ consuming the request requires CAP_POWER_CONTROL. See
+ montauk::abi::PowerRequestAction.
-SYS_POWERINFO (149)
+ A request may also come from inside a session -- the shell's shutdown
+ builtin posts one. Since login only reads the request after the session
+ leader exits, the leader polls POWER_REQ_PEEK, a non-destructive read
+ requiring only CAP_POWER_REQUEST, and exits when one is pending.
+ int montauk::power_request(int action);
+ int montauk::power_request_pending();
+
+ SYS_POWERINFO (149)
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*
+ montauk::abi::PowerInfo out;
+ int64_t rc = montauk::syscall1(
+ montauk::abi::SYS_POWERINFO, (uint64_t)&out);
+
KERNEL LOG
-SYS_LOG (46)
- Read from the kernel ring log buffer.
+ SYS_LOG (46)
+ Read from the kernel ring log buffer. Requires CAP_LOG_READ.
int64_t montauk::read_log(char* buf, uint64_t size);
+ SYS_LOG_WRITE (176)
+ Append a userspace message to the system log.
+ int64_t montauk::write_log(const char* message);
+
+
I/O REDIRECTION
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.
-SYS_SPAWN_REDIR (49)
- Spawn a process with its console I/O redirected to the caller.
+ SYS_SPAWN_REDIR (49)
+ Spawn a process with its console I/O redirected to the caller. The child
+ receives no capabilities.
int montauk::spawn_redir(const char* path, const char* args = nullptr);
-SYS_CHILDIO_READ (50)
+ SYS_SPAWN_REDIR_CAPS (186)
+ Spawn a redirected child with explicit capability masks. It applies the
+ same subset and parent-delegable checks as SYS_SPAWN_CAPS. An
+ administrative console explicitly lets its shell delegate selected
+ capabilities; the shell's executable policy gives each trusted tool a
+ delegable mask of zero, preventing further propagation.
+ int montauk::spawn_redir_with_caps(
+ const char* path, const char* args,
+ const montauk::abi::SpawnCapabilities& capabilities);
+
+ SYS_CHILDIO_READ (50)
Read buffered output produced by a redirected child.
int montauk::childio_read(int childPid, char* buf, int maxLen);
-SYS_CHILDIO_WRITE (51)
+ SYS_CHILDIO_WRITE (51)
Write text input to a redirected child's stdin.
int montauk::childio_write(int childPid, const char* data, int len);
-SYS_CHILDIO_WRITEKEY (52)
+ SYS_CHILDIO_WRITEKEY (52)
Forward a raw key event to a redirected child.
- int montauk::childio_writekey(int childPid, const montauk::abi::KeyEvent* key);
+ int montauk::childio_writekey(
+ int childPid, const montauk::abi::KeyEvent* key);
-SYS_CHILDIO_SETTERMSZ (53)
+ SYS_CHILDIO_SETTERMSZ (53)
Tell a redirected child its terminal dimensions changed.
int montauk::childio_settermsz(int childPid, int cols, int rows);
+ SYS_TERMINAL_ATTACHED (177)
+ Return 1 when the calling process has a redirected userspace
+ terminal output stream, otherwise return 0.
+ bool montauk::terminal_attached();
+
+
WINDOW SERVER
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).
-SYS_WINCREATE (54)
+ SYS_WINCREATE (54)
Create a window and get its pixel buffer.
int montauk::win_create(const char* title, int w, int h,
montauk::abi::WinCreateResult* result);
-SYS_WINDESTROY (55)
+ SYS_WINDESTROY (55)
Destroy a window.
int montauk::win_destroy(int id);
-SYS_WINPRESENT (56)
+ SYS_WINPRESENT (56)
Flush the pixel buffer to the screen.
uint64_t montauk::win_present(int id);
-SYS_WINPOLL (57)
+ SYS_WINPOLL (57)
Poll the next event (key, mouse, resize, close, scale) for a
window.
int montauk::win_poll(int id, montauk::abi::WinEvent* event);
-SYS_WINENUM (58)
+ SYS_WINENUM (58)
Enumerate all windows currently managed by the window server.
int montauk::win_enumerate(montauk::abi::WinInfo* info, int max);
-SYS_WINMAP (59)
+ SYS_WINMAP (59)
Map (or re-map) a window's pixel buffer into the caller's
address space.
uint64_t montauk::win_map(int id);
-SYS_WINUNMAP (97)
+ SYS_WINUNMAP (97)
Unmap a window's pixel buffer from the caller's address space.
int montauk::win_unmap(int id);
-SYS_WINSENDEVENT (60)
+ SYS_WINSENDEVENT (60)
Inject an event into a window's event queue.
int montauk::win_sendevent(int id, const montauk::abi::WinEvent* event);
-SYS_WINRESIZE (64)
+ SYS_WINRESIZE (64)
Resize a window and its pixel buffer.
uint64_t montauk::win_resize(int id, int w, int h);
-SYS_WINSETSCALE (65)
+ SYS_WINSETSCALE (65)
Set the desktop-wide UI scale factor.
int montauk::win_setscale(int scale);
-SYS_WINGETSCALE (66)
+ SYS_WINGETSCALE (66)
Get the desktop-wide UI scale factor.
int montauk::win_getscale();
-SYS_WINSETCURSOR (68)
+ SYS_WINSETCURSOR (68)
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);
-SYS_WINSETFLAGS (126)
+ SYS_WINSETFLAGS (126)
Set window flags (e.g. WIN_FLAG_FULLSCREEN).
int montauk::win_setflags(int id, uint32_t flags);
+
DEVICES
-SYS_DEVLIST (63)
+ SYS_DEVLIST (63)
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);
-SYS_DISKINFO (69)
+ SYS_DISKINFO (69)
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);
+
STORAGE
-SYS_PARTLIST (70)
+ SYS_PARTLIST (70)
Enumerate GPT partitions across all block devices.
int montauk::partlist(montauk::abi::PartInfo* buf, int max);
-SYS_DISKREAD (71)
- Raw, driver-agnostic sector read from a block device.
+ SYS_DISKREAD (71)
+ Raw, driver-agnostic sector read from a block device. Requires
+ CAP_RAW_STORAGE.
int64_t montauk::disk_read(int blockDev, uint64_t lba,
uint32_t sectorCount, void* buf);
-SYS_DISKWRITE (72)
- Raw, driver-agnostic sector write to a block device.
+ SYS_DISKWRITE (72)
+ Raw, driver-agnostic sector write to a block device. Requires
+ CAP_RAW_STORAGE.
int64_t montauk::disk_write(int blockDev, uint64_t lba,
uint32_t sectorCount, const void* buf);
-SYS_GPTINIT (73)
- Initialize a fresh GPT partition table on a block device.
+ SYS_GPTINIT (73)
+ Initialize a fresh GPT partition table on a block device. Requires
+ CAP_STORAGE_ADMIN.
int montauk::gpt_init(int blockDev);
-SYS_GPTADD (74)
- Add a partition to an existing GPT table.
+ SYS_GPTADD (74)
+ Add a partition to an existing GPT table. Requires CAP_STORAGE_ADMIN.
int montauk::gpt_add(const montauk::abi::GptAddParams* params);
-SYS_FSMOUNT (75)
- Mount a partition's filesystem onto a drive number.
+ SYS_FSMOUNT (75)
+ Mount a partition's filesystem onto a drive number. Requires
+ CAP_STORAGE_ADMIN.
int montauk::fs_mount(int partIndex, int driveNum);
-SYS_FSFORMAT (76)
+ SYS_FSFORMAT (76)
Format a partition with a filesystem (FS_TYPE_FAT32 or
- FS_TYPE_EXT2).
+ FS_TYPE_EXT2). Requires CAP_STORAGE_ADMIN.
int montauk::fs_format(const montauk::abi::FsFormatParams* params);
-SYS_FS_SYNC (134)
+ SYS_FS_SYNC (134)
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).
+ (see SYS_POWER_REQUEST). Requires CAP_STORAGE_ADMIN.
int montauk::fs_sync();
+
AUDIO
-SYS_AUDIOOPEN (80)
+ SYS_AUDIOOPEN (80)
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);
-SYS_AUDIOCLOSE (81)
+ SYS_AUDIOCLOSE (81)
Close an audio stream.
void montauk::audio_close(int handle);
-SYS_AUDIOWRITE (82)
+ SYS_AUDIOWRITE (82)
Write PCM samples to an audio stream.
int montauk::audio_write(int handle, const void* data, uint32_t size);
-SYS_AUDIOCTL (83)
+ SYS_AUDIOCTL (83)
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
@@ -656,246 +925,271 @@
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
- audio_set_output AUDIO_CTL_SET_OUTPUT (5): switch all streams
- (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)
+ audio_get_output GET_OUTPUT (4): 0=HDA, 1=Bluetooth
+ audio_set_output SET_OUTPUT (5): all streams
+ audio_ctl(handle, 5, output) SET_OUTPUT (5): one stream
+ audio_bt_status BT_STATUS (6): unavailable/setup/ready
+ audio_set_master_volume SET_MASTER_VOLUME (7), 0-100
+ audio_get_master_volume GET_MASTER_VOLUME (8)
+ audio_set_mute, audio_get_mute MUTE (9/10), per-stream
+ audio_set_master_mute SET_MASTER_MUTE (11)
+ audio_get_master_mute GET_MASTER_MUTE (12)
-SYS_AUDIOLIST (128)
+ SYS_AUDIOLIST (128)
Enumerate active mixer streams (owner PID, name, format,
volume, mute/pause state).
- int montauk::audio_list(montauk::abi::AudioStreamInfo* buf, int maxCount);
+ int montauk::audio_list(montauk::abi::AudioStreamInfo* buf,
+ int maxCount);
-SYS_AUDIOWAIT (129)
+ SYS_AUDIOWAIT (129)
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);
+
BLUETOOTH
-SYS_BTSCAN (84)
- Scan for discoverable Bluetooth devices for up to timeoutMs.
+ SYS_BTSCAN (84)
+ Scan for discoverable Bluetooth devices for up to timeoutMs. Requires
+ CAP_DEVICE_ADMIN because it changes radio state.
int montauk::bt_scan(montauk::abi::BtScanResult* buf, int maxCount,
uint32_t timeoutMs);
-SYS_BTCONNECT (85)
- Connect (and pair/bond if needed) to a device by BD_ADDR.
+ SYS_BTCONNECT (85)
+ Connect (and pair/bond if needed) to a device by BD_ADDR. Requires
+ CAP_DEVICE_ADMIN.
int montauk::bt_connect(const uint8_t* bdAddr);
-SYS_BTDISCONNECT (86)
- Disconnect from a device by BD_ADDR.
+ SYS_BTDISCONNECT (86)
+ Disconnect from a device by BD_ADDR. Requires CAP_DEVICE_ADMIN.
int montauk::bt_disconnect(const uint8_t* bdAddr);
-SYS_BTLIST (87)
+ SYS_BTLIST (87)
List currently connected devices.
int montauk::bt_list(montauk::abi::BtDevInfo* buf, int maxCount);
-SYS_BTINFO (88)
+ SYS_BTINFO (88)
Get local adapter info (BD_ADDR, name, init/scanning state).
int montauk::bt_info(montauk::abi::BtAdapterInfo* buf);
-SYS_BTSETADDR (137)
+ SYS_BTSETADDR (137)
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.
+ controller reset and persist separately to bluetooth.toml. Requires
+ CAP_DEVICE_ADMIN.
int montauk::bt_set_addr(const uint8_t* bdAddr);
-SYS_BTBONDS (138)
+ SYS_BTBONDS (138)
List bonded (paired) devices.
int montauk::bt_bonds(montauk::abi::BtBondInfo* buf, int maxCount);
-SYS_BTFORGET (139)
- Forget a paired device; it must re-pair next time.
+ SYS_BTFORGET (139)
+ Forget a paired device; it must re-pair next time. Requires
+ CAP_DEVICE_ADMIN.
int montauk::bt_forget(const uint8_t* bdAddr);
-SOFTWARE-DEFINED RADIO
- 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.
-SYS_SDR_COUNT (140)
- Number of available SDR receivers.
- int montauk::sdr_count();
+GENERIC USB INTERFACES
+ Process-owned access to USB interfaces that do not have a bound kernel
+ class driver. Claims are exclusive and are released automatically at
+ process exit. The current xHCI device model records one interface per
+ device slot, so claiming that interface temporarily claims the whole slot.
+ Kernel-owned HID, Bluetooth, mass-storage, and RTL-SDR interfaces are
+ visible in SYS_USB_LIST but cannot be claimed.
-SYS_SDR_INFO (141)
- 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);
+ SYS_USB_LIST (178)
+ List currently connected USB interfaces. Each UsbInterfaceInfo contains
+ stable identifiers for the current connection, endpoint addresses, maximum
+ packet sizes, and kernelDriverBound/claimed flags.
+ int montauk::usb_list(montauk::abi::UsbInterfaceInfo* buf,
+ int maxCount);
-SYS_SDR_OPEN (142)
- Open a receiver by index. Returns a handle.
- int montauk::sdr_open(int index);
+ SYS_USB_CLAIM (179)
+ Exclusively claim an unbound interface. Returns a generation-checked handle
+ owned by the calling process. Requires CAP_DEVICE_ADMIN; subsequent
+ operations are authorized by ownership of that handle.
+ int montauk::usb_claim(uint8_t slotId, uint8_t interfaceNumber);
-SYS_SDR_CLOSE (143)
- Close a receiver handle.
- int montauk::sdr_close(int handle);
+ SYS_USB_CLOSE (180)
+ Stop active transfers and release a USB claim.
+ int montauk::usb_close(int handle);
-SYS_SDR_START (144)
- Begin streaming samples.
- int montauk::sdr_start(int handle);
+ SYS_USB_CONTROL (181)
+ Execute a USB control transfer on endpoint zero. The requestType direction
+ bit determines whether data is read or written. request.length must equal
+ dataLen; control payloads are currently limited to 4096 bytes.
+ int montauk::usb_control(
+ int handle, const montauk::abi::UsbControlRequest* request,
+ void* data, uint32_t dataLen);
-SYS_SDR_STOP (145)
- Stop streaming samples.
- int montauk::sdr_stop(int handle);
+ SYS_USB_BULK_IN_START (182)
+ Start a continuous bulk-IN transfer pool. transferBytes is 1..4096 and
+ bufferCount is 1..16. Completed data is copied into a 256 KiB per-claim
+ ring buffer.
+ int montauk::usb_bulk_in_start(int handle, uint32_t transferBytes,
+ uint32_t bufferCount);
-SYS_SDR_READ (146)
- Non-blocking read of queued I/Q samples. Returns bytes copied.
- int montauk::sdr_read(int handle, void* buf, uint32_t len);
+ SYS_USB_BULK_IN_STOP (183)
+ Stop continuous bulk-IN transfers without releasing the claim.
+ int montauk::usb_bulk_in_stop(int handle);
-SYS_SDR_SETPARAM (147)
- Set a tunable parameter (see SDR_PARAM_* below).
- int montauk::sdr_set_param(int handle, int param, uint64_t value);
+ SYS_USB_BULK_IN_READ (184)
+ Non-blocking read from the bulk-IN ring. Returns bytes copied, zero when no
+ data is queued, or USB_ERR_DISCONNECTED after queued data has been drained.
+ int montauk::usb_bulk_in_read(int handle, void* data, uint32_t dataLen);
-SYS_SDR_GETPARAM (148)
- Get a tunable parameter's current value.
- int64_t montauk::sdr_get_param(int handle, int param);
+ Errors are USB_ERR_INVALID (-1), USB_ERR_BUSY (-2),
+ USB_ERR_DISCONNECTED (-3), USB_ERR_UNSUPPORTED (-4), USB_ERR_IO (-5),
+ USB_ERR_NO_RESOURCES (-6), USB_ERR_NOT_FOUND (-7), and
+ USB_ERR_KERNEL_BOUND (-8).
+
+
+RESERVED SYSCALL NUMBERS
+ Syscall numbers 140 through 148 are reserved. They were used by an
+ experimental kernel SDR API and are intentionally not dispatched or exposed
+ through userspace syscall wrappers. RTL-SDR support is provided by
+ 0:/os/rtlsdr.lib over the generic userspace USB API.
- 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.
CLIPBOARD
-SYS_CLIPBOARD_SET_TEXT (119)
+ SYS_CLIPBOARD_SET_TEXT (119)
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);
-SYS_CLIPBOARD_GET_INFO (120)
+ SYS_CLIPBOARD_GET_INFO (120)
Get the clipboard's current size and serial number (for
change detection).
int montauk::clipboard_get_info(montauk::abi::ClipboardInfo* out);
-SYS_CLIPBOARD_GET_TEXT (121)
+ SYS_CLIPBOARD_GET_TEXT (121)
Read the clipboard's text contents.
int montauk::clipboard_get_text(char* buf, uint32_t bufLen,
- uint32_t* outLen, uint64_t* outSerial = nullptr);
+ uint32_t* outLen,
+ uint64_t* outSerial = nullptr);
-SYS_CLIPBOARD_CLEAR (122)
+ SYS_CLIPBOARD_CLEAR (122)
Clear the clipboard.
int montauk::clipboard_clear();
+
GENERIC IPC
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.
-SYS_DUPHANDLE (98)
+ SYS_DUPHANDLE (98)
Duplicate a handle (e.g. to hand a copy to a child process).
int montauk::dup_handle(int handle);
-SYS_WAIT_HANDLE (99)
+ SYS_WAIT_HANDLE (99)
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);
-SYS_STREAM_CREATE (100)
+ SYS_STREAM_CREATE (100)
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);
-SYS_STREAM_READ (101)
+ SYS_STREAM_READ (101)
Read bytes from a stream handle.
int montauk::stream_read(int handle, void* buf, int maxLen);
-SYS_STREAM_WRITE (102)
+ SYS_STREAM_WRITE (102)
Write bytes to a stream handle.
int montauk::stream_write(int handle, const void* data, int len);
-SYS_MAILBOX_CREATE (103)
+ SYS_MAILBOX_CREATE (103)
Create a message-queue mailbox, returning a send handle and a
receive handle.
int montauk::mailbox_create(int* outSendHandle, int* outRecvHandle);
-SYS_MAILBOX_SEND (104)
+ SYS_MAILBOX_SEND (104)
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);
+ int montauk::mailbox_send(int handle, uint32_t msgType,
+ const void* data, uint16_t len,
+ int attachHandle = -1);
-SYS_MAILBOX_RECV (105)
+ SYS_MAILBOX_RECV (105)
Receive a message.
int montauk::mailbox_recv(int handle, uint32_t* outMsgType, void* data,
- uint16_t* inOutLen, int* outAttachHandle = nullptr);
+ uint16_t* inOutLen,
+ int* outAttachHandle = nullptr);
-SYS_WAITSET_CREATE (106)
+ SYS_WAITSET_CREATE (106)
Create a waitset for multiplexing waits across many handles.
int montauk::waitset_create();
-SYS_WAITSET_ADD (107)
+ SYS_WAITSET_ADD (107)
Add a handle and its signal mask to a waitset.
int montauk::waitset_add(int waitsetHandle, int targetHandle,
uint32_t signals);
-SYS_WAITSET_REMOVE (108)
+ SYS_WAITSET_REMOVE (108)
Remove an entry from a waitset by index.
int montauk::waitset_remove(int waitsetHandle, int index);
-SYS_WAITSET_WAIT (109)
+ SYS_WAITSET_WAIT (109)
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);
+ int montauk::waitset_wait(
+ int waitsetHandle, montauk::abi::IpcWaitResult* outReady,
+ uint64_t timeoutMs = ~0ULL);
-SYS_PROC_OPEN (110)
+ SYS_PROC_OPEN (110)
Open a handle to another process by PID (for waiting on its
exit via IPC_SIGNAL_EXITED, etc.).
int montauk::proc_open(int pid);
-SYS_SURFACE_CREATE (111)
+ SYS_SURFACE_CREATE (111)
Create a shared pixel-buffer surface of byteSize bytes.
int montauk::surface_create(uint64_t byteSize);
-SYS_SURFACE_MAP (112)
+ SYS_SURFACE_MAP (112)
Map a surface into the caller's address space.
void* montauk::surface_map(int handle);
-SYS_SURFACE_RESIZE (113)
+ SYS_SURFACE_RESIZE (113)
Resize a surface.
int montauk::surface_resize(int handle, uint64_t newSize);
+
SHARED LIBRARIES
-SYS_LOAD_LIB (114)
+ SYS_LOAD_LIB (114)
Load a shared library ELF (.lib) into the caller's address
space.
int montauk::load_lib(const char* path);
-SYS_UNLOAD_LIB (115)
+ SYS_UNLOAD_LIB (115)
Unload a previously loaded library.
int montauk::unload_lib(int handle);
-SYS_DLSYM (116)
+ SYS_DLSYM (116)
Resolve a symbol offset within a loaded library to a callable
address.
void* montauk::dlsym(int handle, uint64_t symbolOffset);
-SYS_GETLIBBASE (117)
+ SYS_GETLIBBASE (117)
Get the base virtual address a loaded library was mapped at.
uint64_t montauk::get_libbase(int handle);
+
CRASH REPORTING
-SYS_CRASH_REPORT (118)
+ SYS_CRASH_REPORT (118)
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);
-SEE ALSO
- spawn(2), file(2), framebuffer(2), malloc(3), intro(1)
+SEE ALSO
+ spawn(2), file(2), framebuffer(2), malloc(3), intro(1)
NAME
tls-errors - BearSSL TLS and X.509 error codes
+
DESCRIPTION
MontaukOS uses BearSSL for TLS 1.2 connections. When a TLS
operation fails, an integer error code is reported. This page
lists all possible error codes.
+
SSL/TLS ENGINE ERRORS
-0 BR_ERR_OK
+ 0 BR_ERR_OK
No error.
-1 BR_ERR_BAD_PARAM
+ 1 BR_ERR_BAD_PARAM
Caller-provided parameter is incorrect.
-2 BR_ERR_BAD_STATE
+ 2 BR_ERR_BAD_STATE
Operation cannot be applied in the current engine state.
-3 BR_ERR_UNSUPPORTED_VERSION
+ 3 BR_ERR_UNSUPPORTED_VERSION
Incoming protocol or record version is unsupported.
-4 BR_ERR_BAD_VERSION
+ 4 BR_ERR_BAD_VERSION
Incoming record version does not match the expected version.
-5 BR_ERR_BAD_LENGTH
+ 5 BR_ERR_BAD_LENGTH
Incoming record length is invalid.
-6 BR_ERR_TOO_LARGE
+ 6 BR_ERR_TOO_LARGE
Incoming record is too large, or buffer is too small for the
handshake message to send.
-7 BR_ERR_BAD_MAC
+ 7 BR_ERR_BAD_MAC
Decryption found invalid padding, or the record MAC is
not correct.
-8 BR_ERR_NO_RANDOM
+ 8 BR_ERR_NO_RANDOM
No initial entropy was provided and none could be obtained
from the OS.
-9 BR_ERR_UNKNOWN_TYPE
+ 9 BR_ERR_UNKNOWN_TYPE
Incoming record type is unknown.
-10 BR_ERR_UNEXPECTED
+ 10 BR_ERR_UNEXPECTED
Incoming record or message has wrong type for the current
engine state.
-12 BR_ERR_BAD_CCS
+ 12 BR_ERR_BAD_CCS
ChangeCipherSpec message from the peer has invalid contents.
-13 BR_ERR_BAD_ALERT
+ 13 BR_ERR_BAD_ALERT
Alert message from the peer has invalid contents (odd length).
-14 BR_ERR_BAD_HANDSHAKE
+ 14 BR_ERR_BAD_HANDSHAKE
Incoming handshake message decoding failed.
-15 BR_ERR_OVERSIZED_ID
+ 15 BR_ERR_OVERSIZED_ID
ServerHello contains a session ID larger than 32 bytes.
-16 BR_ERR_BAD_CIPHER_SUITE
+ 16 BR_ERR_BAD_CIPHER_SUITE
Server wants to use a cipher suite that we did not advertise,
or we tried to advertise a cipher suite that we do not support.
-17 BR_ERR_BAD_COMPRESSION
+ 17 BR_ERR_BAD_COMPRESSION
Server wants to use a compression method that we did not
advertise.
-18 BR_ERR_BAD_FRAGLEN
+ 18 BR_ERR_BAD_FRAGLEN
Server's max fragment length does not match client's.
-19 BR_ERR_BAD_SECRENEG
+ 19 BR_ERR_BAD_SECRENEG
Secure renegotiation failed.
-20 BR_ERR_EXTRA_EXTENSION
+ 20 BR_ERR_EXTRA_EXTENSION
Server sent an extension type that we did not announce, or
used the same extension type more than once in ServerHello.
-21 BR_ERR_BAD_SNI
+ 21 BR_ERR_BAD_SNI
Invalid Server Name Indication contents (when used by the
server, this extension shall be empty).
-22 BR_ERR_BAD_HELLO_DONE
+ 22 BR_ERR_BAD_HELLO_DONE
Invalid ServerHelloDone from the server (length is not 0).
-23 BR_ERR_LIMIT_EXCEEDED
+ 23 BR_ERR_LIMIT_EXCEEDED
Internal limit exceeded (e.g. server's public key is too
large).
-24 BR_ERR_BAD_FINISHED
+ 24 BR_ERR_BAD_FINISHED
Finished message from peer does not match the expected value.
-25 BR_ERR_RESUME_MISMATCH
+ 25 BR_ERR_RESUME_MISMATCH
Session resumption attempted with a different version or
cipher suite.
-26 BR_ERR_INVALID_ALGORITHM
+ 26 BR_ERR_INVALID_ALGORITHM
Unsupported or invalid algorithm (ECDHE curve, signature
algorithm, hash function).
-27 BR_ERR_BAD_SIGNATURE
+ 27 BR_ERR_BAD_SIGNATURE
Invalid signature on ServerKeyExchange or CertificateVerify.
-28 BR_ERR_WRONG_KEY_USAGE
+ 28 BR_ERR_WRONG_KEY_USAGE
Peer's public key does not have the proper type or is not
allowed for the requested operation.
-29 BR_ERR_NO_CLIENT_AUTH
+ 29 BR_ERR_NO_CLIENT_AUTH
Client did not send a certificate upon request, or the client
certificate could not be validated.
-31 BR_ERR_IO
+ 31 BR_ERR_IO
I/O error or premature close on the underlying transport.
+
X.509 CERTIFICATE ERRORS
-32 BR_ERR_X509_OK
+ 32 BR_ERR_X509_OK
X.509 validation was successful (not an error).
-33 BR_ERR_X509_INVALID_VALUE
+ 33 BR_ERR_X509_INVALID_VALUE
Invalid value in an ASN.1 structure.
-34 BR_ERR_X509_TRUNCATED
+ 34 BR_ERR_X509_TRUNCATED
Truncated certificate.
-35 BR_ERR_X509_EMPTY_CHAIN
+ 35 BR_ERR_X509_EMPTY_CHAIN
Empty certificate chain (no certificate at all).
-36 BR_ERR_X509_INNER_TRUNC
+ 36 BR_ERR_X509_INNER_TRUNC
Inner element extends beyond outer element size.
-37 BR_ERR_X509_BAD_TAG_CLASS
+ 37 BR_ERR_X509_BAD_TAG_CLASS
Unsupported tag class (application or private).
-38 BR_ERR_X509_BAD_TAG_VALUE
+ 38 BR_ERR_X509_BAD_TAG_VALUE
Unsupported tag value.
-39 BR_ERR_X509_INDEFINITE_LENGTH
+ 39 BR_ERR_X509_INDEFINITE_LENGTH
Indefinite length encoding found.
-40 BR_ERR_X509_EXTRA_ELEMENT
+ 40 BR_ERR_X509_EXTRA_ELEMENT
Extraneous element in certificate.
-41 BR_ERR_X509_UNEXPECTED
+ 41 BR_ERR_X509_UNEXPECTED
Unexpected element in certificate.
-42 BR_ERR_X509_NOT_CONSTRUCTED
+ 42 BR_ERR_X509_NOT_CONSTRUCTED
Expected constructed element, but found primitive.
-43 BR_ERR_X509_NOT_PRIMITIVE
+ 43 BR_ERR_X509_NOT_PRIMITIVE
Expected primitive element, but found constructed.
-44 BR_ERR_X509_PARTIAL_BYTE
+ 44 BR_ERR_X509_PARTIAL_BYTE
BIT STRING length is not a multiple of 8.
-45 BR_ERR_X509_BAD_BOOLEAN
+ 45 BR_ERR_X509_BAD_BOOLEAN
BOOLEAN value has invalid length.
-46 BR_ERR_X509_OVERFLOW
+ 46 BR_ERR_X509_OVERFLOW
Value is off-limits (overflow).
-47 BR_ERR_X509_BAD_DN
+ 47 BR_ERR_X509_BAD_DN
Invalid distinguished name.
-48 BR_ERR_X509_BAD_TIME
+ 48 BR_ERR_X509_BAD_TIME
Invalid date/time representation in certificate.
-49 BR_ERR_X509_UNSUPPORTED
+ 49 BR_ERR_X509_UNSUPPORTED
Certificate contains unsupported features that cannot be
ignored.
-50 BR_ERR_X509_LIMIT_EXCEEDED
+ 50 BR_ERR_X509_LIMIT_EXCEEDED
Key or signature size exceeds internal limits.
-51 BR_ERR_X509_WRONG_KEY_TYPE
+ 51 BR_ERR_X509_WRONG_KEY_TYPE
Key type does not match that which was expected.
-52 BR_ERR_X509_BAD_SIGNATURE
+ 52 BR_ERR_X509_BAD_SIGNATURE
Signature is invalid.
-53 BR_ERR_X509_TIME_UNKNOWN
+ 53 BR_ERR_X509_TIME_UNKNOWN
Validation time is unknown (no time was set).
-54 BR_ERR_X509_EXPIRED
+ 54 BR_ERR_X509_EXPIRED
Certificate is expired or not yet valid.
-55 BR_ERR_X509_DN_MISMATCH
+ 55 BR_ERR_X509_DN_MISMATCH
Issuer/subject DN mismatch in the chain.
-56 BR_ERR_X509_BAD_SERVER_NAME
+ 56 BR_ERR_X509_BAD_SERVER_NAME
Expected server name was not found in the chain.
-57 BR_ERR_X509_CRITICAL_EXTENSION
+ 57 BR_ERR_X509_CRITICAL_EXTENSION
Unknown critical extension in certificate.
-58 BR_ERR_X509_NOT_CA
+ 58 BR_ERR_X509_NOT_CA
Not a CA, or path length constraint violation.
-59 BR_ERR_X509_FORBIDDEN_KEY_USAGE
+ 59 BR_ERR_X509_FORBIDDEN_KEY_USAGE
Key Usage extension prohibits the intended usage.
-60 BR_ERR_X509_WEAK_PUBLIC_KEY
+ 60 BR_ERR_X509_WEAK_PUBLIC_KEY
Public key found in certificate is too small.
-62 BR_ERR_X509_NOT_TRUSTED
+ 62 BR_ERR_X509_NOT_TRUSTED
Chain could not be linked to a trust anchor.
+
FATAL ALERTS
When a fatal alert is received from the peer, the error code
is 256 + the TLS alert value. When a fatal alert is sent to
@@ -342,9 +346,9 @@
For example, error 296 means a handshake_failure alert was
received (256 + 40 = 296).
-SEE ALSO
- fetch(1), syscalls(2)
+SEE ALSO
+ fetch(1), syscalls(2)
NAME
wiki - Wikipedia article viewer for MontaukOS
+
SYNOPSIS
wiki <title>
wiki -f <title>
wiki -s <query>
+
DESCRIPTION
wiki fetches and displays Wikipedia articles in the terminal.
It connects to en.wikipedia.org over HTTPS (TLS 1.2) and
@@ -126,16 +128,18 @@
color-coded headings and word-wrapped text. Multi-word titles
are accepted as separate arguments and joined automatically.
+
OPTIONS
--f
+ -f
Full article mode. Display the complete article text instead
of just the summary. Section headings are color-coded.
--s
+ -s
Search mode. Search Wikipedia for articles matching the
query and display a numbered list of up to 10 results.
Press a number key to view that article's summary.
+
EXAMPLES
wiki Linux
Show a summary of the Linux article.
@@ -146,13 +150,16 @@
wiki -s operating system
Search for articles related to "operating system".
+
TLS SUPPORT
Connections use BearSSL for TLS 1.2. Server certificates
are validated against the system CA bundle at
0:/os/certs/ca-certificates.crt.
+
KEYBOARD
+
Article pager
j / Down Scroll down one line
k / Up Scroll up one line
@@ -162,16 +169,18 @@
G / End Jump to bottom
q Quit pager
+
Search results
1-9, 0 View article (0 = result 10)
q Quit search
+
General
Ctrl+Q Abort during network request
-SEE ALSO
- fetch(1), ping(1), nslookup(1), shell(1)
+SEE ALSO
+ fetch(1), ping(1), nslookup(1), shell(1)