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 42typedef __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 52typedef __kernel_blkcnt_t blkcnt_t; 53typedef __kernel_blksize_t blksize_t; 54typedef __kernel_clock_t clock_t; 55typedef __kernel_clockid_t clockid_t; 56typedef __kernel_dev_t dev_t; 57typedef __kernel_fsblkcnt_t fsblkcnt_t; 58typedef __kernel_fsfilcnt_t fsfilcnt_t; 59typedef __kernel_gid32_t gid_t; 60typedef __kernel_id_t id_t; 61typedef __kernel_ino_t ino_t; 62typedef __kernel_key_t key_t; 63typedef __kernel_mode_t mode_t; 64typedef __kernel_nlink_t nlink_t; 65#ifndef _OFF_T_DEFINED_ 66#define _OFF_T_DEFINED_ 67typedef __kernel_off_t off_t; 68#endif 69typedef __kernel_loff_t loff_t; 70typedef loff_t off64_t; /* GLibc-specific */ 71 72typedef __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 77typedef .... pthread_attr_t; 78typedef .... pthread_cond_t; 79typedef .... pthread_condattr_t; 80typedef .... pthread_key_t; 81typedef .... pthread_mutex_t; 82typedef .... pthread_once_t; 83typedef .... pthread_rwlock_t; 84typedef .... pthread_rwlock_attr_t; 85typedef .... pthread_t; 86#endif 87 88#ifndef _SSIZE_T_DEFINED_ 89#define _SSIZE_T_DEFINED_ 90typedef long int ssize_t; 91#endif 92 93typedef __kernel_suseconds_t suseconds_t; 94typedef __kernel_time_t time_t; 95typedef __kernel_uid32_t uid_t; 96typedef signed long useconds_t; 97 98typedef __kernel_daddr_t daddr_t; 99typedef __kernel_timer_t timer_t; 100typedef __kernel_mqd_t mqd_t; 101 102typedef __kernel_caddr_t caddr_t; 103typedef unsigned int uint_t; 104typedef unsigned int uint; 105 106/* for some applications */ 107#include <sys/sysmacros.h> 108 109#ifdef __BSD_VISIBLE 110typedef unsigned char u_char; 111typedef unsigned short u_short; 112typedef unsigned int u_int; 113typedef unsigned long u_long; 114 115typedef uint32_t u_int32_t; 116typedef uint16_t u_int16_t; 117typedef uint8_t u_int8_t; 118typedef uint64_t u_int64_t; 119#endif 120 121#endif 122