Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / compiler / clib / include / sys / types.h
blobe69e622065a1ed2c546328e7a1a742fa48f96a2b
1 #ifndef _SYS_TYPES_H_
2 #define _SYS_TYPES_H_
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: ANSI-C header file sys/types.h
9 Lang: English
12 #include <sys/_types.h>
13 #include <sys/cdefs.h>
14 #include <aros/macros.h>
16 /* Technically namespace pollution, but what can you do... */
17 #include <stdint.h>
19 /*** For compatibility with POSIX source *************************************/
21 #if __BSD_VISIBLE
22 typedef unsigned char u_char;
23 typedef unsigned short u_short;
24 typedef unsigned int u_int;
25 typedef unsigned long u_long;
26 #endif
28 #ifdef __SYSV_VISIBLE
29 typedef unsigned short ushort; /* Sys V compatibility */
30 typedef unsigned int uint; /* Sys V compatibility */
31 #endif
33 /* These are additions to the types in <stdint.h> */
34 typedef __uint64_t u_int64_t; /* 64-bit unsigned integer */
35 typedef __uint32_t u_int32_t; /* 32-bit unsigned integer */
36 typedef __uint16_t u_int16_t; /* 16-bit unsigned integer */
37 typedef __uint8_t u_int8_t; /* 8-bit unsigned integer */
39 typedef __uint64_t u_quad_t;
40 typedef __int64_t quad_t;
41 typedef quad_t * qaddr_t;
45 Standard POSIX/SUS/ISO C types
47 Note that some of these are capable of being defined in multiple header
48 files, and need protection from this.
52 stddef.h is part of the freestanding implementation of the C language,
53 GCC provides one such header already, by including it we include the
54 definitions of wchar_t, wint_t, size_t, ptrdiff_t and NULL.
56 POSIX, however, needs us to define some other types, which we do later.
59 #define __need_size_t
60 #include <stddef.h>
62 /* Define the rest of the POSIX types */
64 #ifndef __AROS_SSIZE_T_DECLARED
65 #define __AROS_SSIZE_T_DECLARED
66 typedef __ssize_t ssize_t; /* Byte count or error */
67 #endif
69 #ifndef __AROS_CLOCKID_T_DECLARED
70 #define __AROS_CLOCKID_T_DECLARED
71 typedef __clockid_t clockid_t; /* ID for clock_ function */
72 #endif
74 #ifndef __AROS_CLOCK_T_DECLARED
75 #define __AROS_CLOCK_T_DECLARED
76 typedef __clock_t clock_t; /* Clock ticks */
77 #endif
79 #ifndef __AROS_DEV_T_DECLARED
80 #define __AROS_DEV_T_DECLARED
81 typedef __dev_t dev_t; /* Device IDs */
82 #endif
84 #ifndef __AROS_FSBLKCNT_DECLARED
85 #define __AROS_FSBLKCNT_DECLARED
86 typedef __fsblkcnt_t fsblkcnt_t; /* Count of blocks in FS */
87 typedef __fsfilcnt_t fsfilcnt_t; /* Count of files in FS */
88 #endif
90 #ifndef __AROS_GID_T_DECLARED
91 #define __AROS_GID_T_DECLARED
92 typedef __gid_t gid_t; /* Group IDs */
93 #endif
95 #ifndef __AROS_ID_T_DECLARED
96 #define __AROS_ID_T_DECLARED
97 typedef __id_t id_t; /* User/Group/Proc ID */
98 #endif
100 #ifndef __AROS_INO_T_DECLARED
101 #define __AROS_INO_T_DECLARED
102 typedef __ino_t ino_t; /* Inode number */
103 #endif
105 #ifndef __AROS_KEY_T_DECLARED
106 #define __AROS_KEY_T_DECLARED
107 typedef __key_t key_t; /* Interprocess comms */
108 #endif
110 #ifndef __AROS_MODE_T_DECLARED
111 #define __AROS_MODE_T_DECLARED
112 typedef __mode_t mode_t; /* File access mode */
113 #endif
115 #ifndef __AROS_NLINK_T_DECLARED
116 #define __AROS_NLINK_T_DECLARED
117 typedef __nlink_t nlink_t; /* Link count */
118 #endif
120 #ifndef __AROS_OFF_T_DECLARED
121 #define __AROS_OFF_T_DECLARED
122 typedef __off_t off_t; /* Offset (in files) */
123 #endif
125 #ifndef __AROS_PID_T_DECLARED
126 #define __AROS_PID_T_DECLARED
127 typedef __pid_t pid_t; /* Process ID */
128 #endif
130 #ifndef __AROS_SOCKLEN_T_DECLARED
131 #define __AROS_SOCKLEN_T_DECLARED
132 typedef __socklen_t socklen_t;
133 #endif
135 #ifndef __AROS_SUSECONDS_T_DECLARED
136 #define __AROS_SUSECONDS_T_DECLARED
137 typedef __suseconds_t suseconds_t;/* Signed no of usecs */
138 #endif
140 #ifndef __AROS_TIME_T_DECLARED
141 #define __AROS_TIME_T_DECLARED
142 typedef __time_t time_t; /* Number of seconds */
143 #endif
145 #ifndef __AROS_TIMER_T_DECLARED
146 #define __AROS_TIMER_T_DECLARED
147 typedef __timer_t timer_t; /* Timer timer_create() */
148 #endif
150 #ifndef __AROS_UID_T_DECLARED
151 #define __AROS_UID_T_DECLARED
152 typedef __uid_t uid_t; /* User ID */
153 #endif
155 #ifndef __AROS_USECONDS_T_DECLARED
156 #define __AROS_USECONDS_T_DECLARED
157 typedef __useconds_t useconds_t; /* Unsigned no usecs */
158 #endif
160 /* These require this header to be included first */
161 typedef __blkcnt_t blkcnt_t; /* File block count */
162 typedef __blksize_t blksize_t; /* File block size */
164 typedef __caddr_t caddr_t; /* Core address */
165 typedef __int32_t daddr_t; /* Disk address */
166 typedef __uint32_t fixpt_t; /* Fixed point number */
167 typedef __int64_t rlim_t; /* Resource limit */
168 typedef __int64_t segsz_t; /* Segment size */
169 typedef __int32_t swblk_t; /* Swap offset */
171 /* These are not supported */
173 pthread_attr_t
174 pthread_cond_t
175 pthread_condattr_t
176 pthread_key_t
177 pthread_mutex_t
178 pthread_mutexattr_t
179 pthread_once_t
180 pthread_rwlock_t
181 pthread_rwlockattr_t
182 pthread_t
185 /*** Macros for endianness conversion ****************************************/
187 #define __htons(w) AROS_WORD2BE(w)
188 #define __htonl(l) AROS_LONG2BE(l)
189 #define __ntohs(w) AROS_BE2WORD(w)
190 #define __ntohl(l) AROS_BE2LONG(l)
192 /*** Defines and macros for select() *****************************************/
194 #define NBBY 8
196 #ifndef FD_SETSIZE
197 #define FD_SETSIZE 64
198 #endif
200 typedef __int32_t fd_mask;
201 #define NFDBITS (sizeof(fd_mask) * NBBY)
203 #ifndef howmany
204 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
205 #endif
207 typedef struct fd_set {
208 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
209 } fd_set;
211 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
212 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
213 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
214 #define FD_COPY(f, t) memcpy(t, f, sizeof(*(f)))
215 #define FD_ZERO(p) memset(p, 0, sizeof(*(p)))
217 #endif /* _SYS_TYPES_H_ */