7 #define __EXPORT_TEMPLATE(x)
11 #define COMMON_64_CLEAN
12 #define COMMON_ASYNC_OVERRIDE
13 #define COMMON_OST_NAMESPACE
14 #define COMMON_THREAD_SLEEP
15 #define COMMON_NET_DEVICES
16 #define COMMON_THREAD_DEBUG
17 #define COMMON_DEADLOCK_DEBUG
18 #define COMMON_NAMED_MUTEX
19 #define COMMON_PROCESS_ATTACH
20 #define COMMON_XML_PARSING
21 #define COMMON_TIMER_SLEEP
23 #if __GNUC__ > 1 && !defined(__STRICT_ANSI__) && !defined(__PEDANTIC__)
24 #define DYNAMIC_LOCAL_ARRAYS
27 #if defined(__CYGWIN__)
28 #define _POSIX_REALTIME_SIGNALS
29 #define _POSIX_THREADS
32 #if defined(__APPLE__) && defined(__MACH__)
35 #define _P1003_1B_VISIBLE
42 #if defined(__FreeBSD__)
44 #define __BSD_VISIBLE 1
55 #ifndef _XOPEN_SOURCE_EXTENDED
56 #define _XOPEN_SOURCE_EXTENDED
58 #ifndef _INCLUDE_LONGLONG
59 #define _INCLUDE_LONGLONG
66 #elif !defined(__hpux) && !defined(_AIX)
70 #if defined(__sun) || defined(__SUN__)
71 #define __EXTENSIONS__ 1
79 #define _THREAD_SAFE 1
86 #if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) &&!defined(__OpenBSD__) && !defined(__MACH__) && !defined(__NetBSD__)
87 #define _XOPEN_SOURCE 600
95 #define HAVE_UNISTD_H 1
96 #define HAVE_FEATURES_H 1
97 #define HAVE_SYS_TYPES_H 1
104 #ifdef HAVE_FEATURES_H
105 #include <features.h>
109 #ifdef HAVE_SYS_TYPES_H
110 #include <sys/types.h>
115 #define HAVE_SYS_TIME_H 1
116 #define TIME_WITH_SYS_TIME 1
117 #if TIME_WITH_SYS_TIME
118 #include <sys/time.h>
121 #include <sys/time.h>
128 #define HAVE_SYS_TYPES_STD 1
129 #define HAVE_SYS_TYPES_64 1
130 #define HAVE_LONG_LONG 1
133 #ifdef HAVE_SYS_TYPES_H
134 #include <sys/types.h>
137 #ifdef HAVE_BITS_WORSIZE_H
138 #include <bits/wordtypes.h>
141 #ifdef HAVE_SYS_TYPES_STD
148 #ifdef HAVE_SYS_TYPES_64
155 typedef unsigned char uint8;
157 typedef unsigned short uint16;
159 typedef unsigned int uint32;
162 #ifndef HAVE_SYS_TYPES_64
163 #if defined(__WORDSIZE) || defined(__arch64__)
164 #if __WORDSIZE >= 64 || defined(__arch64__)
165 typedef long int int64;
166 typedef unsigned long int uint64;
167 #define HAVE_SYS_TYPES_64 1
173 #ifndef HAVE_SYS_TYPES_64
175 #if defined(HAVE_LONG_LONG) || defined(_LONGLONG)
177 typedef long long int int64;
179 typedef unsigned long long int uint64;
180 #define HAVE_SYS_TYPES_64 1
186 #ifndef HAVE_SYS_TYPES_64
187 #if defined(HAVE_LONG_LONG) || defined(_LONGLONG)
189 typedef long long int64;
190 typedef unsigned long long uint64;
196 #define CCXX_EXCEPTIONS 1
202 #define CCXX_HAVE_NEW_INIT 1
205 #define CCXX_NAMESPACES 1
229 #define ETC_PREFIX "/etc/"
232 #define HAVE_ALLOCA_H 1
235 #define HAVE_ARPA_INET_H 1
244 #define HAVE_BITS_WORDSIZE_H 1
247 #define HAVE_BOOL_TYPE 1
256 #define HAVE_DLFCN_H 1
259 #define HAVE_ENDIAN_H 1
262 #define HAVE_ERRNO_H 1
265 #define HAVE_EXCEPTION 1
268 #define HAVE_EXTRAS 1
271 #define HAVE_FCNTL_H 1
274 #define HAVE_FEATURES_H 1
283 #define HAVE_GETADDRINFO 1
286 #define HAVE_GETGRNAM_R 1
289 #define HAVE_GETHOSTBYNAME2 1
292 #define HAVE_GETOPT 1
295 #define HAVE_GETOPT_H 1
298 #define HAVE_GETOPT_LONG 1
301 #define HAVE_GETPAGESIZE 1
304 #define HAVE_GETPWNAM_R 1
307 #define HAVE_GETPWUID_R 1
310 #define HAVE_GETTIMEOFDAY 1
313 #define HAVE_HIRES_TIMER 1
316 #define HAVE_INET_ATON 1
319 #define HAVE_INET_PTON 1
322 #define HAVE_INET_SOCKETS 1
325 #define HAVE_INTTYPES_H 1
346 #define HAVE_LIMITS_H 1
349 #define HAVE_LINUX_IN6_H 1
352 #define HAVE_LINUX_NETFILTER_IPV4_H 1
355 #define HAVE_LINUX_NETFILTER_IPV6_H 1
358 #define HAVE_LOCALTIME_R 1
364 #define HAVE_LONG_LONG 1
376 #define HAVE_MEMMOVE 1
379 #define HAVE_MEMORY_H 1
385 #define HAVE_MLOCKALL 1
388 #define HAVE_MODULES 1
394 #define HAVE_NAT_NETFILTER 1
406 #define HAVE_NETINET_IN_H 1
409 #define HAVE_NETINET_IN_SYSTM_H 1
421 #define HAVE_NETINET_IP_H 1
427 #define HAVE_NET_IF_H 1
439 #define HAVE_POLL_H 1
442 #define HAVE_POSIX_MEMALIGN 1
445 #define HAVE_PREAD_PWRITE 1
448 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
451 #define HAVE_PTHREAD_CANCEL 1
457 #define HAVE_PTHREAD_H 1
466 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
472 #define HAVE_PTHREAD_NANOSLEEP 1
478 #define HAVE_PTHREAD_RWLOCK 1
487 #define HAVE_PTHREAD_SETCANCELTYPE 1
493 #define HAVE_PTHREAD_YIELD 1
499 #define HAVE_READDIR_R 1
502 #define HAVE_REALPATH 1
505 #define HAVE_SCHED_GETSCHEDULER 1
508 #define HAVE_SCHED_H 1
514 #define HAVE_SEMAPHORE_H 1
517 #define HAVE_SETEGID 1
520 #define HAVE_SETENV 1
523 #define HAVE_SETITIMER 1
526 #define HAVE_SETPGRP 1
532 #define HAVE_SIGACTION 1
535 #define HAVE_SIGWAIT 1
538 #define HAVE_SIGWAIT2 1
541 #define HAVE_SNPRINTF 1
544 #define HAVE_SOCKLEN_T 1
547 #define HAVE_SSTREAM 1
553 #define HAVE_STDINT_H 1
556 #define HAVE_STDLIB_H 1
559 #define HAVE_STRCASECMP 1
562 #define HAVE_STRDUP 1
565 #define HAVE_STRERROR_R 1
568 #define HAVE_STRINGS_H 1
571 #define HAVE_STRING_H 1
574 #define HAVE_STRTOK_R 1
577 #define HAVE_SYSLOG_H 1
589 #define HAVE_SYS_FCNTL_H 1
592 #define HAVE_SYS_FILE_H 1
595 #define HAVE_SYS_IOCTL_H 1
604 #define HAVE_SYS_PARAM_H 1
607 #define HAVE_SYS_POLL_H 1
613 #define HAVE_SYS_SELECT_H 1
616 #define HAVE_SYS_SOCKET_H 1
622 #define HAVE_SYS_STAT_H 1
628 #define HAVE_SYS_TIME_H 1
631 #define HAVE_SYS_TYPES_64 1
634 #define HAVE_SYS_TYPES_H 1
637 #define HAVE_SYS_TYPES_STD 1
640 #define HAVE_SYS_UN_H 1
643 #define HAVE_SYS_WAIT_H 1
649 #define HAVE_UNISTD_H 1
652 #define HAVE_UNIX_SOCKETS 1
658 #define HAVE_WAITPID 1
670 #define HAVE_ZLIB_H 1
673 #define LT_OBJDIR ".libs/"
676 #define CCXX_PACKAGE "commoncpp2"
679 #define CCXX_PACKAGE_BUGREPORT ""
682 #define CCXX_PACKAGE_NAME ""
685 #define CCXX_PACKAGE_STRING ""
688 #define CCXX_PACKAGE_TARNAME ""
691 #define CCXX_PACKAGE_URL ""
694 #define CCXX_PACKAGE_CCXX_VERSION ""
697 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
700 #define RETSIGTYPE void
703 #define STDC_HEADERS 1
706 #define TIME_WITH_SYS_TIME 1
709 #define USE_MONOTONIC_TIMER 1
713 # define _ALL_SOURCE 1
717 # define _GNU_SOURCE 1
720 #ifndef _POSIX_PTHREAD_SEMANTICS
721 # define _POSIX_PTHREAD_SEMANTICS 1
724 #ifndef _TANDEM_SOURCE
725 # define _TANDEM_SOURCE 1
728 #ifndef __EXTENSIONS__
729 # define __EXTENSIONS__ 1
734 #define CCXX_VERSION "1.8.1"
764 #define restrict __restrict
770 #if defined __SUNPRO_CC && !defined __RESTRICT
772 # define __restrict__
781 #ifndef HAVE_STRERROR_R
782 #define strerror_r(e, b, l) b = ::strerror(e)
785 #ifndef HAVE_GETPWUID_R
786 #define getpwuid_r(uid, rec, buf, size, ptr) ptr = ::getpwuid(uid)
787 #define getpwnam_r(name, rec, buf, size, ptr) ptr = ::getpwnam(name)
796 #ifdef HAVE_SYS_POLL_H
797 #include <sys/poll.h>
801 #if defined(HAVE_POLL) && defined(POLLRDNORM)
809 #ifdef HAVE_SYS_LIBCSYS_H
810 #include <sys/libcsys.h>
813 #ifdef HAVE_WINSOCK2_H
814 #include <winsock2.h>
816 #ifdef HAVE_WINSOCK_H
819 #ifdef HAVE_SYS_SOCKET_H
820 #include <sys/socket.h>
824 #ifdef HAVE_SYS_SELECT_H
825 #include <sys/select.h>
829 #ifdef HAVE_NETINET_IN_H
830 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
833 #include <netinet/in.h>
835 #define _XOPEN_SOURCE_EXTENDED
838 #ifdef HAVE_ARPA_INET_H
839 #include <arpa/inet.h>
843 #ifdef HAVE_NETINET6_IN6_H
844 #include <netinet6/in6.h>
847 #ifdef HAVE_LINIX_IN6_H
848 #include <linux/in6.h>
851 #ifdef HAVE_NETINET_IN_SYSTM_H
852 #include <netinet/in_systm.h>
854 #ifdef HAVE_NETINET_IP_H
855 #include <netinet/ip.h>
864 #ifndef HAVE_INET_ATON
865 #define inet_aton(cp, addr) (((*(unsigned long int *)(addr)) = inet_addr(cp)) != -1)
876 #define SUN_LEN(ptr) sizeof(sockaddr_un.sun_len) + sizeof(sockaddr_un.sun_family) + sizeof(sockaddr_un.sun_path) + 1
878 #define SUN_LEN(ptr) ((size_t)((struct sockaddr_un *)0)->sun_path) + strlen((ptr)->sun_path))
883 #ifndef HAVE_SOCKLEN_T
884 #if defined(i386) && defined(__svr4__)
885 #define HAVE_SOCKLEN_U
887 #if defined(__CYGWIN32__)
888 #define socklen_t int
890 typedef int socklen_t;
894 #ifdef HAVE_SOCKLEN_U
895 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
896 typedef unsigned socklen_t;
898 typedef int socklen_t;
910 #if defined(AF_INET6) && defined(HAVE_INET_PTON)
914 #define CCXX_MULTIFAMILY_IP
919 #ifndef HAVE_BOOL_TYPE
920 typedef enum {
true=1,
false=0 } bool;
927 #ifndef CCXX_EXCEPTIONS
929 #ifdef HAVE_EXCEPTION
930 #define HAVE_EXCEPTION 1
933 #define THROW(x) abort()
943 #define THROW(x) throw x
944 #define THROWS(x) throw(x)
945 #define NEW_THROWS throw()
946 #define THROWS_EMPTY throw()
952 #ifdef CCXX_NAMESPACES
953 #define USING(x) using namespace x;
959 #define KAI_NONSTD_IOSTREAM 1
967 #define COMMON_SECURE
970 #define COMMON_NAMESPACE ost
971 #define NAMESPACE_COMMON namespace ost {
972 #define END_NAMESPACE }
974 #ifdef HAVE_VISIBILITY
975 #define __EXPORT __attribute__ ((visibility("default")))
976 #define __DLLRTL __attribute__ ((visibility("default")))
977 #define __LOCAL __attribute__ ((visibility("hidden")))
986 #define ETC_PREFIX "/etc/"
990 #define ETC_PREFIX "/etc/"
1000 #ifndef HAVE_FCNTL_H
1001 #ifdef HAVE_SYS_FCNTL_H
1002 #include <sys/fcntl.h>
1007 #ifdef HAVE_SYS_FCNTL_H
1008 #include <sys/fcntl.h>
1015 #if defined(HAVE_ENDIAN_H)
1017 #elif defined(HAVE_SYS_ISA_DEFS_H)
1018 #include <sys/isa_defs.h>
1019 #ifdef _LITTLE_ENDIAN
1020 #define __BYTE_ORDER 1234
1022 #define __BYTE_ORDER 4321
1024 #if _ALIGNMENT_REQUIRED > 0
1025 #define __BYTE_ALIGNMENT _MAX_ALIGNMENT
1027 #define __BYTE_ALIGNMENT 1
1031 #ifndef __LITTLE_ENDIAN
1032 #define __LITTLE_ENDIAN 1234
1033 #define __BIG_ENDIAN 4321
1036 #ifndef __BYTE_ORDER
1037 #define __BYTE_ORDER 1234
1040 #ifndef __BYTE_ALIGNMENT
1041 #if defined(SPARC) || defined(sparc)
1042 #if defined(__arch64__) || defined(__sparcv9)
1043 #define __BYTE_ALIGNMENT 8
1045 #define __BYTE_ALIGNMENT 4
1050 #ifndef __BYTE_ALIGNMENT
1051 #define __BYTE_ALIGNMENT 1
1057 #ifdef HAVE_SIGACTION
1058 #ifdef HAVE_BSD_SIGNAL_H
1067 #ifdef HAVE_SIGWAIT2
1068 #ifndef _POSIX_PTHREAD_SEMANTICS
1069 #define _POSIX_PTHREAD_SEMANTICS 1
1073 #ifdef HAVE_BSD_SIGNAL_H
1074 #include <bsd/signal.h>
1079 #define SA_ONESHOT SA_RESETHAND
1086 #ifdef HAVE_STRINGS_H
1088 #include <strings.h>
1092 #ifdef HAVE_ALLOCA_H
1096 #ifndef HAVE_SNPRINTF
1097 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1400
1098 #define snprintf _snprintf
1099 #define vsnprintf _vsnprintf
1103 #ifdef HAVE_STRCASECMP
1105 #define stricmp(x,y) strcasecmp(x,y)
1108 #define strnicmp(x,y,n) strncasecmp(x,y,n)
1111 #define stristr(x, y) strcasestr(x,y)
1118 #ifdef HAVE_THREAD_H
1119 #include "/usr/include/thread.h"
1120 #if defined(i386) && defined(__svr4__) && !defined(__sun)
1121 #define _THR_UNIXWARE
1123 #if defined(__SVR4) && defined(__sun)
1126 #if defined(__SVR4__) && defined(__SUN__)
1132 #ifdef HAVE_WORKING_SYS_ATOMIC_H
1133 #include <sys/atomic.h>
1135 #elif defined(HAVE_ATOMIC_AIX)
1136 #include <sys/atomic_op.h>
1142 #if defined(__cplusplus)
1143 #if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
1144 #include <bits/atomicity.h>
1149 #if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
1155 #include <pthread.h>
1157 #ifdef HAVE_PTHREAD_NP_H
1158 #include <pthread_np.h>
1161 #ifdef HAVE_SEMAPHORE_H
1162 #include <semaphore.h>
1164 #ifdef _POSIX_PRIORITY_SCHEDULING
1168 #ifdef HAVE_SYS_SCHED_H
1169 #include <sys/sched.h>
1174 #define __PTHREAD_H__
1175 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1176 #ifdef MUTEX_TYPE_COUNTING_FAST
1177 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1180 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1181 #ifdef PTHREAD_MUTEX_RECURSIVE
1182 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1185 #ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
1186 #if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
1187 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1188 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1190 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
1191 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
1193 #if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
1194 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1195 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1197 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
1198 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
1202 #ifdef HAVE_PTHREAD_MACH_THREAD_NP
1206 #ifndef HAVE_PTHREAD_YIELD
1207 #ifdef HAVE_PTHREAD_YIELD_NP
1208 #define pthread_yield() pthread_yield_np()
1209 #define HAVE_PTHREAD_YIELD 1
1213 #ifndef HAVE_PTHREAD_YIELD
1214 #ifdef HAVE_PTHREAD_SCHED_YIELD
1215 #define pthread_yield() sched_yield()
1216 #define HAVE_PTHREAD_YIELD 1
1220 #ifndef HAVE_PTHREAD_DELAY
1221 #ifdef HAVE_PTHREAD_DELAY_NP
1222 #define HAVE_PTHREAD_DELAY
1223 #define pthread_delay(x) pthread_delay_np(x)
1225 #if defined(HAVE_PTHREAD_NANOSLEEP)
1226 #ifndef HAVE_PTHREAD_DELAY
1227 #define HAVE_PTHREAD_DELAY
1230 extern "C" int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp);
1233 #define pthread_delay(x) nanosleep(x, NULL)
1238 #ifdef HAVE_PTHREAD_ATTR_SETSTACK
1239 #ifndef PTHREAD_STACK_MIN
1240 #define PTHREAD_STACK_MIN 32768
1244 #ifndef HAVE_PTHREAD_CANCEL
1246 #define CCXX_SIG_THREAD_CANCEL SIGCANCEL
1248 #define CCXX_SIG_THREAD_CANCEL SIGQUIT
1250 #define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
1251 #define pthread_setcanceltype(x, y)
1252 #define pthread_setcancelstate(x, y)
1255 #ifndef HAVE_PTHREAD_SETCANCELTYPE
1256 #ifdef HAVE_PTHREAD_SETCANCEL
1258 { PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
1259 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
1261 { PTHREAD_CANCEL_ENABLE = CANCEL_ON,
1262 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
1263 #define pthread_setcancelstate(x, y) \
1264 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
1265 #define pthread_setcanceltype(x, y) \
1266 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
1268 #define pthread_setcanceltype(x, y)
1269 #define pthread_setcancelstate(x, y)
1274 #ifdef HAVE_PTHREAD_SUSPEND