From 97c351cafd7327fd28047580c9e2528a6f7e742b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 30 May 2017 08:42:27 +0200 Subject: [PATCH] Fix build when using uClinux. Unfortunately uClinux is rather inconsistent with respect to clock_nanosleep(). Older versions of uclibc lack that function, while newer versions may include the declaration but still lack the definition, depending on whether pthreads are selected in the configuration. This patch works around uClinux shortcomings by using the library call when available at compile time, otherwise falling back to syscall(). Signed-off-by: Richard Cochran --- missing.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/missing.h b/missing.h index f7efd92..7bc1776 100644 --- a/missing.h +++ b/missing.h @@ -69,7 +69,10 @@ static inline int clock_adjtime(clockid_t id, struct timex *tx) } #endif -#ifndef __uClinux__ +#ifdef __UCLIBC__ + +#if (_XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L) && \ + defined __UCLIBC_HAS_THREADS_NATIVE__ #include @@ -93,6 +96,11 @@ static inline int timerfd_settime(int fd, int flags, { return syscall(__NR_timerfd_settime, fd, flags, new_value, old_value); } +#endif + +#else /*__UCLIBC__*/ + +#include #endif