mirror of
https://salsa.debian.org/ha-team/libqb
synced 2025-08-26 14:44:58 +00:00
Add Hurd support
* configure.ac: Define QB_GNU. Add a check for a working clock_getres for the CLOCK_MONOTONIC option defining HAVE_CLOCK_GETRES_MONOTONIC. * lib/log_thread.c: Replace second argument of qb_log_thread_priority_set(): logt_sched_param.sched_priority by 0 when not supported by the OS. * lib/util.c: Use the CLOCK_REALTIME option in clock_getres() if HAVE_CLOCK_GETRES_MONOTONIC os not defined.
This commit is contained in:
parent
0e8c01a027
commit
6bd3f0865a
17
configure.ac
17
configure.ac
@ -173,6 +173,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
)
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for a working clock_getres(CLOCK_MONOTONIC, &ts))
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <time.h>]],
|
||||
[[struct timespec ts; if(clock_getres(CLOCK_MONOTONIC, &ts)) return -1;]])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED([HAVE_CLOCK_GETRES_MONOTONIC], 1, [Define to 1 if clock_getres(CLOCK_MONOTONIC, &ts) works])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
AC_MSG_CHECKING(for MSG_NOSIGNAL)
|
||||
AC_TRY_COMPILE([#include <sys/socket.h>],
|
||||
[ int f = MSG_NOSIGNAL; ],
|
||||
@ -335,6 +347,11 @@ case "$host_os" in
|
||||
CP=rsync
|
||||
AC_MSG_RESULT([Solaris])
|
||||
;;
|
||||
*gnu*)
|
||||
AC_DEFINE_UNQUOTED([QB_GNU], [1],
|
||||
[Compiling for GNU/Hurd platform])
|
||||
AC_MSG_RESULT([GNU])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unsupported OS? hmmmm])
|
||||
;;
|
||||
|
@ -164,7 +164,11 @@ qb_log_thread_start(void)
|
||||
|
||||
if (logt_sched_param_queued) {
|
||||
res = qb_log_thread_priority_set(logt_sched_policy,
|
||||
#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
|
||||
logt_sched_param.sched_priority);
|
||||
#else
|
||||
0);
|
||||
#endif
|
||||
if (res != 0) {
|
||||
goto cleanup_pthread;
|
||||
}
|
||||
|
@ -169,7 +169,12 @@ qb_util_nano_monotonic_hz(void)
|
||||
uint64_t nano_monotonic_hz;
|
||||
struct timespec ts;
|
||||
|
||||
#if HAVE_CLOCK_GETRES_MONOTONIC
|
||||
clock_getres(CLOCK_MONOTONIC, &ts);
|
||||
#else
|
||||
if (clock_getres(CLOCK_REALTIME, &ts) != 0)
|
||||
qb_util_perror(LOG_ERR,"CLOCK_REALTIME");
|
||||
#endif
|
||||
|
||||
nano_monotonic_hz =
|
||||
QB_TIME_NS_IN_SEC / ((ts.tv_sec * QB_TIME_NS_IN_SEC) + ts.tv_nsec);
|
||||
|
Loading…
Reference in New Issue
Block a user