zerodds-rt-linux
Layer 4 — Core Services. Linux real-time scheduling adapter.
- Source: crates/rt-linux
- API docs: docs.rs/zerodds-rt-linux
zerodds-rt-linux is the only crate in the workspace with an
unsafe FFI boundary (COMFORT class). It provides
SCHED_FIFO/SCHED_RR/SCHED_DEADLINE profiles + CPU pinning via
sched_setattr(2) and sched_setaffinity(2).
Spec anchors
sched(7)Linux man page.sched_setattr(2),sched_getattr(2).sched_setaffinity(2),sched_getaffinity(2).
No OMG spec — Linux kernel API.
Layer position
Layer 4. No ZeroDDS crate deps; libc is the only external
dep, target-gated cfg(target_os = "linux"). On non-Linux all
public APIs return io::ErrorKind::Unsupported.
Quickstart
use zerodds_rt_linux::{SchedulerProfile, pin_current_thread_to_cpus};
let profile = SchedulerProfile::fifo(80).expect("priority valid");
profile.apply_to_current_thread().expect("CAP_SYS_NICE required");
pin_current_thread_to_cpus(&[2, 3]).expect("affinity set");
Privileges
SCHED_FIFO/SCHED_RR with priority > 0 + SCHED_DEADLINE need
CAP_SYS_NICE (effective). Without it, calls abort with EPERM.
Threat model + 5 invariants
- No pointer outliving — stack-local structures, no heap.
- No FD leak — none of the syscalls used create FDs.
- No memory aliasing — buffers are exclusive during the call.
- Errno-to-Result —
io::Error::last_os_error()once before any further libc operations. - No mut-aliasing race — all calls refer to
tid = 0(the calling thread).
Every unsafe { libc::... } block carries a // SAFETY: comment.
Stability
1.0.0-rc.3. Public API + errno mapping RC1-stable. sched_setattr(2)
has been a Linux-kernel-stable API since kernel 3.14.
zerodds-rt-linux
Layer 4 — Core Services. Linux Real-Time-Scheduling Adapter.
- Quelle: crates/rt-linux
- API-Docs: docs.rs/zerodds-rt-linux
zerodds-rt-linux ist die einzige Crate im Workspace mit
unsafe-FFI-Boundary (COMFORT-Klasse). Liefert
SCHED_FIFO/SCHED_RR/SCHED_DEADLINE-Profile + CPU-Pinning ueber
sched_setattr(2) und sched_setaffinity(2).
Spec-Anker
sched(7)Linux-Manpage.sched_setattr(2),sched_getattr(2).sched_setaffinity(2),sched_getaffinity(2).
Keine OMG-Spec — Linux-Kernel-API.
Schichten-Position
Layer 4. Keine ZeroDDS-Crate-Deps; libc ist die einzige externe
Dep, target-gegated cfg(target_os = "linux"). Auf Nicht-Linux liefern
alle Public-APIs io::ErrorKind::Unsupported.
Quickstart
use zerodds_rt_linux::{SchedulerProfile, pin_current_thread_to_cpus};
let profile = SchedulerProfile::fifo(80).expect("priority valid");
profile.apply_to_current_thread().expect("CAP_SYS_NICE noetig");
pin_current_thread_to_cpus(&[2, 3]).expect("affinity set");
Privilegien
SCHED_FIFO/SCHED_RR mit Priority > 0 + SCHED_DEADLINE brauchen
CAP_SYS_NICE (effective). Ohne brechen Calls mit EPERM ab.
Threat-Model + 5 Invarianten
- Kein Pointer-Outliving — Stack-lokale Strukturen, kein Heap.
- Kein FD-Leak — keiner der genutzten Syscalls erzeugt FDs.
- Kein Memory-Aliasing — Buffer sind exklusiv waehrend des Aufrufs.
- Errno-zu-Result —
io::Error::last_os_error()einmal vor weiteren libc-Operationen. - Keine Mut-Aliasing-Race — alle Calls beziehen sich auf
tid = 0(calling thread).
Jeder unsafe { libc::... }-Block traegt einen // SAFETY:-Kommentar.
Stabilitaet
1.0.0-rc.3. Public-API + Errno-Mapping RC1-stabil. sched_setattr(2)
ist Linux-Kernel-stabile-API seit Kernel 3.14.