Remove <sys/_types.h>.

Bug: 12213562
Change-Id: I0d10664f9da60739bdbad0408be0dd61eea3c1fe
diff --git a/libc/include/search.h b/libc/include/search.h
index e12e49e..1301a08 100644
--- a/libc/include/search.h
+++ b/libc/include/search.h
@@ -10,7 +10,6 @@
 #define _SEARCH_H_
 
 #include <sys/cdefs.h>
-#include <sys/_types.h>
 
 typedef	enum {
 	preorder,
diff --git a/libc/include/stdint.h b/libc/include/stdint.h
index be49485..0d65ff8 100644
--- a/libc/include/stdint.h
+++ b/libc/include/stdint.h
@@ -30,7 +30,28 @@
 #define _STDINT_H
 
 #include <stddef.h>
-#include <sys/_types.h>
+
+typedef __signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef short __int16_t;
+typedef unsigned short __uint16_t;
+typedef int __int32_t;
+typedef unsigned int __uint32_t;
+#if __LP64__
+typedef long __int64_t;
+typedef unsigned long __uint64_t;
+#else
+typedef long long __int64_t;
+typedef unsigned long long __uint64_t;
+#endif
+
+#if __LP64__
+typedef long __intptr_t;
+typedef unsigned long __uintptr_t;
+#else
+typedef int __intptr_t;
+typedef unsigned int __uintptr_t;
+#endif
 
 typedef __int8_t      int8_t;
 typedef __uint8_t     uint8_t;
@@ -44,6 +65,9 @@
 typedef __int64_t     int64_t;
 typedef __uint64_t    uint64_t;
 
+typedef __intptr_t    intptr_t;
+typedef __uintptr_t   uintptr_t;
+
 typedef int8_t        int_least8_t;
 typedef int8_t        int_fast8_t;
 
@@ -68,16 +92,8 @@
 typedef uint64_t      uint_least64_t;
 typedef uint64_t      uint_fast64_t;
 
-#ifdef __LP64__
-typedef long          intptr_t;
-typedef unsigned long uintptr_t;
-#else
-typedef int           intptr_t;
-typedef unsigned int  uintptr_t;
-#endif
-
-typedef uint64_t uintmax_t;
-typedef int64_t  intmax_t;
+typedef uint64_t      uintmax_t;
+typedef int64_t       intmax_t;
 
 /* Keep the kernel from trying to define these types... */
 #define __BIT_TYPES_DEFINED__
diff --git a/libc/include/sys/_types.h b/libc/include/sys/_types.h
deleted file mode 100644
index 6bf9c1c..0000000
--- a/libc/include/sys/_types.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*	$OpenBSD: _types.h,v 1.1 2006/01/06 18:53:05 millert Exp $	*/
-
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)types.h	8.3 (Berkeley) 1/5/94
- */
-
-#ifndef _SYS__TYPES_H_
-#define _SYS__TYPES_H_
-
-typedef __signed char __int8_t;
-typedef unsigned char __uint8_t;
-typedef short __int16_t;
-typedef unsigned short __uint16_t;
-typedef int __int32_t;
-typedef unsigned int __uint32_t;
-#if __LP64__
-typedef long __int64_t;
-typedef unsigned long __uint64_t;
-#else
-typedef long long __int64_t;
-typedef unsigned long long __uint64_t;
-#endif
-
-#if __LP64__
-typedef long __intptr_t;
-typedef unsigned long __uintptr_t;
-#else
-typedef int __intptr_t;
-typedef unsigned int __uintptr_t;
-#endif
-
-#if __LP64__
-typedef long __time_t;
-#else
-typedef int __time_t; /* Historical accident. */
-#endif
-
-typedef int __timer_t;
-
-typedef int __clockid_t;
-
-#ifndef __cplusplus
-typedef int __wchar_t;
-#endif
-
-typedef double __double_t;
-typedef float __float_t;
-
-typedef __builtin_va_list __va_list;
-
-typedef	unsigned long	__cpuid_t;	/* CPU id */
-typedef	__uint32_t	__fixpt_t;	/* fixed point number */
-typedef	__uint32_t	__gid_t;	/* group id */
-typedef	__uint32_t	__id_t;		/* may contain pid, uid or gid */
-typedef __uint32_t	__in_addr_t;	/* base type for internet address */
-typedef __uint16_t	__in_port_t;	/* IP port type */
-typedef	__uint32_t	__ino_t;	/* inode number */
-typedef	long		__key_t;	/* IPC key (for Sys V IPC) */
-typedef	__uint32_t	__mode_t;	/* permissions */
-typedef	__uint32_t	__nlink_t;	/* link count */
-typedef	__int32_t	__pid_t;	/* process id */
-typedef __uint64_t	__rlim_t;	/* resource limit */
-typedef __uint16_t	__sa_family_t;	/* sockaddr address family type */
-typedef	__int32_t	__segsz_t;	/* segment size */
-typedef __uint32_t	__socklen_t;	/* length type for network syscalls */
-typedef	__int32_t	__swblk_t;	/* swap offset */
-typedef	__uint32_t	__uid_t;	/* user id */
-typedef	__uint32_t	__useconds_t;	/* microseconds */
-typedef	__int32_t	__suseconds_t;	/* microseconds (signed) */
-
-/*
- * mbstate_t is an opaque object to keep conversion state, during multibyte
- * stream conversions. The content must not be referenced by user programs.
- */
-typedef union {
-	char __mbstate8[128];
-	__int64_t __mbstateL;			/* for alignment */
-} __mbstate_t;
-
-#endif /* !_SYS__TYPES_H_ */
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 32d98ea..5eb7e3d 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -43,8 +43,7 @@
 __BEGIN_DECLS
 
 #define sockaddr_storage __kernel_sockaddr_storage
-typedef __sa_family_t sa_family_t;
-typedef int socklen_t;
+typedef unsigned short sa_family_t;
 
 #ifdef __mips__
 #define SOCK_DGRAM      1
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index f8ae813..8780996 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -35,28 +35,48 @@
 #include <linux/types.h>
 #include <linux/posix_types.h>
 
-/* __kernel_gid_t and __kernel_uid_t are 16 bit for legacy reasons.
- * Android uses __kernel_uid32_t and __kernel_gid32_t instead.
- */
-typedef __kernel_gid32_t gid_t;
-typedef __kernel_uid32_t uid_t;
+/* gids, uids, and pids are all 32-bit. */
+typedef __kernel_gid32_t __gid_t;
+typedef __gid_t gid_t;
+typedef __kernel_uid32_t __uid_t;
+typedef __uid_t uid_t;
+typedef __kernel_pid_t __pid_t;
+typedef __pid_t pid_t;
+typedef __uint32_t __id_t;
+typedef __id_t id_t;
 
 typedef unsigned long blkcnt_t;
 typedef unsigned long blksize_t;
 typedef __kernel_caddr_t caddr_t;
 typedef __kernel_clock_t clock_t;
-typedef __kernel_clockid_t clockid_t;
+
+typedef __kernel_clockid_t __clockid_t;
+typedef __clockid_t clockid_t;
+
 typedef __kernel_daddr_t daddr_t;
 typedef unsigned long fsblkcnt_t;
 typedef unsigned long fsfilcnt_t;
-typedef __kernel_ino_t ino_t;
-typedef __kernel_key_t key_t;
-typedef __kernel_mode_t mode_t;
+
+typedef __kernel_mode_t __mode_t;
+typedef __mode_t mode_t;
+
+typedef __kernel_key_t __key_t;
+typedef __key_t key_t;
+
+typedef __uint32_t __ino_t;
+typedef __ino_t ino_t;
+
+typedef __uint32_t __nlink_t;
 typedef __nlink_t nlink_t;
-typedef __kernel_pid_t pid_t;
-typedef __kernel_suseconds_t suseconds_t;
-typedef __kernel_timer_t timer_t;
-typedef unsigned int useconds_t;
+
+typedef int __timer_t;
+typedef __timer_t timer_t;
+
+typedef __int32_t __suseconds_t;
+typedef __suseconds_t suseconds_t;
+
+typedef __uint32_t __useconds_t;
+typedef __useconds_t useconds_t;
 
 #if !defined(__LP64__)
 /* This historical accident means that we had a 32-bit dev_t on 32-bit architectures. */
@@ -66,7 +86,8 @@
 #endif
 
 /* This historical accident means that we had a 32-bit time_t on 32-bit architectures. */
-typedef __kernel_time_t time_t;
+typedef __kernel_time_t __time_t;
+typedef __time_t time_t;
 
 /* This historical accident means that we had a 32-bit off_t on 32-bit architectures. */
 #ifndef _OFF_T_DEFINED_
@@ -76,9 +97,6 @@
 typedef __kernel_loff_t loff_t;
 typedef loff_t off64_t;
 
-/* This one really is meant to be just 32 bits! */
-typedef uint32_t id_t;
-
 /* while POSIX wants these in <sys/types.h>, we
  * declare then in <pthread.h> instead */
 #if 0
@@ -93,6 +111,11 @@
 typedef  .... pthread_t;
 #endif
 
+typedef __uint32_t __socklen_t;
+typedef __socklen_t socklen_t;
+
+typedef __builtin_va_list __va_list;
+
 #ifndef _SSIZE_T_DEFINED_
 #define _SSIZE_T_DEFINED_
 /* Traditionally, bionic's ssize_t was "long int". This caused GCC to emit warnings when you
diff --git a/libc/include/sys/un.h b/libc/include/sys/un.h
index f89ead3..65ffbdcf 100644
--- a/libc/include/sys/un.h
+++ b/libc/include/sys/un.h
@@ -28,8 +28,7 @@
 #ifndef _SYS_UN_H_
 #define _SYS_UN_H_
 
-#include <sys/_types.h>
-typedef __sa_family_t sa_family_t;
+typedef unsigned short sa_family_t;
 
 #include <linux/un.h>