• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <stddef.h>
32 #include <stdint.h>
33 #include <sys/cdefs.h>
34 
35 #include <linux/posix_types.h>
36 #include <asm/types.h>
37 #include <linux/types.h>
38 #include <machine/kernel.h>
39 
40 typedef __u32    __kernel_dev_t;
41 
42 /* be careful with __kernel_gid_t and __kernel_uid_t
43  * these are defined as 16-bit for legacy reason, but
44  * the kernel uses 32-bits instead.
45  *
46  * 32-bit values are required for Android, so use
47  * __kernel_uid32_t and __kernel_gid32_t
48  */
49 
50 typedef __kernel_blkcnt_t    blkcnt_t;
51 typedef __kernel_blksize_t   blksize_t;
52 typedef __kernel_clock_t     clock_t;
53 typedef __kernel_clockid_t   clockid_t;
54 typedef __kernel_dev_t       dev_t;
55 typedef __kernel_fsblkcnt_t  fsblkcnt_t;
56 typedef __kernel_fsfilcnt_t  fsfilcnt_t;
57 typedef __kernel_gid32_t     gid_t;
58 typedef __kernel_id_t        id_t;
59 typedef __kernel_ino_t       ino_t;
60 typedef __kernel_key_t       key_t;
61 typedef __kernel_mode_t      mode_t;
62 typedef __kernel_nlink_t	 nlink_t;
63 #ifndef _OFF_T_DEFINED_
64 #define _OFF_T_DEFINED_
65 typedef __kernel_off_t       off_t;
66 #endif
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 _SSIZE_T_DEFINED_
87 #define _SSIZE_T_DEFINED_
88 /* Traditionally, bionic's ssize_t was "long int". This caused GCC to emit warnings when you
89  * pass a ssize_t to a printf-style function. The correct type is __kernel_ssize_t, which is
90  * "int", which isn't an ABI change for C code (because they're the same size) but is an ABI
91  * change for C++ because "int" and "long int" mangle to "i" and "l" respectively. So until
92  * we can fix the ABI, this change should not be propagated to the NDK. http://b/8253769. */
93 typedef __kernel_ssize_t ssize_t;
94 #endif
95 
96 typedef __kernel_suseconds_t  suseconds_t;
97 typedef __kernel_time_t       time_t;
98 typedef __kernel_uid32_t        uid_t;
99 typedef signed long           useconds_t;
100 
101 typedef __kernel_daddr_t	daddr_t;
102 typedef __kernel_timer_t	timer_t;
103 typedef __kernel_mqd_t		mqd_t;
104 
105 typedef __kernel_caddr_t    caddr_t;
106 typedef unsigned int        uint_t;
107 typedef unsigned int        uint;
108 
109 /* for some applications */
110 #include <sys/sysmacros.h>
111 
112 #ifdef __BSD_VISIBLE
113 typedef	unsigned char	u_char;
114 typedef	unsigned short	u_short;
115 typedef	unsigned int	u_int;
116 typedef	unsigned long	u_long;
117 
118 typedef uint32_t       u_int32_t;
119 typedef uint16_t       u_int16_t;
120 typedef uint8_t        u_int8_t;
121 typedef uint64_t       u_int64_t;
122 #endif
123 
124 #endif
125