2 * Common configuration for platforms using the Linux Kernel, specifically
3 * ACE_LINUX and ACE_ANDROID as of writing. config-android.h was originally
4 * based off config-linux.h and this file was created from the common parts of
7 #ifndef ACE_CONFIG_LINUX_COMMON_H
8 #define ACE_CONFIG_LINUX_COMMON_H
10 #if !defined (ACE_MT_SAFE)
11 # define ACE_MT_SAFE 1
14 // Compiler supports the ssize_t typedef.
15 #define ACE_HAS_SSIZE_T
17 // Needed to differentiate between libc 5 and libc 6 (aka glibc).
20 #include "ace/config-posix.h"
22 #ifndef ACE_DEFAULT_BASE_ADDR
23 # if defined (__powerpc__) || defined (__x86_64__)
24 # define ACE_DEFAULT_BASE_ADDR (reinterpret_cast< char* >(0x40000000))
25 # elif defined (__ia64)
26 // Zero base address should work fine for Linux of IA-64: it just lets
27 // the kernel to choose the right value.
28 # define ACE_DEFAULT_BASE_ADDR (reinterpret_cast< char*>(0x0000000000000000))
30 # define ACE_DEFAULT_BASE_ADDR (reinterpret_cast< char* >(0x80000000))
32 #endif /* ! ACE_DEFAULT_BASE_ADDR */
34 #define ACE_HAS_LSEEK64
36 #define ACE_HAS_P_READ_WRITE
37 // Use ACE's alternate cuserid() implementation since the use of the
38 // system cuserid() is discouraged.
39 #define ACE_HAS_ALT_CUSERID
41 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
42 # define ACE_HAS_ISASTREAM_PROTOTYPE
43 # define ACE_HAS_CPU_SET_T
44 # define ACE_HAS_GLIBC_2_2_3
45 #endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */
47 # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)
48 # define ACE_HAS_PTHREAD_SETNAME_NP
49 #endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 12) */
51 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 30)
52 # define ACE_LACKS_SYS_SYSCTL_H
53 #endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 30) */
55 #if defined (__INTEL_COMPILER)
56 # include "ace/config-icc-common.h"
57 #elif defined (__GNUG__)
58 # include "ace/config-g++-common.h"
60 // Portable group compiler
61 # define ACE_LACKS_SWAB
62 #elif defined (__GNUC__)
66 * We need to recognize the GNU C compiler since TAO has at least one
67 * C source header and file
68 * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly
71 #else /* ! __GNUG__ && !__INTEL_COMPILER && && !__PGI */
72 # ifdef __cplusplus /* Let it slide for C compilers. */
73 # error unsupported compiler in ace/config-linux.h
74 # endif /* __cplusplus */
75 #endif /* ! __GNUG__*/
77 // Platform/compiler has the sigwait(2) prototype
78 #define ACE_HAS_SIGWAIT
80 #define ACE_HAS_SIGSUSPEND
82 #define ACE_HAS_STRSIGNAL
84 #ifndef ACE_HAS_POSIX_REALTIME_SIGNALS
85 # define ACE_HAS_POSIX_REALTIME_SIGNALS
86 #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
88 #define ACE_HAS_XPG4_MULTIBYTE_CHAR
89 #define ACE_HAS_VFWPRINTF
91 #define ACE_LACKS_ITOW
92 #define ACE_LACKS_WCSICMP
93 #define ACE_LACKS_WCSNICMP
94 #define ACE_LACKS_ISWASCII
96 #define ACE_HAS_3_PARAM_WCSTOK
98 #define ACE_HAS_ALLOCA
100 // Compiler/platform has <alloca.h>
101 #define ACE_HAS_ALLOCA_H
102 #define ACE_HAS_SYS_SYSINFO_H
103 #define ACE_HAS_LINUX_SYSINFO
105 // Compiler/platform has the getrusage() system call.
106 #define ACE_HAS_GETRUSAGE
107 #define ACE_HAS_GETRUSAGE_PROTOTYPE
109 #define ACE_HAS_BYTESWAP_H
110 #define ACE_HAS_BSWAP_16
111 #define ACE_HAS_BSWAP_32
113 #if defined (__GNUC__)
114 # define ACE_HAS_BSWAP_64
117 #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
119 // Optimize ACE_Handle_Set for select().
120 #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
122 // ONLY define this if you have config'd multicast into a 2.0.34 or
123 // prior kernel. It is enabled by default in 2.0.35 kernels.
124 #if !defined (ACE_HAS_IP_MULTICAST)
125 # define ACE_HAS_IP_MULTICAST
126 #endif /* ! ACE_HAS_IP_MULTICAST */
128 // At least for IPv4, Linux lacks perfect filtering.
129 #if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING
130 # define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1
131 #endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */
133 #define ACE_HAS_BIG_FD_SET
135 // Linux defines struct msghdr in /usr/include/socket.h
138 // Linux "improved" the interface to select() so that it modifies
139 // the struct timeval to reflect the amount of time not slept
140 // (see NOTES in Linux's select(2) man page).
141 #define ACE_HAS_NONCONST_SELECT_TIMEVAL
143 #define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535
145 #define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1
147 #define ACE_HAS_GETPAGESIZE 1
149 // Platform defines struct timespec but not timespec_t
150 #define ACE_LACKS_TIMESPEC_T
152 // Platform supplies scandir()
153 #define ACE_HAS_SCANDIR
155 // Compiler/platform contains the <sys/syscall.h> file.
156 #define ACE_HAS_SYS_SYSCALL_H
158 #define ACE_HAS_TIMEZONE
159 #define ACE_HAS_TIMEZONE_GETTIMEOFDAY
161 // Compiler/platform defines the sig_atomic_t typedef.
162 #define ACE_HAS_SIG_ATOMIC_T
164 #define ACE_HAS_POSIX_TIME
166 #define ACE_HAS_GPERF
168 #define ACE_HAS_DIRENT
170 // Starting with FC9 rawhide this file is not available anymore but
171 // this define is set
172 #if !defined(_XOPEN_STREAMS) || (defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1)
173 # define ACE_LACKS_STROPTS_H
174 # define ACE_LACKS_STRRECVFD
177 #if !defined (ACE_LACKS_STROPTS_H)
178 # define ACE_HAS_STRBUF_T
181 #if defined (__ia64) || defined (__x86_64__) || defined(__powerpc64__) || (defined(__mips__) && defined(__LP64__)) || defined (__aarch64__)
182 // On 64 bit platforms, the "long" type is 64-bits. Override the
183 // default 32-bit platform-specific format specifiers appropriately.
184 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu"
185 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld"
186 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu"
189 #define ACE_SIZEOF_WCHAR 4
191 // Platform has POSIX terminal interface.
192 #define ACE_HAS_TERMIOS
194 // Linux implements sendfile().
195 #define ACE_HAS_SENDFILE 1
197 #define ACE_HAS_VOIDPTR_MMAP
199 #define ACE_HAS_VASPRINTF
201 #define ACE_LACKS_PTHREAD_SCOPE_PROCESS
203 // According to man pages Linux uses different (compared to UNIX systems) types
204 // for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP
205 // in setsockopt/getsockopt.
206 // In the current (circa 2012) kernel source however there is an explicit check
207 // for IPV6_MULTICAST_LOOP being sizeof(int). Anything else is rejected so it must
208 // not be a passed a bool, irrespective of what the man pages (still) say.
209 // i.e. #define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 is wrong
210 #define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1
211 #define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1
213 #define ACE_HAS_SVR4_DYNAMIC_LINKING
214 #define ACE_HAS_AUTOMATIC_INIT_FINI
215 #define ACE_HAS_RECURSIVE_MUTEXES
216 #define ACE_HAS_THREAD_SPECIFIC_STORAGE
217 #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
218 #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
219 #define ACE_HAS_REENTRANT_FUNCTIONS
221 /* ===========================================================================
222 * By Kernel API Version
223 * ===========================================================================
226 #if !defined (ACE_LACKS_LINUX_VERSION_H)
227 # include <linux/version.h>
228 #endif /* !ACE_LACKS_LINUX_VERSION_H */
230 #if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO)
231 // Detect if getsockname() and getpeername() returns random values in
232 // the sockaddr_in::sin_zero field by evaluation of the kernel
233 // version. Since version 2.5.47 this problem is fixed.
234 # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47))
235 # define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0
237 # define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1
238 # endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */
239 #endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
241 #if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL)
242 # if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0))
243 # define ACE_HAS_EVENT_POLL
247 #if (LINUX_VERSION_CODE >= KERNEL_VERSION (2,4,11))
248 # define ACE_HAS_GETTID // See ACE_OS::thr_gettid()
251 #endif /* ACE_CONFIG_LINUX_COMMON_H */