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
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
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
674 #define LT_OBJDIR ".libs/"
677 #define CCXX_PACKAGE "commoncpp2"
680 #define CCXX_PACKAGE_BUGREPORT ""
683 #define CCXX_PACKAGE_NAME ""
686 #define CCXX_PACKAGE_STRING ""
689 #define CCXX_PACKAGE_TARNAME ""
692 #define CCXX_PACKAGE_URL ""
695 #define CCXX_PACKAGE_CCXX_VERSION ""
698 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
701 #define RETSIGTYPE void
704 #define STDC_HEADERS 1
707 #define TIME_WITH_SYS_TIME 1
710 #define USE_MONOTONIC_TIMER 1
714 # define _ALL_SOURCE 1
718 # define _GNU_SOURCE 1
721 #ifndef _POSIX_PTHREAD_SEMANTICS
722 # define _POSIX_PTHREAD_SEMANTICS 1
725 #ifndef _TANDEM_SOURCE
726 # define _TANDEM_SOURCE 1
729 #ifndef __EXTENSIONS__
730 # define __EXTENSIONS__ 1
735 #define CCXX_VERSION "1.6.1"
758 #ifndef HAVE_STRERROR_R
759 #define strerror_r(e, b, l) b = ::strerror(e)
762 #ifndef HAVE_GETPWUID_R
763 #define getpwuid_r(uid, rec, buf, size, ptr) ptr = ::getpwuid(uid)
764 #define getpwnam_r(name, rec, buf, size, ptr) ptr = ::getpwnam(name)
773 #ifdef HAVE_SYS_POLL_H
774 #include <sys/poll.h>
778 #if defined(HAVE_POLL) && defined(POLLRDNORM)
786 #ifdef HAVE_SYS_LIBCSYS_H
787 #include <sys/libcsys.h>
790 #ifdef HAVE_WINSOCK2_H
791 #include <winsock2.h>
793 #ifdef HAVE_WINSOCK_H
796 #ifdef HAVE_SYS_SOCKET_H
797 #include <sys/socket.h>
801 #ifdef HAVE_SYS_SELECT_H
802 #include <sys/select.h>
806 #ifdef HAVE_NETINET_IN_H
807 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
810 #include <netinet/in.h>
812 #define _XOPEN_SOURCE_EXTENDED
815 #ifdef HAVE_ARPA_INET_H
816 #include <arpa/inet.h>
820 #ifdef HAVE_NETINET6_IN6_H
821 #include <netinet6/in6.h>
824 #ifdef HAVE_LINIX_IN6_H
825 #include <linux/in6.h>
828 #ifdef HAVE_NETINET_IN_SYSTM_H
829 #include <netinet/in_systm.h>
831 #ifdef HAVE_NETINET_IP_H
832 #include <netinet/ip.h>
841 #ifndef HAVE_INET_ATON
842 #define inet_aton(cp, addr) (((*(unsigned long int *)(addr)) = inet_addr(cp)) != -1)
853 #define SUN_LEN(ptr) sizeof(sockaddr_un.sun_len) + sizeof(sockaddr_un.sun_family) + sizeof(sockaddr_un.sun_path) + 1
855 #define SUN_LEN(ptr) ((size_t)((struct sockaddr_un *)0)->sun_path) + strlen((ptr)->sun_path))
860 #ifndef HAVE_SOCKLEN_T
861 #if defined(i386) && defined(__svr4__)
862 #define HAVE_SOCKLEN_U
864 #if defined(__CYGWIN32__)
865 #define socklen_t int
867 typedef int socklen_t;
871 #ifdef HAVE_SOCKLEN_U
872 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
873 typedef unsigned socklen_t;
875 typedef int socklen_t;
887 #if defined(AF_INET6) && defined(HAVE_INET_PTON)
891 #define CCXX_MULTIFAMILY_IP
896 #ifndef HAVE_BOOL_TYPE
897 typedef enum {
true=1,
false=0 } bool;
904 #ifndef CCXX_EXCEPTIONS
906 #ifdef HAVE_EXCEPTION
907 #define HAVE_EXCEPTION 1
910 #define THROW(x) abort()
920 #define THROW(x) throw x
921 #define THROWS(x) throw(x)
922 #define NEW_THROWS throw()
923 #define THROWS_EMPTY throw()
929 #ifdef CCXX_NAMESPACES
930 #define USING(x) using namespace x;
936 #define KAI_NONSTD_IOSTREAM 1
944 #define COMMON_SECURE
947 #define COMMON_NAMESPACE ost
948 #define NAMESPACE_COMMON namespace ost {
949 #define END_NAMESPACE }
951 #ifdef HAVE_VISIBILITY
952 #define __EXPORT __attribute__ ((visibility("default")))
953 #define __DLLRTL __attribute__ ((visibility("default")))
954 #define __LOCAL __attribute__ ((visibility("hidden")))
963 #define ETC_PREFIX "/etc/"
967 #define ETC_PREFIX "/etc/"
978 #ifdef HAVE_SYS_FCNTL_H
979 #include <sys/fcntl.h>
984 #ifdef HAVE_SYS_FCNTL_H
985 #include <sys/fcntl.h>
992 #if defined(HAVE_ENDIAN_H)
994 #elif defined(HAVE_SYS_ISA_DEFS_H)
995 #include <sys/isa_defs.h>
996 #ifdef _LITTLE_ENDIAN
997 #define __BYTE_ORDER 1234
999 #define __BYTE_ORDER 4321
1001 #if _ALIGNMENT_REQUIRED > 0
1002 #define __BYTE_ALIGNMENT _MAX_ALIGNMENT
1004 #define __BYTE_ALIGNMENT 1
1008 #ifndef __LITTLE_ENDIAN
1009 #define __LITTLE_ENDIAN 1234
1010 #define __BIG_ENDIAN 4321
1013 #ifndef __BYTE_ORDER
1014 #define __BYTE_ORDER 1234
1017 #ifndef __BYTE_ALIGNMENT
1018 #if defined(SPARC) || defined(sparc)
1019 #if defined(__arch64__) || defined(__sparcv9)
1020 #define __BYTE_ALIGNMENT 8
1022 #define __BYTE_ALIGNMENT 4
1027 #ifndef __BYTE_ALIGNMENT
1028 #define __BYTE_ALIGNMENT 1
1034 #ifdef HAVE_SIGACTION
1035 #ifdef HAVE_BSD_SIGNAL_H
1044 #ifdef HAVE_SIGWAIT2
1045 #ifndef _POSIX_PTHREAD_SEMANTICS
1046 #define _POSIX_PTHREAD_SEMANTICS 1
1050 #ifdef HAVE_BSD_SIGNAL_H
1051 #include <bsd/signal.h>
1056 #define SA_ONESHOT SA_RESETHAND
1063 #ifdef HAVE_STRINGS_H
1065 #include <strings.h>
1069 #ifdef HAVE_ALLOCA_H
1073 #ifndef HAVE_SNPRINTF
1074 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1400
1075 #define snprintf _snprintf
1076 #define vsnprintf _vsnprintf
1080 #ifdef HAVE_STRCASECMP
1082 #define stricmp(x,y) strcasecmp(x,y)
1085 #define strnicmp(x,y,n) strncasecmp(x,y,n)
1088 #define stristr(x, y) strcasestr(x,y)
1095 #ifdef HAVE_THREAD_H
1096 #include "/usr/include/thread.h"
1097 #if defined(i386) && defined(__svr4__) && !defined(__sun)
1098 #define _THR_UNIXWARE
1100 #if defined(__SVR4) && defined(__sun)
1103 #if defined(__SVR4__) && defined(__SUN__)
1109 #ifdef HAVE_WORKING_SYS_ATOMIC_H
1110 #include <sys/atomic.h>
1112 #elif defined(HAVE_ATOMIC_AIX)
1113 #include <sys/atomic_op.h>
1119 #if defined(__cplusplus)
1120 #if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
1121 #include <bits/atomicity.h>
1126 #if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
1132 #include <pthread.h>
1134 #ifdef HAVE_PTHREAD_NP_H
1135 #include <pthread_np.h>
1138 #ifdef HAVE_SEMAPHORE_H
1139 #include <semaphore.h>
1141 #ifdef _POSIX_PRIORITY_SCHEDULING
1145 #ifdef HAVE_SYS_SCHED_H
1146 #include <sys/sched.h>
1151 #define __PTHREAD_H__
1152 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1153 #ifdef MUTEX_TYPE_COUNTING_FAST
1154 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1157 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1158 #ifdef PTHREAD_MUTEX_RECURSIVE
1159 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1162 #ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
1163 #if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
1164 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1165 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1167 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
1168 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
1170 #if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
1171 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
1172 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
1174 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
1175 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
1179 #ifdef HAVE_PTHREAD_MACH_THREAD_NP
1183 #ifndef HAVE_PTHREAD_YIELD
1184 #ifdef HAVE_PTHREAD_YIELD_NP
1185 #define pthread_yield() pthread_yield_np()
1186 #define HAVE_PTHREAD_YIELD 1
1190 #ifndef HAVE_PTHREAD_YIELD
1191 #ifdef HAVE_PTHREAD_SCHED_YIELD
1192 #define pthread_yield() sched_yield()
1193 #define HAVE_PTHREAD_YIELD 1
1197 #ifndef HAVE_PTHREAD_DELAY
1198 #ifdef HAVE_PTHREAD_DELAY_NP
1199 #define HAVE_PTHREAD_DELAY
1200 #define pthread_delay(x) pthread_delay_np(x)
1202 #if defined(HAVE_PTHREAD_NANOSLEEP)
1203 #ifndef HAVE_PTHREAD_DELAY
1204 #define HAVE_PTHREAD_DELAY
1207 extern "C" int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp);
1210 #define pthread_delay(x) nanosleep(x, NULL)
1215 #ifdef HAVE_PTHREAD_ATTR_SETSTACK
1216 #ifndef PTHREAD_STACK_MIN
1217 #define PTHREAD_STACK_MIN 32768
1221 #ifndef HAVE_PTHREAD_CANCEL
1223 #define CCXX_SIG_THREAD_CANCEL SIGCANCEL
1225 #define CCXX_SIG_THREAD_CANCEL SIGQUIT
1227 #define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
1228 #define pthread_setcanceltype(x, y)
1229 #define pthread_setcancelstate(x, y)
1232 #ifndef HAVE_PTHREAD_SETCANCELTYPE
1233 #ifdef HAVE_PTHREAD_SETCANCEL
1235 { PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
1236 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
1238 { PTHREAD_CANCEL_ENABLE = CANCEL_ON,
1239 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
1240 #define pthread_setcancelstate(x, y) \
1241 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
1242 #define pthread_setcanceltype(x, y) \
1243 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
1245 #define pthread_setcanceltype(x, y)
1246 #define pthread_setcancelstate(x, y)
1251 #ifdef HAVE_PTHREAD_SUSPEND