Reorganised C type definitions. Use now sys/type/..._t.h files for defining
[AROS.git] / compiler / clib / include / sys / types.h
blobd8a9b61d44fb173afc2ac1c4011e3c9fe222e16f
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 #include <sys/types/ssize_t.h>
65 #include <sys/types/clockid_t.h>
66 #include <sys/types/clock_t.h>
67 #include <sys/types/dev_t.h>
68 #include <sys/types/fs_t.h>
69 #include <sys/types/gid_t.h>
70 #include <sys/types/id_t.h>
71 #include <sys/types/ino_t.h>
72 #include <sys/types/key_t.h>
73 #include <sys/types/mode_t.h>
74 #include <sys/types/nlink_t.h>
75 #include <sys/types/off_t.h>
76 #include <sys/types/pid_t.h>
77 #include <sys/types/socklen_t.h>
78 #include <sys/types/suseconds_t.h>
79 #include <sys/types/time_t.h>
80 #include <sys/types/timer_t.h>
81 #include <sys/types/uid_t.h>
82 #include <sys/types/useconds_t.h>
84 /* These require this header to be included first */
85 typedef __blkcnt_t blkcnt_t; /* File block count */
86 typedef __blksize_t blksize_t; /* File block size */
88 typedef __caddr_t caddr_t; /* Core address */
89 typedef __int32_t daddr_t; /* Disk address */
90 typedef __uint32_t fixpt_t; /* Fixed point number */
91 typedef __int64_t rlim_t; /* Resource limit */
92 typedef __int64_t segsz_t; /* Segment size */
93 typedef __int32_t swblk_t; /* Swap offset */
95 /* These are not supported */
97 pthread_attr_t
98 pthread_cond_t
99 pthread_condattr_t
100 pthread_key_t
101 pthread_mutex_t
102 pthread_mutexattr_t
103 pthread_once_t
104 pthread_rwlock_t
105 pthread_rwlockattr_t
106 pthread_t
109 /*** Macros for endianness conversion ****************************************/
111 #define __htons(w) AROS_WORD2BE(w)
112 #define __htonl(l) AROS_LONG2BE(l)
113 #define __ntohs(w) AROS_BE2WORD(w)
114 #define __ntohl(l) AROS_BE2LONG(l)
116 /*** Defines and macros for select() *****************************************/
118 #define NBBY 8
120 #ifndef FD_SETSIZE
121 #define FD_SETSIZE 64
122 #endif
124 typedef __int32_t fd_mask;
125 #define NFDBITS (sizeof(fd_mask) * NBBY)
127 #ifndef howmany
128 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
129 #endif
131 typedef struct fd_set {
132 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
133 } fd_set;
135 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
136 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
137 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
138 #define FD_COPY(f, t) memcpy(t, f, sizeof(*(f)))
139 #define FD_ZERO(p) memset(p, 0, sizeof(*(p)))
141 #endif /* _SYS_TYPES_H_ */