Skip to content

Add native SCHED_FIFO promotion for the Linux build without dbus#45

Open
HEnquist wants to merge 2 commits into
mozilla:masterfrom
HEnquist:native-rt-without-dbus
Open

Add native SCHED_FIFO promotion for the Linux build without dbus#45
HEnquist wants to merge 2 commits into
mozilla:masterfrom
HEnquist:native-rt-without-dbus

Conversation

@HEnquist

@HEnquist HEnquist commented Jul 8, 2026

Copy link
Copy Markdown

Give the Linux no-dbus build a real implementation instead of a no-op:
promote the current thread directly with pthread_setschedparam(SCHED_FIFO).
The rtkit path and other platforms are untouched. See #44 for the rationale.

  • New rt_linux_native.rs, wired in via a dedicated cfg branch after the rtkit branch
  • Priority defaults to 10 (matching rtkit), overridable with the AUDIO_RT_PRIORITY env var (1-99)
  • Restores the saved policy on demotion (keeps SCHED_RESET_ON_FORK set, which an
    unprivileged thread cannot clear)
  • Tests cover the RLIMIT_RTPRIO boundary and the priority override; the fallback CI
    job raises RLIMIT_RTPRIO so promotion runs for real
  • Docs: add a Platforms section and correct API docs that assumed D-Bus was the only
    Linux backend

HEnquist added 2 commits July 8, 2026 22:42
The Linux build without the `dbus` feature previously fell through to the
blanket fallback, where promotion was a no-op that returned Ok, so callers
believed they had real-time priority when they did not.

Give that build a real implementation: promote the current thread directly
with pthread_setschedparam(SCHED_FIFO | SCHED_RESET_ON_FORK) at priority 10,
restoring the saved policy on demotion. This needs no D-Bus daemon and works
whenever the process may request real-time scheduling (root, CAP_SYS_NICE, or
an RLIMIT_RTPRIO budget). The rtkit path and other platforms are untouched.

- New rt_linux_native.rs with the native backend, wired into a dedicated cfg
  branch after the rtkit branch.
- The requested priority defaults to 10 and can be overridden with the
  AUDIO_RT_PRIORITY environment variable (1-99).
- Tests exercise the RLIMIT_RTPRIO boundary and the priority override; the
  fallback CI job raises RLIMIT_RTPRIO so promotion runs for real.
- Docs: add a Platforms section and correct API docs that assumed D-Bus was
  the only Linux backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant