]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Do not include sys/syscall.h if not available
authorDavid Engraf <david.engraf@sysgo.com>
Thu, 18 Nov 2021 13:08:35 +0000 (14:08 +0100)
committerDavid Engraf <david.engraf@sysgo.com>
Thu, 18 Nov 2021 13:08:35 +0000 (14:08 +0100)
Some platforms do not provide sys/syscall.h. The configure script already
checks for the existance of the file. Include sys/syscall.h only in case
HAVE_SYS_SYSCALL_H has been set.

include/fileutils.h
include/pidfd-utils.h
lib/cpuset.c
lib/randutils.c
schedutils/ionice.c
schedutils/sched_attr.h
sys-utils/hwclock.c

index 17ad42938549b19b741dcae974bd96a631cfdf8d..c36ce6353735d3d839b1cd0099b2628f0406361c 100644 (file)
@@ -77,7 +77,7 @@ static inline struct dirent *xreaddir(DIR *dp)
        return d;
 }
 
-#if defined(__linux__)
+#ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
 # if defined(SYS_close_range)
 #  include <sys/types.h>
@@ -89,7 +89,7 @@ static inline int close_range(unsigned int first, unsigned int last, int flags)
 #  endif
 #  define HAVE_CLOSE_RANGE 1
 # endif        /* SYS_close_range */
-#endif /* __linux__ */
+#endif /* HAVE_SYS_SYSCALL_H */
 
 extern void ul_close_all_fds(unsigned int first, unsigned int last);
 
index 4a6c3a604436ce0d77138f21536c7dbc2b698d46..eddede9767478be22eafd15f7fd69840362a9d02 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef UTIL_LINUX_PIDFD_UTILS
 #define UTIL_LINUX_PIDFD_UTILS
 
-#if defined(__linux__)
+#ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
 # if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
 #  include <sys/types.h>
@@ -24,5 +24,5 @@ static inline int pidfd_open(pid_t pid, unsigned int flags)
 #  define UL_HAVE_PIDFD 1
 
 # endif        /* SYS_pidfd_send_signal */
-#endif /* __linux__ */
+#endif /* HAVE_SYS_SYSCALL_H */
 #endif /* UTIL_LINUX_PIDFD_UTILS */
index 2847db8530324925972ba96a4bf3eb049ed6c443..9c3284c65022c6882fc8f58a48e8429ae5d94ccd 100644 (file)
@@ -20,7 +20,9 @@
 #include <errno.h>
 #include <string.h>
 #include <ctype.h>
+#ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
+#endif
 
 #include "cpuset.h"
 #include "c.h"
index 39edf4e78935cc395f260e47f4c5898c43088b81..2ffe9b4f069e448217c6c7e0840d6dfc044323c0 100644 (file)
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
-#ifdef __linux__
+#ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
 #endif
 #include "c.h"
index ae2c73ea5b5b2f928bebbee52e26644f3c4a8a74..8be83dfe89ce09f6929f50f32629d3426a41f992 100644 (file)
@@ -11,7 +11,9 @@
 #include <errno.h>
 #include <getopt.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
+#endif
 #include <ctype.h>
 
 #include "nls.h"
index 39d8532a358576a81c016b3c4ae3078035c2eadc..b7559434cca5de1270edcfb1e487811d3593bfe7 100644 (file)
@@ -68,7 +68,7 @@
 # define SCHED_FLAG_UTIL_CLAMP_MAX 0x40
 #endif
 
-#if defined (__linux__)
+#ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
 #endif
 
index 3609814723f00ba305b6d417af6eeaf7ecd5d58d..ff148f62acce38fc045f04b4a84b8d02d90c3b13 100644 (file)
@@ -71,7 +71,9 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 #include <inttypes.h>