Don't enable RTKit/D-Bus support on Windows
This commit is contained in:
parent
5c55ec2f9b
commit
c870e550fa
@ -677,39 +677,42 @@ set(CORE_OBJS
|
|||||||
core/voice_change.h)
|
core/voice_change.h)
|
||||||
|
|
||||||
set(HAVE_RTKIT 0)
|
set(HAVE_RTKIT 0)
|
||||||
option(ALSOFT_REQUIRE_RTKIT "Require RTKit/D-Bus support" FALSE)
|
if(NOT WIN32)
|
||||||
find_package(DBus1 QUIET)
|
option(ALSOFT_REQUIRE_RTKIT "Require RTKit/D-Bus support" FALSE)
|
||||||
if(NOT DBus1_FOUND AND PkgConfig_FOUND)
|
find_package(DBus1 QUIET)
|
||||||
pkg_check_modules(DBUS dbus-1)
|
if(NOT DBus1_FOUND AND PkgConfig_FOUND)
|
||||||
endif()
|
pkg_check_modules(DBUS dbus-1)
|
||||||
if(DBus1_FOUND OR DBUS_FOUND)
|
endif()
|
||||||
option(ALSOFT_RTKIT "Enable RTKit support" ON)
|
if(DBus1_FOUND OR DBUS_FOUND)
|
||||||
if(ALSOFT_RTKIT)
|
option(ALSOFT_RTKIT "Enable RTKit support" ON)
|
||||||
set(HAVE_RTKIT 1)
|
if(ALSOFT_RTKIT)
|
||||||
set(CORE_OBJS ${CORE_OBJS} core/dbus_wrap.cpp core/dbus_wrap.h core/rtkit.cpp core/rtkit.h)
|
set(HAVE_RTKIT 1)
|
||||||
if(NOT DBus1_FOUND)
|
set(CORE_OBJS ${CORE_OBJS} core/dbus_wrap.cpp core/dbus_wrap.h
|
||||||
set(INC_PATHS ${INC_PATHS} ${DBUS_INCLUDE_DIRS})
|
core/rtkit.cpp core/rtkit.h)
|
||||||
set(CPP_DEFS ${CPP_DEFS} ${DBUS_CFLAGS_OTHER})
|
if(NOT DBus1_FOUND)
|
||||||
if(NOT WIN32 AND NOT HAVE_DLFCN_H)
|
set(INC_PATHS ${INC_PATHS} ${DBUS_INCLUDE_DIRS})
|
||||||
set(EXTRA_LIBS ${EXTRA_LIBS} ${DBUS_LINK_LIBRARIES})
|
set(CPP_DEFS ${CPP_DEFS} ${DBUS_CFLAGS_OTHER})
|
||||||
|
if(NOT HAVE_DLFCN_H)
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${DBUS_LINK_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
elseif(HAVE_DLFCN_H)
|
||||||
|
set(INC_PATHS ${INC_PATHS} ${DBus1_INCLUDE_DIRS})
|
||||||
|
set(CPP_DEFS ${CPP_DEFS} ${DBus1_DEFINITIONS})
|
||||||
|
else()
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${DBus1_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
elseif(WIN32 OR HAVE_DLFCN_H)
|
|
||||||
set(INC_PATHS ${INC_PATHS} ${DBus1_INCLUDE_DIRS})
|
|
||||||
set(CPP_DEFS ${CPP_DEFS} ${DBus1_DEFINITIONS})
|
|
||||||
else()
|
|
||||||
set(EXTRA_LIBS ${EXTRA_LIBS} ${DBus1_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
set(MISSING_VARS "")
|
||||||
|
if(NOT DBus1_INCLUDE_DIRS)
|
||||||
|
set(MISSING_VARS "${MISSING_VARS} DBus1_INCLUDE_DIRS")
|
||||||
|
endif()
|
||||||
|
if(NOT DBus1_LIBRARIES)
|
||||||
|
set(MISSING_VARS "${MISSING_VARS} DBus1_LIBRARIES")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Could NOT find DBus1 (missing:${MISSING_VARS})")
|
||||||
|
unset(MISSING_VARS)
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
set(MISSING_VARS "")
|
|
||||||
if(NOT DBus1_INCLUDE_DIRS)
|
|
||||||
set(MISSING_VARS "${MISSING_VARS} DBus1_INCLUDE_DIRS")
|
|
||||||
endif()
|
|
||||||
if(NOT DBus1_LIBRARIES)
|
|
||||||
set(MISSING_VARS "${MISSING_VARS} DBus1_LIBRARIES")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Could NOT find DBus1 (missing:${MISSING_VARS})")
|
|
||||||
unset(MISSING_VARS)
|
|
||||||
endif()
|
endif()
|
||||||
if(ALSOFT_REQUIRE_RTKIT AND NOT HAVE_RTKIT)
|
if(ALSOFT_REQUIRE_RTKIT AND NOT HAVE_RTKIT)
|
||||||
message(FATAL_ERROR "Failed to enabled required RTKit support")
|
message(FATAL_ERROR "Failed to enabled required RTKit support")
|
||||||
|
@ -461,6 +461,17 @@ bool SetRTPriorityRTKit(int prio)
|
|||||||
/* Don't stupidly exit if the connection dies while doing this. */
|
/* Don't stupidly exit if the connection dies while doing this. */
|
||||||
dbus_connection_set_exit_on_disconnect(conn.get(), false);
|
dbus_connection_set_exit_on_disconnect(conn.get(), false);
|
||||||
|
|
||||||
|
int nicemin{};
|
||||||
|
int err{rtkit_get_min_nice_level(conn.get(), &nicemin)};
|
||||||
|
if(err == -ENOENT)
|
||||||
|
{
|
||||||
|
err = std::abs(err);
|
||||||
|
ERR("Could not query RTKit: %s (%d)\n", std::strerror(err), err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int rtmax{rtkit_get_max_realtime_priority(conn.get())};
|
||||||
|
TRACE("Maximum real-time priority: %d, minimum niceness: %d\n", rtmax, nicemin);
|
||||||
|
|
||||||
auto limit_rttime = [](DBusConnection *c) -> int
|
auto limit_rttime = [](DBusConnection *c) -> int
|
||||||
{
|
{
|
||||||
using ulonglong = unsigned long long;
|
using ulonglong = unsigned long long;
|
||||||
@ -483,18 +494,6 @@ bool SetRTPriorityRTKit(int prio)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
int nicemin{};
|
|
||||||
int err{rtkit_get_min_nice_level(conn.get(), &nicemin)};
|
|
||||||
if(err == -ENOENT)
|
|
||||||
{
|
|
||||||
err = std::abs(err);
|
|
||||||
ERR("Could not query RTKit: %s (%d)\n", std::strerror(err), err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int rtmax{rtkit_get_max_realtime_priority(conn.get())};
|
|
||||||
TRACE("Maximum real-time priority: %d, minimum niceness: %d\n", rtmax, nicemin);
|
|
||||||
|
|
||||||
if(rtmax > 0)
|
if(rtmax > 0)
|
||||||
{
|
{
|
||||||
if(AllowRTTimeLimit)
|
if(AllowRTTimeLimit)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user