src/core/linux/SDL_dbus.c
changeset 12456 f8041c025fd3
parent 12437 ab67e41946fe
child 12503 806492103856
     1.1 --- a/src/core/linux/SDL_dbus.c	Wed Dec 05 16:49:38 2018 -0500
     1.2 +++ b/src/core/linux/SDL_dbus.c	Wed Dec 05 16:51:22 2018 -0500
     1.3 @@ -21,13 +21,6 @@
     1.4  #include "../../SDL_internal.h"
     1.5  #include "SDL_dbus.h"
     1.6  
     1.7 -#if !SDL_THREADS_DISABLED
     1.8 -#include <sys/time.h>
     1.9 -#include <sys/resource.h>
    1.10 -#include <pthread.h>
    1.11 -#include "SDL_system.h"
    1.12 -#endif
    1.13 -
    1.14  #if SDL_USE_LIBDBUS
    1.15  /* we never link directly to libdbus. */
    1.16  #include "SDL_loadso.h"
    1.17 @@ -349,82 +342,6 @@
    1.18  
    1.19      return SDL_TRUE;
    1.20  }
    1.21 -
    1.22 -#if !SDL_THREADS_DISABLED
    1.23 -/* d-bus queries to org.freedesktop.RealtimeKit1. */
    1.24 -#define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1"
    1.25 -#define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1"
    1.26 -#define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1"
    1.27 -
    1.28 -static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT;
    1.29 -static Sint32 rtkit_min_nice_level = -20;
    1.30 -
    1.31 -static void
    1.32 -rtkit_initialize()
    1.33 -{
    1.34 -    SDL_DBusContext *dbus = SDL_DBus_GetContext();
    1.35 -
    1.36 -    /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */
    1.37 -    if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel",
    1.38 -                                            DBUS_TYPE_INT32, &rtkit_min_nice_level)) {
    1.39 -        rtkit_min_nice_level = -20;
    1.40 -    }
    1.41 -}
    1.42 -
    1.43 -static SDL_bool
    1.44 -rtkit_setpriority(pid_t thread, int nice_level)
    1.45 -{
    1.46 -    Uint64 ui64 = (Uint64)thread;
    1.47 -    Sint32 si32 = (Sint32)nice_level;
    1.48 -    SDL_DBusContext *dbus = SDL_DBus_GetContext();
    1.49 -
    1.50 -    pthread_once(&rtkit_initialize_once, rtkit_initialize);
    1.51 -
    1.52 -    if (si32 < rtkit_min_nice_level)
    1.53 -        si32 = rtkit_min_nice_level;
    1.54 -
    1.55 -    if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn,
    1.56 -            RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadHighPriority",
    1.57 -            DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID,
    1.58 -            DBUS_TYPE_INVALID)) {
    1.59 -        return SDL_FALSE;
    1.60 -    }
    1.61 -    return SDL_TRUE;
    1.62 -}
    1.63  #endif
    1.64  
    1.65 -#endif
    1.66 -
    1.67 -/* this is a public symbol, so it has to exist even if threads are disabled. */
    1.68 -int
    1.69 -SDL_LinuxSetThreadPriority(Sint64 threadID, int priority)
    1.70 -{
    1.71 -#if SDL_THREADS_DISABLED
    1.72 -    return SDL_Unsupported();
    1.73 -#else
    1.74 -    if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) {
    1.75 -        return 0;
    1.76 -    }
    1.77 -
    1.78 -#if SDL_USE_LIBDBUS
    1.79 -    /* Note that this fails if you're trying to set high priority
    1.80 -       and you don't have root permission. BUT DON'T RUN AS ROOT!
    1.81 -
    1.82 -       You can grant the ability to increase thread priority by
    1.83 -       running the following command on your application binary:
    1.84 -          sudo setcap 'cap_sys_nice=eip' <application>
    1.85 -
    1.86 -       Let's try setting priority with RealtimeKit...
    1.87 -
    1.88 -       README and sample code at: http://git.0pointer.net/rtkit.git
    1.89 -    */
    1.90 -    if (rtkit_setpriority((pid_t)threadID, priority)) {
    1.91 -        return 0;
    1.92 -    }
    1.93 -#endif
    1.94 -
    1.95 -    return SDL_SetError("setpriority() failed");
    1.96 -#endif
    1.97 -}
    1.98 -
    1.99  /* vi: set ts=4 sw=4 expandtab: */