Switch to upstream sleep(3) and usleep(3).

Also fix the signature of usleep, and the definition of useconds_t which
should be unsigned, as the 'u' in its name implies.

This patch also cleans up the existing FreeBSD hacks by moving the libm
stuff from <sys/cdefs.h> to a libm-private header, and adding comments
about the hacks we use to build FreeBSD source.

Change-Id: Ibe5067a380502df94a0a3a7901969b35411085b6
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 175c28b..c7f2ac7 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -550,11 +550,4 @@
 #endif
 #define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
 
-/* Android-added: for FreeBSD's libm. */
-#define __weak_reference(sym,alias) \
-    __asm__(".weak " #alias); \
-    __asm__(".equ "  #alias ", " #sym)
-#define __strong_reference(sym,aliassym) \
-    extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
-
 #endif /* !_SYS_CDEFS_H_ */
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index bb4a9d4..d793f81 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -55,6 +55,7 @@
 typedef __kernel_fsblkcnt_t  fsblkcnt_t;
 typedef __kernel_fsfilcnt_t  fsfilcnt_t;
 typedef __kernel_gid32_t     gid_t;
+typedef __kernel_uid32_t     uid_t;
 typedef __kernel_id_t        id_t;
 typedef __kernel_ino_t       ino_t;
 typedef __kernel_key_t       key_t;
@@ -94,10 +95,10 @@
 typedef __kernel_ssize_t ssize_t;
 #endif
 
-typedef __kernel_suseconds_t  suseconds_t;
-typedef __kernel_time_t       time_t;
-typedef __kernel_uid32_t        uid_t;
-typedef signed long           useconds_t;
+typedef __kernel_time_t time_t;
+
+typedef __kernel_suseconds_t suseconds_t;
+typedef unsigned long useconds_t;
 
 typedef __kernel_daddr_t	daddr_t;
 typedef __kernel_timer_t	timer_t;
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 91b0d8d..29758f5 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -159,7 +159,7 @@
 extern int pause(void);
 extern unsigned int alarm(unsigned int);
 extern unsigned int sleep(unsigned int);
-extern int usleep(unsigned long);
+extern int usleep(useconds_t);
 
 extern int gethostname(char *, size_t);