libc: tag missing functions in system headers.

This matches recent changes in the NDK header.
We enclose missing functions in #if 0 .. #endif blocks
with a clear "MISSING" in comments in order to locate
them later.

Change-Id: I87b3a62e777897e75c9243360fb0a82bcc53d9fb
diff --git a/libc/include/getopt.h b/libc/include/getopt.h
index 6b4954b..56f1983 100644
--- a/libc/include/getopt.h
+++ b/libc/include/getopt.h
@@ -71,14 +71,19 @@
 #ifndef _GETOPT_DEFINED_
 #define _GETOPT_DEFINED_
 int	 getopt(int, char * const *, const char *);
-int	 getsubopt(char **, char * const *, char **);
+
 
 extern   char *optarg;                  /* getopt(3) external variables */
 extern   int opterr;
 extern   int optind;
 extern   int optopt;
 extern   int optreset;
+
+#if 0 /* MISSING FROM BIONIC */
+int       getsubopt(char **, char * const *, char **);
 extern   char *suboptarg;               /* getsubopt(3) external variable */
+#endif /* MISSING */
+
 #endif
 __END_DECLS
  
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 33b9ad6..e702470 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -69,7 +69,7 @@
 #define CLONE_CHILD_SETTID   0x01000000
 #define CLONE_STOPPED        0x02000000
 
-#ifdef __GNU_SOURCE
+#ifdef _GNU_SOURCE
 extern int clone(int (*fn)(void *), void *child_stack, int flags, void*  arg, ...);
 #endif
 
diff --git a/libc/include/signal.h b/libc/include/signal.h
index 7bc3145..4401164 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -120,6 +120,7 @@
 extern int raise(int);
 extern int kill(pid_t, int);
 extern int killpg(int pgrp, int sig);
+extern int sigaltstack(const stack_t *ss, stack_t *oss);
 
 
 __END_DECLS
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index d164e95..c38ed5a 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -300,8 +300,10 @@
 #define L_cuserid	9	/* size for cuserid(); UT_NAMESIZE + 1 */
 
 __BEGIN_DECLS
+#if 0 /* MISSING FROM BIONIC */
 char	*ctermid(char *);
 char	*cuserid(char *);
+#endif /* MISSING */
 FILE	*fdopen(int, const char *);
 int	 fileno(FILE *);
 
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index f889159..97d8e46 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -50,7 +50,6 @@
 extern __noreturn void exit(int);
 extern __noreturn void abort(void);
 extern int atexit(void (*)(void));
-extern int on_exit(void (*)(int, void *), void *);
 
 extern char *getenv(const char *);
 extern int putenv(const char *);
@@ -164,6 +163,7 @@
 
 extern lldiv_t   lldiv(long long, long long);
 
+#if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */
 /* make STLPort happy */
 extern int      mblen(const char *, size_t);
 extern size_t   mbstowcs(wchar_t *, const char *, size_t);
@@ -172,8 +172,14 @@
 /* Likewise, make libstdc++-v3 happy.  */
 extern int	wctomb(char *, wchar_t);
 extern size_t	wcstombs(char *, const wchar_t *, size_t);
+#endif /* MISSING */
+
 #define MB_CUR_MAX 1
 
+#if 0 /* MISSING FROM BIONIC */
+extern int on_exit(void (*)(int, void *), void *);
+#endif /* MISSING */
+
 __END_DECLS
 
 #endif /* _STDLIB_H_ */
diff --git a/libc/include/sys/fsuid.h b/libc/include/sys/fsuid.h
index 3257bc0..bc47e3d 100644
--- a/libc/include/sys/fsuid.h
+++ b/libc/include/sys/fsuid.h
@@ -33,8 +33,10 @@
 
 __BEGIN_DECLS
 
+#if 0 /* MISSING FROM BIONIC */
 extern int setfsuid(uid_t);
 extern int setfsgid(gid_t);
+#endif /* MISSING */
 
 __END_DECLS
 
diff --git a/libc/include/sys/mount.h b/libc/include/sys/mount.h
index 62c4ee2..ba88447 100644
--- a/libc/include/sys/mount.h
+++ b/libc/include/sys/mount.h
@@ -92,7 +92,10 @@
 		   const void *);
 extern int umount(const char *);
 extern int umount2(const char *, int);
+
+#if 0 /* MISSING FROM BIONIC */
 extern int pivot_root(const char *, const char *);
+#endif /* MISSING */
 
 __END_DECLS
 
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index cd09e3d..29154a2 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -61,16 +61,13 @@
 extern pid_t  getpgrp(void);
 extern int    setpgrp(void);
 extern pid_t  setsid(void);
-extern pid_t  getsid(pid_t);
 
 extern int execv(const char *, char * const *);
 extern int execvp(const char *, char * const *);
 extern int execve(const char *, char * const *, char * const *);
-extern int execvpe(const char *, char * const *, char * const *);
 extern int execl(const char *, const char *, ...);
 extern int execlp(const char *, const char *, ...);
 extern int execle(const char *, const char *, ...);
-extern int execlpe(const char *, const char *, ...);
 extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
 extern int capset(cap_user_header_t hdrp, const cap_user_data_t datap);
 extern int prctl(int  option,  unsigned long arg2, unsigned long arg3,
@@ -94,11 +91,8 @@
 extern int setresgid(gid_t, gid_t, gid_t);
 extern int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
 extern int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
-extern int getfsuid(uid_t);
-extern int setfsuid(uid_t);
 extern int issetugid(void);
 extern char* getlogin(void);
-extern int getlogin_r(char* name, size_t namesize);
 extern char* getusershell(void);
 extern void setusershell(void);
 extern void endusershell(void);
@@ -156,9 +150,6 @@
 extern int usleep(unsigned long);
 
 extern int gethostname(char *, size_t);
-extern int sethostname(const char *, size_t);
-extern int getdomainname(char *, size_t);
-extern int setdomainname(const char *, size_t);
 
 extern int getdtablesize(void);
 
@@ -195,6 +186,18 @@
 extern pid_t tcgetpgrp(int fd);
 extern int   tcsetpgrp(int fd, pid_t _pid);
 
+#if 0 /* MISSING FROM BIONIC */
+extern pid_t  getsid(pid_t);
+extern int execvpe(const char *, char * const *, char * const *);
+extern int execlpe(const char *, const char *, ...);
+extern int getfsuid(uid_t);
+extern int setfsuid(uid_t);
+extern int getlogin_r(char* name, size_t namesize);
+extern int sethostname(const char *, size_t);
+extern int getdomainname(char *, size_t);
+extern int setdomainname(const char *, size_t);
+#endif /* MISSING */
+
 /* Used to retry syscalls that can return EINTR. */
 #define TEMP_FAILURE_RETRY(exp) ({         \
     typeof (exp) _rc;                      \