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
382 #define HAVE_MLOCKALL 1
385 #define HAVE_MODULES 1
391 #define HAVE_NAT_NETFILTER 1
403 #define HAVE_NETINET_IN_H 1
406 #define HAVE_NETINET_IN_SYSTM_H 1
418 #define HAVE_NETINET_IP_H 1
424 #define HAVE_NET_IF_H 1
436 #define HAVE_POLL_H 1
439 #define HAVE_POSIX_MEMALIGN 1
442 #define HAVE_PREAD_PWRITE 1
445 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
448 #define HAVE_PTHREAD_CANCEL 1
454 #define HAVE_PTHREAD_H 1
463 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
469 #define HAVE_PTHREAD_NANOSLEEP 1
475 #define HAVE_PTHREAD_RWLOCK 1
484 #define HAVE_PTHREAD_SETCANCELTYPE 1
490 #define HAVE_PTHREAD_YIELD 1
496 #define HAVE_READDIR_R 1
499 #define HAVE_REALPATH 1
502 #define HAVE_SCHED_GETSCHEDULER 1
505 #define HAVE_SCHED_H 1
511 #define HAVE_SEMAPHORE_H 1
514 #define HAVE_SETEGID 1
517 #define HAVE_SETENV 1
520 #define HAVE_SETITIMER 1
523 #define HAVE_SETPGRP 1
529 #define HAVE_SIGACTION 1
532 #define HAVE_SIGWAIT 1
535 #define HAVE_SIGWAIT2 1
538 #define HAVE_SNPRINTF 1
541 #define HAVE_SOCKLEN_T 1
544 #define HAVE_SSTREAM 1
550 #define HAVE_STDINT_H 1
554 #define HAVE_STDLIB_H 1
557 #define HAVE_STRCASECMP 1
560 #define HAVE_STRDUP 1
563 #define HAVE_STRERROR_R 1
566 #define HAVE_STRINGS_H 1
570 #define HAVE_STRING_H 1
573 #define HAVE_STRTOK_R 1
576 #define HAVE_SYSLOG_H 1
588 #define HAVE_SYS_FCNTL_H 1
591 #define HAVE_SYS_FILE_H 1
594 #define HAVE_SYS_IOCTL_H 1
603 #define HAVE_SYS_PARAM_H 1
606 #define HAVE_SYS_POLL_H 1
612 #define HAVE_SYS_SELECT_H 1
615 #define HAVE_SYS_SOCKET_H 1
621 #define HAVE_SYS_STAT_H 1
627 #define HAVE_SYS_TIME_H 1
630 #define HAVE_SYS_TYPES_64 1
633 #define HAVE_SYS_TYPES_H 1
636 #define HAVE_SYS_TYPES_STD 1
639 #define HAVE_SYS_UN_H 1
642 #define HAVE_SYS_WAIT_H 1
648 #define HAVE_UNISTD_H 1
651 #define HAVE_UNIX_SOCKETS 1
657 #define HAVE_WAITPID 1
669 #define HAVE_ZLIB_H 1
672 #define LT_OBJDIR ".libs/"
675 #define CCXX_PACKAGE "commoncpp2"
678 #define CCXX_PACKAGE_BUGREPORT ""
681 #define CCXX_PACKAGE_NAME ""
684 #define CCXX_PACKAGE_STRING ""
687 #define CCXX_PACKAGE_TARNAME ""
690 #define CCXX_PACKAGE_URL ""
693 #define CCXX_PACKAGE_CCXX_VERSION ""
696 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
699 #define RETSIGTYPE void
703 #define STDC_HEADERS 1
707 #define TIME_WITH_SYS_TIME 1
710 #define USE_MONOTONIC_TIMER 1
714 # define _ALL_SOURCE 1
717 #ifndef _DARWIN_C_SOURCE
718 # define _DARWIN_C_SOURCE 1
722 # define _GNU_SOURCE 1
725 #ifndef _POSIX_PTHREAD_SEMANTICS
726 # define _POSIX_PTHREAD_SEMANTICS 1
729 #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
730 # define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
733 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
734 # define __STDC_WANT_IEC_60559_BFP_EXT__ 1
737 #ifndef __STDC_WANT_IEC_60559_DFP_EXT__
738 # define __STDC_WANT_IEC_60559_DFP_EXT__ 1
741 #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
742 # define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
745 #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
746 # define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
749 #ifndef __STDC_WANT_LIB_EXT2__
750 # define __STDC_WANT_LIB_EXT2__ 1
753 #ifndef __STDC_WANT_MATH_SPEC_FUNCS__
754 # define __STDC_WANT_MATH_SPEC_FUNCS__ 1
757 #ifndef _TANDEM_SOURCE
758 # define _TANDEM_SOURCE 1
763 #ifndef _XOPEN_SOURCE
767 #ifndef __EXTENSIONS__
768 # define __EXTENSIONS__ 1
773 #define CCXX_VERSION "1.8.1"
812 #if defined __SUNPRO_CC && !defined __RESTRICT
814 # define __restrict__
823 #ifndef HAVE_STRERROR_R
824 #define strerror_r(e, b, l) b = ::strerror(e)
827 #ifndef HAVE_GETPWUID_R
828 #define getpwuid_r(uid, rec, buf, size, ptr) ptr = ::getpwuid(uid)
829 #define getpwnam_r(name, rec, buf, size, ptr) ptr = ::getpwnam(name)
838 #ifdef HAVE_SYS_POLL_H
839 #include <sys/poll.h>
843 #if defined(HAVE_POLL) && defined(POLLRDNORM)
851 #ifdef HAVE_SYS_LIBCSYS_H
852 #include <sys/libcsys.h>
855 #ifdef HAVE_WINSOCK2_H
856 #include <winsock2.h>
858 #ifdef HAVE_WINSOCK_H
861 #ifdef HAVE_SYS_SOCKET_H
862 #include <sys/socket.h>
866 #ifdef HAVE_SYS_SELECT_H
867 #include <sys/select.h>
871 #ifdef HAVE_NETINET_IN_H
872 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
875 #include <netinet/in.h>
877 #define _XOPEN_SOURCE_EXTENDED
880 #ifdef HAVE_ARPA_INET_H
881 #include <arpa/inet.h>
885 #ifdef HAVE_NETINET6_IN6_H
886 #include <netinet6/in6.h>
889 #ifdef HAVE_LINIX_IN6_H
890 #include <linux/in6.h>
893 #ifdef HAVE_NETINET_IN_SYSTM_H
894 #include <netinet/in_systm.h>
896 #ifdef HAVE_NETINET_IP_H
897 #include <netinet/ip.h>
906 #ifndef HAVE_INET_ATON
907 #define inet_aton(cp, addr) (((*(unsigned long int *)(addr)) = inet_addr(cp)) != -1)
918 #define SUN_LEN(ptr) sizeof(sockaddr_un.sun_len) + sizeof(sockaddr_un.sun_family) + sizeof(sockaddr_un.sun_path) + 1
920 #define SUN_LEN(ptr) ((size_t)((struct sockaddr_un *)0)->sun_path) + strlen((ptr)->sun_path))
925 #ifndef HAVE_SOCKLEN_T
926 #if defined(i386) && defined(__svr4__)
927 #define HAVE_SOCKLEN_U
929 #if defined(__CYGWIN32__)
930 #define socklen_t int
932 typedef int socklen_t;
936 #ifdef HAVE_SOCKLEN_U
937 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
938 typedef unsigned socklen_t;
940 typedef int socklen_t;
952 #if defined(AF_INET6) && defined(HAVE_INET_PTON)
956 #define CCXX_MULTIFAMILY_IP
961 #ifndef HAVE_BOOL_TYPE
962 typedef enum {
true=1,
false=0 } bool;
969 #ifndef CCXX_EXCEPTIONS
971 #ifdef HAVE_EXCEPTION
972 #define HAVE_EXCEPTION 1
975 #define THROW(x) abort()
985 #define THROW(x) throw x
986 #define THROWS(x) throw(x)
987 #define NEW_THROWS throw()
988 #define THROWS_EMPTY throw()
994 #ifdef CCXX_NAMESPACES
995 #define USING(x) using namespace x;
1001 #define KAI_NONSTD_IOSTREAM 1
1009 #define COMMON_SECURE
1012 #define COMMON_NAMESPACE ost
1013 #define NAMESPACE_COMMON namespace ost {
1014 #define END_NAMESPACE }
1016 #ifdef HAVE_VISIBILITY
1017 #define __EXPORT __attribute__ ((visibility("default")))
1018 #define __DLLRTL __attribute__ ((visibility("default")))
1019 #define __LOCAL __attribute__ ((visibility("hidden")))
1028 #define ETC_PREFIX "/etc/"
1032 #define ETC_PREFIX "/etc/"
1042 #ifndef HAVE_FCNTL_H
1043 #ifdef HAVE_SYS_FCNTL_H
1044 #include <sys/fcntl.h>
1049 #ifdef HAVE_SYS_FCNTL_H
1050 #include <sys/fcntl.h>
1057 #if defined(HAVE_ENDIAN_H)
1059 #elif defined(HAVE_SYS_ISA_DEFS_H)
1060 #include <sys/isa_defs.h>
1061 #ifdef _LITTLE_ENDIAN
1062 #define __BYTE_ORDER 1234
1064 #define __BYTE_ORDER 4321
1066 #if _ALIGNMENT_REQUIRED > 0
1067 #define __BYTE_ALIGNMENT _MAX_ALIGNMENT
1069 #define __BYTE_ALIGNMENT 1
1073 #ifndef __LITTLE_ENDIAN
1074 #define __LITTLE_ENDIAN 1234
1075 #define __BIG_ENDIAN 4321
1078 #ifndef __BYTE_ORDER
1079 #define __BYTE_ORDER 1234
1082 #ifndef __BYTE_ALIGNMENT
1083 #if defined(SPARC) || defined(sparc)
1084 #if defined(__arch64__) || defined(__sparcv9)
1085 #define __BYTE_ALIGNMENT 8
1087 #define __BYTE_ALIGNMENT 4
1092 #ifndef __BYTE_ALIGNMENT
1093 #define __BYTE_ALIGNMENT 1
1099 #ifdef HAVE_SIGACTION
1100 #ifdef HAVE_BSD_SIGNAL_H
1109 #ifdef HAVE_SIGWAIT2
1110 #ifndef _POSIX_PTHREAD_SEMANTICS
1111 #define _POSIX_PTHREAD_SEMANTICS 1
1115 #ifdef HAVE_BSD_SIGNAL_H
1116 #include <bsd/signal.h>
1121 #define SA_ONESHOT SA_RESETHAND
1128 #ifdef HAVE_STRINGS_H
1130 #include <strings.h>
1134 #ifdef HAVE_ALLOCA_H
1138 #ifndef HAVE_SNPRINTF
1139 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1400
1140 #define snprintf _snprintf
1141 #define vsnprintf _vsnprintf
1145 #ifdef HAVE_STRCASECMP
1147 #define stricmp(x,y) strcasecmp(x,y)
1150 #define strnicmp(x,y,n) strncasecmp(x,y,n)
1153 #define stristr(x, y) strcasestr(x,y)
1160 #ifdef HAVE_THREAD_H
1161 #include "/usr/include/thread.h"
1162 #if defined(i386) && defined(__svr4__) && !defined(__sun)
1163 #define _THR_UNIXWARE
1165 #if defined(__SVR4) && defined(__sun)
1168 #if defined(__SVR4__) && defined(__SUN__)
1174 #ifdef HAVE_WORKING_SYS_ATOMIC_H
1175 #include <sys/atomic.h>
1177 #elif defined(HAVE_ATOMIC_AIX)
1178 #include <sys/atomic_op.h>
1184 #if defined(__cplusplus)
1185 #if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
1186 #include <bits/atomicity.h>
1191 #if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
1197 #include <pthread.h>
1199 #ifdef HAVE_PTHREAD_NP_H
1200 #include <pthread_np.h>
1203 #ifdef HAVE_SEMAPHORE_H
1204 #include <semaphore.h>
1206 #ifdef _POSIX_PRIORITY_SCHEDULING
1210 #ifdef HAVE_SYS_SCHED_H
1211 #include <sys/sched.h>
1216 #define __PTHREAD_H__
1217 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1218 #ifdef MUTEX_TYPE_COUNTING_FAST
1219 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1222 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1223 #ifdef PTHREAD_MUTEX_RECURSIVE
1224 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1227 #ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
1228 #if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
1229 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1230 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1232 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
1233 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
1235 #if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
1236 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1237 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1239 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
1240 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
1244 #ifdef HAVE_PTHREAD_MACH_THREAD_NP
1248 #ifndef HAVE_PTHREAD_YIELD
1249 #ifdef HAVE_PTHREAD_YIELD_NP
1250 #define pthread_yield() pthread_yield_np()
1251 #define HAVE_PTHREAD_YIELD 1
1255 #ifndef HAVE_PTHREAD_YIELD
1256 #ifdef HAVE_PTHREAD_SCHED_YIELD
1257 #define pthread_yield() sched_yield()
1258 #define HAVE_PTHREAD_YIELD 1
1262 #ifndef HAVE_PTHREAD_DELAY
1263 #ifdef HAVE_PTHREAD_DELAY_NP
1264 #define HAVE_PTHREAD_DELAY
1265 #define pthread_delay(x) pthread_delay_np(x)
1267 #if defined(HAVE_PTHREAD_NANOSLEEP)
1268 #ifndef HAVE_PTHREAD_DELAY
1269 #define HAVE_PTHREAD_DELAY
1272 extern "C" int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp);
1275 #define pthread_delay(x) nanosleep(x, NULL)
1280 #ifdef HAVE_PTHREAD_ATTR_SETSTACK
1281 #ifndef PTHREAD_STACK_MIN
1282 #define PTHREAD_STACK_MIN 32768
1286 #ifndef HAVE_PTHREAD_CANCEL
1288 #define CCXX_SIG_THREAD_CANCEL SIGCANCEL
1290 #define CCXX_SIG_THREAD_CANCEL SIGQUIT
1292 #define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
1293 #define pthread_setcanceltype(x, y)
1294 #define pthread_setcancelstate(x, y)
1297 #ifndef HAVE_PTHREAD_SETCANCELTYPE
1298 #ifdef HAVE_PTHREAD_SETCANCEL
1300 { PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
1301 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
1303 { PTHREAD_CANCEL_ENABLE = CANCEL_ON,
1304 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
1305 #define pthread_setcancelstate(x, y) \
1306 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
1307 #define pthread_setcanceltype(x, y) \
1308 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
1310 #define pthread_setcanceltype(x, y)
1311 #define pthread_setcancelstate(x, y)
1316 #ifdef HAVE_PTHREAD_SUSPEND