diff lib/portability.h @ 1564:685a0da6ca59 draft

probe for getspnam(), forkpty(), utmpx, replace sethostname() Android is missing all of these; we need to probe for some so we have a config symbol to depend on. sethostname() is easily replaced. We got termios.h via pty.h; now it's not included in configure-step tools, so we need termios.h to generate globals.
author Isaac Dunham <ibid.ag@gmail.com>
date Wed, 19 Nov 2014 16:38:46 -0600
parents 7afd32673a5c
children a3500bd8b322
line wrap: on
line diff
--- a/lib/portability.h	Wed Nov 19 14:29:53 2014 -0600
+++ b/lib/portability.h	Wed Nov 19 16:38:46 2014 -0600
@@ -180,10 +180,25 @@
 #endif
 
 // Linux headers not listed by POSIX or LSB
-#include <shadow.h>
 #include <sys/mount.h>
 #include <sys/swap.h>
 
+// Android is missing some headers and functions
+#if defined(__ANDROID__)
+int sethostname(const char *name, size_t len);
+#endif
+// "generated/config.h" is included first
+#if defined(CFG_TOYBOX_SHADOW) && CFG_TOYBOX_SHADOW
+#include <shadow.h>
+#endif
+#if defined(CFG_TOYBOX_UTMPX) && CFG_TOYBOX_UTMPX
+#include <utmpx.h>
+#endif
+#if defined(CFG_TOYBOX_PTY) && CFG_TOYBOX_PTY
+#include <pty.h>
+#endif
+
+
 // Some systems don't define O_NOFOLLOW, and it varies by architecture, so...
 #include <fcntl.h>
 #ifndef O_NOFOLLOW