What are Schemes?
Schemes are Redox’s unified resource access mechanism. Similar to Plan 9’s “everything is a file” philosophy, Redox takes it further with “everything is a URL”.In Redox, all resources—files, network connections, devices, IPC—are accessed through URL-like paths called schemes.
Scheme Syntax
Scheme Architecture
How Schemes Work
Opening a Resource
1
Application Request
Application calls
open("tcp:example.com:80")2
Library Translation
relibc/libredox parses the URL and makes a syscall
3
Kernel Routing
Kernel routes the request to the
tcp: scheme provider4
Scheme Handler
Network service handles the request and returns a file descriptor
5
Return to Application
Application receives a file descriptor to read/write
Scheme Communication Flow
Built-in Schemes
Redox provides many built-in schemes for different purposes:Kernel Schemes
Provided directly by the kernel:- Core
- Memory
- Hardware
File Schemes
File system access:Paths starting with
/ are automatically converted to file: scheme URLs by relibc.Network Schemes
Provided by smolnetd:- TCP
- UDP
- ICMP
- IP
Device Schemes
Hardware device access:IPC Schemes
Inter-process communication:chan: - Channels
chan: - Channels
uds_stream: - Unix Domain Sockets (Stream)
uds_stream: - Unix Domain Sockets (Stream)
uds_dgram: - Unix Domain Sockets (Datagram)
uds_dgram: - Unix Domain Sockets (Datagram)
Display Schemes
Graphics and display access:Terminal Schemes
Other Schemes
sudo:
Privilege escalation for authorized users
audio:
Audio device access
log:
System logging
Scheme Permissions
Schemes have fine-grained permission control:Implementing a Scheme Provider
You can implement custom scheme providers:1
Implement Scheme Trait
Implement the
Scheme trait with handlers for open, read, write, close, etc.2
Register with Kernel
Open a special path (
:schemename) to register your scheme3
Handle Requests
Loop reading packets from the kernel and responding
4
Run as Service
Run your scheme provider as a system service
Scheme Namespaces
Processes can have their own scheme namespaces:Scheme namespaces enable containerization and sandboxing in Redox.
Advantages of Scheme System
1. Unified Interface
All resources use the same API:2. Flexibility
Pluggable
Replace scheme implementations without changing applications
Virtual
Create virtual resources (e.g., virtual file systems)
Remote
Access remote resources transparently
Composable
Combine schemes for powerful abstractions
3. Security
Fine-grained access control:4. Network Transparency
Comparison with Traditional Unix
Practical Examples
Example 1: HTTP Client
Example 2: Device Access
Example 3: IPC Communication
Next Steps
Architecture Overview
Return to architecture overview
System Components
Learn about system components
Build System
Build Redox from source
Contributing
Contribute to Redox OS