Fix <features.h> (_BSD_SOURCE and _GNU_SOURCE).
<features.h> is supposed to take user-settable stuff like _GNU_SOURCE
and _BSD_SOURCE and turn them into __USE_GNU and __USE_BSD for use in
the C library headers. Instead, bionic used to unconditionally define
_BSD_SOURCE and _GNU_SOURCE, and then test _GNU_SOURCE in the header
files (which makes no sense whatsoever).
Bug: 14659579
Change-Id: Ice4cf21a364ea2e559071dc8329e995277d5b987
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 781fc44..c3e655e 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -28,6 +28,7 @@
#ifndef _UNISTD_H_
#define _UNISTD_H_
+#include <features.h>
#include <stddef.h>
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -112,7 +113,7 @@
extern int fchdir(int);
extern int rmdir(const char *);
extern int pipe(int *);
-#ifdef _GNU_SOURCE
+#if defined(__USE_GNU)
extern int pipe2(int *, int);
#endif
extern int chroot(const char *);
@@ -143,7 +144,7 @@
extern int dup(int);
extern int dup2(int, int);
-#ifdef _GNU_SOURCE
+#if defined(__USE_GNU)
extern int dup3(int, int, int);
#endif
extern int fcntl(int, int, ...);