Home | History | Annotate | Download | only in sys
      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 #define _OFF_T_DEFINED_
     66 typedef __kernel_off_t       off_t;
     67 typedef __kernel_loff_t      loff_t;
     68 typedef loff_t               off64_t;  /* GLibc-specific */
     69 
     70 typedef __kernel_pid_t		 pid_t;
     71 
     72 /* while POSIX wants these in <sys/types.h>, we
     73  * declare then in <pthread.h> instead */
     74 #if 0
     75 typedef  .... pthread_attr_t;
     76 typedef  .... pthread_cond_t;
     77 typedef  .... pthread_condattr_t;
     78 typedef  .... pthread_key_t;
     79 typedef  .... pthread_mutex_t;
     80 typedef  .... pthread_once_t;
     81 typedef  .... pthread_rwlock_t;
     82 typedef  .... pthread_rwlock_attr_t;
     83 typedef  .... pthread_t;
     84 #endif
     85 
     86 #ifndef _SIZE_T_DEFINED_
     87 #define _SIZE_T_DEFINED_
     88 typedef unsigned int  size_t;
     89 #endif
     90 
     91 /* size_t is defined by the GCC-specific <stddef.h> */
     92 #ifndef _SSIZE_T_DEFINED_
     93 #define _SSIZE_T_DEFINED_
     94 typedef long int  ssize_t;
     95 #endif
     96 
     97 typedef __kernel_suseconds_t  suseconds_t;
     98 typedef __kernel_time_t       time_t;
     99 typedef __kernel_uid32_t        uid_t;
    100 typedef signed long           useconds_t;
    101 
    102 typedef __kernel_daddr_t	daddr_t;
    103 typedef __kernel_timer_t	timer_t;
    104 typedef __kernel_mqd_t		mqd_t;
    105 
    106 typedef __kernel_caddr_t    caddr_t;
    107 typedef unsigned int        uint_t;
    108 typedef unsigned int        uint;
    109 
    110 /* for some applications */
    111 #include <sys/sysmacros.h>
    112 
    113 #ifdef __BSD_VISIBLE
    114 typedef	unsigned char	u_char;
    115 typedef	unsigned short	u_short;
    116 typedef	unsigned int	u_int;
    117 typedef	unsigned long	u_long;
    118 
    119 typedef uint32_t       u_int32_t;
    120 typedef uint16_t       u_int16_t;
    121 typedef uint8_t        u_int8_t;
    122 typedef uint64_t       u_int64_t;
    123 #endif
    124 
    125 #endif
    126