$ show managarm/managarm
managarm is a general-purpose operating system built on a microkernel architecture. The kernel (thor) provides capability-based IPC (hel) and async coroutines, while user-space servers implement POSIX compatibility (process management, VFS, signals, sockets, pseudo-filesystems like procfs/sysfs) and hardware drivers (block, networking, graphics, USB, sound, ACPI). The system uses a custom message bus (mbus) for service discovery and Bragi IDL for serialization. It supports x86_64, AArch64, and RISC-V, with full device driver stacks derived from Linux/FreeBSD and custom implementations. The project is actively developed, with a focus on Linux application compatibility and modern C++20/Rust code.
The LLM identified 6 files worth highlighting for reuse:
Provides a generic compile-time mount option parser using variadic templates and fold expressions. The `mount_options::parse` function accepts a tuple of option descriptors (string literal, expected value type, member pointer) and returns an `std::expected` with a struct of parsed values or an error code. This is fully self-contained (only depends on standard library headers) and can be reused in any project that needs type-safe, zero-overhead parsing of comma-separated key=value options.
Implements a generic page table `Cursor` template parameterized by a policy (e.g., x86_64, ARM, RISC-V). It provides methods to walk, map, unmap, and modify page table entries at any level, with compile-time configuration of page sizes, table depths, and entry types. The cursor is architecture-agnostic and can be extracted to build custom MMU implementations or testing frameworks without internal kernel dependencies.
Defines a reusable DRM property framework with typed properties (boolean, integer, range, enum, blob, object) and atomic state objects for CRTC, plane, and connector. Properties are defined declaratively with get/set callbacks and automatic value validation. This component can be extracted to build DRM/KMS drivers for any GPU hardware, providing a clean separation between property definitions and hardware-specific state application.
Implements a page-aligned metadata cache for block filesystems, supporting LRU eviction, dirty page tracking, and writeback. It wraps a block device in a caching layer with configurable size and is designed for transactional metadata updates. The cache is self-contained (depends only on `blockfs::BlockDevice` and standard containers) and can be reused by any filesystem that needs a writeback cache for block-level metadata.
Provides a generic dispatcher pool for managing asynchronous submissions to the Helene kernel (hel). It abstracts multiple submission queues (SQ) and completion queues (CQ) with per-thread or shared allocation, batch submission, and completion polling. This pattern is analogous to io_uring work queues and can be extracted to implement a coroutine-based I/O dispatcher for any event-driven system.
Implements POSIX file locking with deadlock detection using a directed graph of lock dependencies. It supports both advisory (flock) and mandatory record locks with wait-for graphs, lock upgrades/downgrades, and interruption. The implementation is self-contained (uses only standard library containers) and can be reused in any project needing a robust file locking manager with cycle detection.