1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the 13 * distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 #ifndef _SYS_TYPES_H_ 29 #define _SYS_TYPES_H_ 30 31 #define __need_size_t 32 #define __need_ptrdiff_t 33 #include <stddef.h> 34 #include <stdint.h> 35 #include <sys/cdefs.h> 36 37 #include <linux/posix_types.h> 38 #include <asm/types.h> 39 #include <linux/types.h> 40 #include <machine/kernel.h> 41 42 typedef __u32 __kernel_dev_t; 43 44 /* be careful with __kernel_gid_t and __kernel_uid_t 45 * these are defined as 16-bit for legacy reason, but 46 * the kernel uses 32-bits instead. 47 * 48 * 32-bit valuea are required for Android, so use 49 * __kernel_uid32_t and __kernel_gid32_t 50 */ 51 52 typedef __kernel_blkcnt_t blkcnt_t; 53 typedef __kernel_blksize_t blksize_t; 54 typedef __kernel_clock_t clock_t; 55 typedef __kernel_clockid_t clockid_t; 56 typedef __kernel_dev_t dev_t; 57 typedef __kernel_fsblkcnt_t fsblkcnt_t; 58 typedef __kernel_fsfilcnt_t fsfilcnt_t; 59 typedef __kernel_gid32_t gid_t; 60 typedef __kernel_id_t id_t; 61 typedef __kernel_ino_t ino_t; 62 typedef __kernel_key_t key_t; 63 typedef __kernel_mode_t mode_t; 64 typedef __kernel_nlink_t nlink_t; 65 #ifndef _OFF_T_DEFINED_ 66 #define _OFF_T_DEFINED_ 67 typedef __kernel_off_t off_t; 68 #endif 69 typedef __kernel_loff_t loff_t; 70 typedef loff_t off64_t; /* GLibc-specific */ 71 72 typedef __kernel_pid_t pid_t; 73 74 /* while POSIX wants these in <sys/types.h>, we 75 * declare then in <pthread.h> instead */ 76 #if 0 77 typedef .... pthread_attr_t; 78 typedef .... pthread_cond_t; 79 typedef .... pthread_condattr_t; 80 typedef .... pthread_key_t; 81 typedef .... pthread_mutex_t; 82 typedef .... pthread_once_t; 83 typedef .... pthread_rwlock_t; 84 typedef .... pthread_rwlock_attr_t; 85 typedef .... pthread_t; 86 #endif 87 88 #ifndef _SIZE_T_DEFINED_ 89 #define _SIZE_T_DEFINED_ 90 typedef unsigned int size_t; 91 #endif 92 93 /* size_t is defined by the GCC-specific <stddef.h> */ 94 #ifndef _SSIZE_T_DEFINED_ 95 #define _SSIZE_T_DEFINED_ 96 typedef long int ssize_t; 97 #endif 98 99 typedef __kernel_suseconds_t suseconds_t; 100 typedef __kernel_time_t time_t; 101 typedef __kernel_uid32_t uid_t; 102 typedef signed long useconds_t; 103 104 typedef __kernel_daddr_t daddr_t; 105 typedef __kernel_timer_t timer_t; 106 typedef __kernel_mqd_t mqd_t; 107 108 typedef __kernel_caddr_t caddr_t; 109 typedef unsigned int uint_t; 110 typedef unsigned int uint; 111 112 /* for some applications */ 113 #include <sys/sysmacros.h> 114 115 #ifdef __BSD_VISIBLE 116 typedef unsigned char u_char; 117 typedef unsigned short u_short; 118 typedef unsigned int u_int; 119 typedef unsigned long u_long; 120 121 typedef uint32_t u_int32_t; 122 typedef uint16_t u_int16_t; 123 typedef uint8_t u_int8_t; 124 typedef uint64_t u_int64_t; 125 #endif 126 127 #endif 128