Page MenuHomeFreeBSD

Allow rtprio_thread to operate on threads of any process

Authored by on Nov 10 2020, 12:44 AM.
Referenced Files
Unknown Object (File)
Sun, Nov 19, 4:07 AM
Unknown Object (File)
Sun, Nov 19, 2:22 AM
Unknown Object (File)
Sun, Nov 19, 2:21 AM
Unknown Object (File)
Sun, Nov 19, 1:55 AM
Unknown Object (File)
Aug 7 2023, 7:20 PM
Unknown Object (File)
Aug 7 2023, 7:16 PM
Unknown Object (File)
Aug 7 2023, 7:16 PM
Unknown Object (File)
Aug 4 2023, 6:44 AM



Multimedia daemons like PulseAudio and PipeWire, running as a regular user, want realtime priority on some of their threads, and they support RealtimeKit for that, which is a clever daemon that manages per-thread realtime priority (of all its clients) carefully.

On Linux, rtkit simply uses the POSIX.1b sched_setscheduler call with a thread ID and it just works (I think because Linux threads are just boneless processes, i.e. processes sharing an address space).
In 2006 support for thread IDs in POSIX.1b calls was added FreeBSD… and removed 2 days later to avoid mixing processes and threads (argh, inconvenient).

Well, the syscall that *is* supposed to work for some reason only works for threads of the current process. I'd like to remove this limitation (which was not even advertised on the manpage), because it prevents anything like rtkit from working.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

This looks like a limitation which is a holdover from previous state:

 * Though lwpid is unique, only current process is supported
 * since there is no efficient way to look up a LWP yet.

I'll sleep on it and probably commit tomorrow.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 10 2020, 6:11 PM
This revision was automatically updated to reflect the committed changes.