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 <richardcochran@gmail.com>master
parent
95b5a13cb2
commit
97c351cafd
10
missing.h
10
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 <sys/timerfd.h>
|
||||
|
||||
|
@ -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 <sys/timerfd.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue