Commit 84dc44e24d7c5f65befc08409c64fa2c83317b91

Sam Lantinga 2019-09-27T15:21:27

Fix the RealtimeKit dbus include guards The SDL_USE_LIBDBUS define is set inside SDL_debug.h, therefore the circular dependency made it impossible for this feature to be enabled. Instead, guard SDL_dbus.h based on the autoconf variable HAVE_DBUS_DBUS_H Additionally, fix one of the rtkit comments. CAP_SYS_NICE isn't required to achieve high priority. But there is some scheduler config that rtkit needs the app to setup.

diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
old mode 100644
new mode 100755
diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c
index 6c60ecd..a09c1cf 100644
--- a/src/core/linux/SDL_threadprio.c
+++ b/src/core/linux/SDL_threadprio.c
@@ -30,7 +30,7 @@
 #include <pthread.h>
 #include "SDL_system.h"
 
-#if SDL_USE_LIBDBUS
+#if HAVE_DBUS_DBUS_H
 #include "SDL_dbus.h"
 /* d-bus queries to org.freedesktop.RealtimeKit1. */
 #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1"
@@ -88,14 +88,15 @@ SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
     }
 
 #if SDL_USE_LIBDBUS
-    /* Note that this fails if you're trying to set high priority
-       and you don't have root permission. BUT DON'T RUN AS ROOT!
-
-       You can grant the ability to increase thread priority by
-       running the following command on your application binary:
-          sudo setcap 'cap_sys_nice=eip' <application>
-
-       Let's try setting priority with RealtimeKit...
+    /* Note that this fails you most likely:
+         * Have your process's scheduler incorrectly configured.
+           See the requirements at:
+           http://git.0pointer.net/rtkit.git/tree/README#n16
+         * Encountered dbus/polkit security restrictions. Note
+           that the RealtimeKit1 dbus endpoint is inaccessible
+           over ssh connections for most common distro configs.
+           You might want to check your local config for details:
+           /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy
 
        README and sample code at: http://git.0pointer.net/rtkit.git
     */