

---
 core-builtin.h     | 13 +++++++++++++
 core-sched.h       |  2 +-
 stress-filerace.c  |  5 ++++-
 stress-get.c       |  5 +++--
 stress-nanosleep.c |  2 +-
 stress-ng.h        |  8 ++++++--
 stress-prctl.c     |  3 ++-
 stress-syscall.c   |  2 +-
 8 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/core-builtin.h b/core-builtin.h
index 87595e8..bb558ab 100644
--- a/core-builtin.h
+++ b/core-builtin.h
@@ -20,6 +20,19 @@
 #define CORE_BUILTIN_H
 
 #include "core-attribute.h"
+#include <math.h>
+
+#ifndef sinl
+#define sinl(x) ((long double)sin((double)(x)))
+#endif
+
+#ifndef tanl
+#define tanl(x) ((long double)tan((double)(x)))
+#endif
+
+#ifndef roundl
+#define roundl(x) ((long double)round((double)(x)))
+#endif
 
 #if defined(HAVE_X86INTRIN_H)
 #include <x86intrin.h>
diff --git a/core-sched.h b/core-sched.h
index 8b4d006..5ca807a 100644
--- a/core-sched.h
+++ b/core-sched.h
@@ -25,7 +25,7 @@
 #include <linux/sched.h>
 #endif
 
-#if defined(HAVE_SYSCALL_H)
+#if defined(HAVE_SYSCALL_H) && !defined(__UCLIBC__)
 #include <sys/syscall.h>
 #endif
 
diff --git a/stress-filerace.c b/stress-filerace.c
index 003f027..412cc5d 100644
--- a/stress-filerace.c
+++ b/stress-filerace.c
@@ -1524,8 +1524,11 @@ static void stress_filerace_child(stress_args_t *args, const char *pathname, con
 					if (lseek(tmp_fd, 0, SEEK_SET) != (off_t)-1) {
 						do {
 							long rd;
-
+#if defined(SYS_getdents)
 							rd = syscall(SYS_getdents, tmp_fd, dirbuf, j);
+#else	
+						        rd = syscall(__NR_getdents, tmp_fd, dirbuf, j);
+#endif							
 							if (rd <= 0)
 								break;
 						} while (stress_continue(args));
diff --git a/stress-get.c b/stress-get.c
index b9fabf6..e8a5fef 100644
--- a/stress-get.c
+++ b/stress-get.c
@@ -25,7 +25,7 @@
 #include <math.h>
 #include <time.h>
 
-#if defined(HAVE_LINUX_SYSCTL_H)
+#if defined(HAVE_LINUX_SYSCTL_H) && !defined(__UCLIBC__)
 #include <linux/sysctl.h>
 #endif
 
@@ -558,7 +558,8 @@ static int stress_sysctl(stress_args_t *args)
 {
 #if defined(HAVE_LINUX_SYSCTL_H) &&	\
     defined(__NR__sysctl) &&		\
-    defined(HAVE_SYSCALL)
+    defined(HAVE_SYSCALL) &&		\
+    !defined(__UCLIBC__)
 	/*
 	 *  _sysctl is a deprecated API, so it
 	 *  probably will return -ENOSYS
diff --git a/stress-nanosleep.c b/stress-nanosleep.c
index 2beb160..0141e8c 100644
--- a/stress-nanosleep.c
+++ b/stress-nanosleep.c
@@ -93,7 +93,7 @@ static const stress_opt_t opts[] = {
 	END_OPT,
 };
 
-#if defined(HAVE_LIB_PTHREAD)
+#if defined(HAVE_LIB_PTHREAD) && !defined(__UCLIBC__)
 
 static void MLOCKED_TEXT stress_sigalrm_handler(int signum)
 {
diff --git a/stress-ng.h b/stress-ng.h
index 920c003..c444928 100644
--- a/stress-ng.h
+++ b/stress-ng.h
@@ -142,13 +142,13 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#if defined(HAVE_SYSCALL_H)
+#if defined(HAVE_SYSCALL_H) && !defined(__UCLIBC__)
 #include <sys/syscall.h>
 #endif
 #if defined(HAVE_SYS_SYSINFO_H)
 #include <sys/sysinfo.h>
 #if defined(HAVE_COMPILER_GCC_OR_MUSL) &&	\
-    !defined(__GLIBC__)
+    (!defined(__GLIBC__) || defined(__UCLIBC__))
 /* Suppress kernel sysinfo to avoid collision with musl */
 #define _LINUX_SYSINFO_H
 #endif
@@ -161,6 +161,10 @@
 #define O_PATH     	010000000
 #endif
 
+#if defined(__UCLIBC__)
+#include <asm/unistd.h>
+#endif
+
 #define STRESS_STRESSOR_STATUS_PASSED		(0)
 #define STRESS_STRESSOR_STATUS_FAILED		(1)
 #define STRESS_STRESSOR_STATUS_SKIPPED		(2)
diff --git a/stress-prctl.c b/stress-prctl.c
index b0c24d1..3589944 100644
--- a/stress-prctl.c
+++ b/stress-prctl.c
@@ -269,7 +269,8 @@ static inline void stress_arch_prctl(void)
     defined(PR_SYS_DISPATCH_ON)	&&		\
     defined(PR_SYS_DISPATCH_OFF) &&		\
     defined(__NR_kill) &&			\
-    defined(STRESS_ARCH_X86)
+    defined(STRESS_ARCH_X86) &&			\
+    !defined(__UCLIBC__)
 
 typedef struct {
 	int  sig;	/* signal number */
diff --git a/stress-syscall.c b/stress-syscall.c
index ba5687c..2249d64 100644
--- a/stress-syscall.c
+++ b/stress-syscall.c
@@ -77,7 +77,7 @@
 #include <linux/seccomp.h>
 #endif
 
-#if defined(HAVE_LINUX_SYSCTL_H)
+#if defined(HAVE_LINUX_SYSCTL_H) && !defined(__UCLIBC__)
 #include <linux/sysctl.h>
 #endif
 
-- 
2.34.1

