7

rtkit obviously knows which threads it is "supervising", since it spams syslog with messages like

rtkit-daemon[1277]: Supervising 3 threads of 2 processes of 1 users.

However, the nefarious little thing doesn't seem to provide a way to list those "supervised" process / threads. rtkitctl has options to kill or restart the daemon and to "reset" the threads (whatever that means). At least on Debians, I don't see any other utilities. Maybe there are hidden DBus interfaces, or maybe the distro doesn't package some utilities.

So, without going the ps way, is there a way to list those "supervised" threads, or is this just another opaque aspect of the whole dbus/systemd ecosystem?

2

1 Answer 1

1

RTKit provides a DBus interface to retrieve this information. Here's a shell script that demonstrates:

#!/bin/bash

# Get the list of processes managed by rtkit
processes=$(dbus-send --system --dest=org.freedesktop.RealtimeKit1 --print-reply /org/freedesktop/RealtimeKit1 org.freedesktop.RealtimeKit1.GetManagedProcesses | awk '/array/ {flag=1; next} flag')

# Loop through each process and extract the process ID and thread count
while read -r line; do
    if [[ $line =~ uint32\ ([0-9]+) ]]; then
        pid="${BASH_REMATCH[1]}"
    elif [[ $line =~ uint32\ ([0-9]+) ]]; then
        threads="${BASH_REMATCH[1]}"
        echo "Process ID: $pid, Supervised Threads: $threads"
    fi
done <<< "$processes"
1
  • This results in "Error org.freedesktop.DBus.Error.UnknownMethod: Method "GetManagedProcesses" with signature "" on interface "org.freedesktop.RealtimeKit1" doesn't exist" on my machine. Commented Oct 10, 2023 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .