try_timestamping=0
feat_ntp_signd=0
ntp_era_split=""
+use_pthread=0
default_user="root"
default_hwclockfile=""
default_pidfile="/var/run/chrony/chronyd.pid"
add_def FEAT_ASYNCDNS
add_def USE_PTHREAD_ASYNCDNS
EXTRA_OBJECTS="$EXTRA_OBJECTS nameserv_async.o"
- MYCFLAGS="$MYCFLAGS -pthread"
+ use_pthread=1
fi
if test_code 'arc4random_buf()' 'stdlib.h' '' '' 'arc4random_buf(NULL, 0);'; then
if [ $try_setsched = "1" ] && \
test_code \
- 'sched_setscheduler()' \
- 'sched.h' '' '' '
+ 'pthread_setschedparam()' \
+ 'pthread.h sched.h' '-pthread' '' '
struct sched_param sched;
sched_get_priority_max(SCHED_FIFO);
- sched_setscheduler(0, SCHED_FIFO, &sched);'
+ pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched);'
then
- add_def HAVE_SCHED_SETSCHEDULER
+ add_def HAVE_PTHREAD_SETSCHEDPARAM
+ use_pthread=1
fi
if [ $try_lockmem = "1" ] && \
fi
fi
+if [ $use_pthread = "1" ]; then
+ MYCFLAGS="$MYCFLAGS -pthread"
+fi
+
SYSCONFDIR=/etc
if [ "x$SETSYSCONFDIR" != "x" ]; then
SYSCONFDIR=$SETSYSCONFDIR
void SYS_SetScheduler(int SchedPriority)
{
-#if defined(LINUX) && defined(HAVE_SCHED_SETSCHEDULER)
+#if defined(LINUX) && defined(HAVE_PTHREAD_SETSCHEDPARAM)
SYS_Linux_SetScheduler(SchedPriority);
#elif defined(MACOSX)
SYS_MacOSX_SetScheduler(SchedPriority);
#include <sys/utsname.h>
-#if defined(HAVE_SCHED_SETSCHEDULER)
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM)
+# include <pthread.h>
# include <sched.h>
#endif
/* ================================================== */
-#if defined(HAVE_SCHED_SETSCHEDULER)
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM)
/* Install SCHED_FIFO real-time scheduler with specified priority */
void SYS_Linux_SetScheduler(int SchedPriority)
{
else if ( SchedPriority < pmin ) {
sched.sched_priority = pmin;
}
- if ( sched_setscheduler(0, SCHED_FIFO, &sched) == -1 ) {
- LOG(LOGS_ERR, "sched_setscheduler() failed");
+ if ( pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched) == -1 ) {
+ LOG(LOGS_ERR, "pthread_setschedparam() failed");
}
else {
DEBUG_LOG("Enabled SCHED_FIFO with priority %d",
}
}
}
-#endif /* HAVE_SCHED_SETSCHEDULER */
+#endif /* HAVE_PTHREAD_SETSCHEDPARAM */
#if defined(HAVE_MLOCKALL)
/* Lock the process into RAM so that it will never be swapped out */