]> code.delx.au - pulseaudio/commitdiff
core-util: set_scheduler: check for RLIMIT_RTTIME
authorRyan Lortie <desrt@desrt.ca>
Tue, 10 Dec 2013 18:27:52 +0000 (13:27 -0500)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Fri, 13 Dec 2013 12:00:14 +0000 (14:00 +0200)
set_scheduler() assumes that if sys/resource.h was found then we will
find RLIMIT_RTTIME there, but this is a non-POSIX extension on Linux.

Change the check to ensure that RLIMIT_RTTIME is actually defined.
Linux indeed defines this as a macro, and POSIX specifies that the other
RLIMIT_ constants must be macros, so having this as an #ifdef seems
correct.

src/pulsecore/core-util.c

index 06c38841ac5dd5cda226291874c5198ee7e480f8..2efa280eebe6b7ccae0e85456c7e54c346fd6a2c 100644 (file)
@@ -707,7 +707,7 @@ static int set_scheduler(int rtprio) {
 #ifdef HAVE_DBUS
     int r;
     long long rttime;
-#ifdef HAVE_SYS_RESOURCE_H
+#ifdef RLIMIT_RTTIME
     struct rlimit rl;
 #endif
     DBusError error;
@@ -749,7 +749,7 @@ static int set_scheduler(int rtprio) {
 
     rttime = rtkit_get_rttime_usec_max(bus);
     if (rttime >= 0) {
-#ifdef HAVE_SYS_RESOURCE_H
+#ifdef RLIMIT_RTTIME
         r = getrlimit(RLIMIT_RTTIME, &rl);
 
         if (r >= 0 && (long long) rl.rlim_max > rttime) {