diff lib/portability.c @ 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 786841fdb1e0
children 272bd62cb194
line wrap: on
line diff
--- a/lib/portability.c	Wed Nov 19 14:29:53 2014 -0600
+++ b/lib/portability.c	Wed Nov 19 16:38:46 2014 -0600
@@ -5,6 +5,9 @@
  */
 
 #include "toys.h"
+#if defined(__ANDROID__)
+#include <asm/unistd.h>
+#endif
 
 #if defined(__APPLE__) || defined(__ANDROID__)
 ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
@@ -61,6 +64,13 @@
 }
 #endif
 
+#if defined(__ANDROID__)
+int sethostname(const char *name, size_t len)
+{
+  return syscall(__NR_sethostname, name, len);
+}
+#endif
+
 #if defined(__APPLE__)
 extern char **environ;