make busybox more portable
authorSean MacLennan <seanm@seanm.ca>
Sun, 4 Mar 2018 22:15:59 +0000 (23:15 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 4 Mar 2018 22:15:59 +0000 (23:15 +0100)
Move some distro specific include files into the appropriate #ifdef
blocks to make the code more portable.

Signed-off-by: Sean MacLennan <seanm@seanm.ca>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/missing_syscalls.c
libbb/vfork_daemon_rexec.c

index 0934128117a6a8999e8749050be1974d229abda7..87cf59b3d4cc1cf3b41c81ea1c36dc9c3a1c7392 100644 (file)
@@ -3,14 +3,13 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-
 //kbuild:lib-y += missing_syscalls.o
 
-/*#include <linux/timex.h> - for struct timex, but may collide with <time.h> */
-#include <sys/syscall.h>
 #include "libbb.h"
 
 #if defined(ANDROID) || defined(__ANDROID__)
+/*# include <linux/timex.h> - for struct timex, but may collide with <time.h> */
+# include <sys/syscall.h>
 pid_t getsid(pid_t pid)
 {
        return syscall(__NR_getsid, pid);
index 6125983ce7949f5e882c7b8c3bd81c857f274da1..c0bea0ed21b3eb7bcc806432627e3c25fbb28b86 100644 (file)
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-#include <sys/prctl.h>
-#ifndef PR_SET_NAME
-#define PR_SET_NAME 15
-#endif
-#ifndef PR_GET_NAME
-#define PR_GET_NAME 16
-#endif
-
 #include "busybox.h" /* uses applet tables */
 #include "NUM_APPLETS.h"
 
 #define NOEXEC_SUPPORT ((NUM_APPLETS > 1) && (ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE))
 
 #if defined(__linux__) && (NUM_APPLETS > 1)
+# include <sys/prctl.h>
+# ifndef PR_SET_NAME
+# define PR_SET_NAME 15
+# endif
+# ifndef PR_GET_NAME
+# define PR_GET_NAME 16
+# endif
 void FAST_FUNC set_task_comm(const char *comm)
 {
        /* okay if too long (truncates) */