Supported systems
FreeBSD
Full support with kenv and sysctl
OpenBSD
Limited support
NetBSD
Limited support
DragonFly BSD
Full support with kenv
Haiku OS
Native Haiku APIs
SerenityOS
Native SerenityOS APIs
BSD implementation
The BSD implementation (src/Lib/OS/BSD.cpp) provides support for FreeBSD, OpenBSD, NetBSD, and DragonFly BSD.
Platform detection
__FreeBSD__: FreeBSD__OpenBSD__: OpenBSD (limited support)__NetBSD__: NetBSD__DragonFly__: DragonFly BSD
OS information
BSD systems attempt to read/etc/os-release with fallback to uname:
Memory information
hw.physmem64 instead of hw.physmem.
Host identification
FreeBSD and DragonFly BSD
Usekenv (kernel environment) to read SMBIOS data:
NetBSD
Usesysctl to read DMI data:
Window manager detection
Wayland compositor detection (FreeBSD)
LOCAL_PEERCRED (instead of Linux’s SO_PEERCRED) and xucred structure.
Process path retrieval (FreeBSD)
X11 window manager detection
Desktop environment
Shell detection
Kernel version
Disk usage
Haiku OS implementation
The Haiku implementation (src/Lib/OS/Haiku.cpp) uses native Haiku APIs.
Platform detection
OS version
Reads version information from/boot/system/lib/libbe.so:
Memory information
Window manager
Haiku always returns"app_server" (the native display server).
Desktop environment
Haiku always returns"Haiku Desktop Environment".
Shell detection
Host identification
Kernel version
Disk usage
Haiku uses/boot as the primary filesystem:
SerenityOS implementation
The SerenityOS implementation (src/Lib/OS/Serenity.cpp) uses native SerenityOS APIs.
Platform detection
OS version
Memory information
Reads/sys/kernel/memstat JSON file:
Window manager
SerenityOS always returns"WindowManager" (the native window manager).
Desktop environment
SerenityOS always returns"SerenityOS Desktop".
Shell detection
Reads from/etc/passwd:
Host identification
Kernel version
Disk usage
Shared Unix utilities
All BSD and Unix systems use shared implementations fromUnix.hpp:
Disk usage
Kernel version
System name
Feature availability
| Feature | FreeBSD | NetBSD | DragonFly | Haiku | SerenityOS |
|---|---|---|---|---|---|
| Memory info | ✓ | ✓ | ✓ | ✓ | ✓ |
| Host info | ✓ | ✓ | ✓ | ✓ | ✓ |
| Shell detection | ✓ | ✓ | ✓ | ✓ | ✓ |
| Kernel version | ✓ | ✓ | ✓ | ✓ | ✓ |
| Disk usage | ✓ | ✓ | ✓ | ✓ | ✓ |
| Window manager | ✓ | ✓ | ✓ | ✓ | ✓ |
| Desktop environment | ✓ | ✓ | ✓ | ✓ | ✓ |
| X11 support | ✓ | ✓ | ✓ | ✗ | ✗ |
| Wayland support | ✓ | ✗ | ✗ | ✗ | ✗ |
| CPU info | ✗ | ✗ | ✗ | ✗ | ✗ |
| GPU info | ✗ | ✗ | ✗ | ✗ | ✗ |
| Network info | ✗ | ✗ | ✗ | ✗ | ✗ |
| Battery info | ✗ | ✗ | ✗ | ✗ | ✗ |
Implementation locations
BSD:- File:
src/Lib/OS/BSD.cpp(368 lines) - Namespace:
draconis::core::system - Requirement:
__FreeBSD__,__DragonFly__, or__NetBSD__
- File:
src/Lib/OS/Haiku.cpp(146 lines) - Namespace:
draconis::core::system - Requirement:
__HAIKU__
- File:
src/Lib/OS/Serenity.cpp(175 lines) - Namespace:
draconis::core::system - Requirement:
__serenity__
- File:
src/Lib/OS/Unix.hpp(344 lines) - Namespace:
draconis::os::unix_shared - Requirement: Not
_WIN32