[Toybox] [PATCH] macOS: work around header idiosyncracies.

enh enh at google.com
Fri Nov 30 13:32:51 PST 2018


---
 lib/portability.h | 10 ++++++++++
 toys.h            |  3 ---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/portability.h b/lib/portability.h
index 3f841bac..21d0b8a1 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -147,7 +147,17 @@ int clearenv(void);

 // Linux headers not listed by POSIX or LSB
 #include <sys/mount.h>
+#ifdef __linux__
+#include <sys/statfs.h>
 #include <sys/swap.h>
+#include <sys/sysinfo.h>
+#endif
+
+#ifdef __APPLE__
+#include <util.h>
+#else
+#include <pty.h>
+#endif

 // Android is missing some headers and functions
 // "generated/config.h" is included first
diff --git a/toys.h b/toys.h
index 0e8d4684..5e71e3fe 100644
--- a/toys.h
+++ b/toys.h
@@ -62,10 +62,7 @@
 #include <wctype.h>

 // LSB 4.1 headers
-#include <pty.h>
 #include <sys/ioctl.h>
-#include <sys/statfs.h>
-#include <sys/sysinfo.h>

 #include "lib/lib.h"
 #include "lib/lsm.h"
-- 
2.19.0.605.g01d371f741-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-macOS-work-around-header-idiosyncracies.patch
Type: application/octet-stream
Size: 1157 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181130/f006f451/attachment-0002.obj>


More information about the Toybox mailing list