00001
00002
00003
00004 #ifndef CCXX_CONFIG_H_
00005 #define CCXX_CONFIG_H_
00006 #define __DLL
00007 #define __EXPORT_TEMPLATE(x)
00008
00009 #define CCXX_EMPTY
00010
00011 #define COMMON_64_CLEAN
00012 #define COMMON_ASYNC_OVERRIDE
00013 #define COMMON_OST_NAMESPACE
00014 #define COMMON_THREAD_SLEEP
00015 #define COMMON_NET_DEVICES
00016 #define COMMON_THREAD_DEBUG
00017 #define COMMON_DEADLOCK_DEBUG
00018 #define COMMON_NAMED_MUTEX
00019 #define COMMON_PROCESS_ATTACH
00020 #define COMMON_XML_PARSING
00021 #define COMMON_TIMER_SLEEP
00022
00023 #if __GNUC__ > 1 && !defined(__STRICT_ANSI__) && !defined(__PEDANTIC__)
00024 #define DYNAMIC_LOCAL_ARRAYS
00025 #endif
00026
00027 #if defined(__CYGWIN__)
00028 #define _POSIX_REALTIME_SIGNALS
00029 #define _POSIX_THREADS
00030 #endif
00031
00032 #if defined(__APPLE__) && defined(__MACH__)
00033 #ifndef MACOSX
00034 #define MACOSX
00035 #define _P1003_1B_VISIBLE
00036 #endif
00037 #ifndef _PTHREADS
00038 #define _PTHREADS 1
00039 #endif
00040 #endif
00041
00042 #if defined(__FreeBSD__)
00043 #ifndef __BSD_VISIBLE
00044 #define __BSD_VISIBLE 1
00045 #endif
00046 #endif
00047
00048 #ifdef _AIX
00049 #ifndef _ALL_SOURCE
00050 #define _ALL_SOURCE 1
00051 #endif
00052 #endif
00053
00054 #ifdef __hpux
00055 #ifndef _XOPEN_SOURCE_EXTENDED
00056 #define _XOPEN_SOURCE_EXTENDED
00057 #endif
00058 #ifndef _INCLUDE_LONGLONG
00059 #define _INCLUDE_LONGLONG
00060 #endif
00061 #endif
00062
00063 #define CCXX_PACKING
00064 #if defined(__GNUC__)
00065 #define CCXX_PACKED
00066 #elif !defined(__hpux) && !defined(_AIX)
00067 #define CCXX_PACKED
00068 #endif
00069
00070 #if defined(__sun) || defined(__SUN__)
00071 #define __EXTENSIONS__ 1
00072 #endif
00073
00074 #ifndef _REENTRANT
00075 #define _REENTRANT 1
00076 #endif
00077
00078 #ifndef _THREAD_SAFE
00079 #define _THREAD_SAFE 1
00080 #endif
00081
00082 #ifndef _GNU_SOURCE
00083 #define _GNU_SOURCE 1
00084 #endif
00085
00086 #if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) &&!defined(__OpenBSD__) && !defined(__MACH__) && !defined(__NetBSD__)
00087 #define _XOPEN_SOURCE 600
00088 #endif
00089
00090
00091
00092
00093
00094
00095 #define HAVE_UNISTD_H 1
00096 #define HAVE_FEATURES_H 1
00097 #define HAVE_SYS_TYPES_H 1
00098
00099 #ifdef HAVE_UNISTD_H
00100 #include <unistd.h>
00101 #endif
00102
00103 #ifndef WIN32
00104 #ifdef HAVE_FEATURES_H
00105 #include <features.h>
00106 #endif
00107 #endif
00108
00109 #ifdef HAVE_SYS_TYPES_H
00110 #include <sys/types.h>
00111 #endif
00112
00113
00114
00115 #define HAVE_SYS_TIME_H 1
00116 #define TIME_WITH_SYS_TIME 1
00117 #if TIME_WITH_SYS_TIME
00118 #include <sys/time.h>
00119 #else
00120 #if HAVE_SYS_TIME_H
00121 #include <sys/time.h>
00122 #endif
00123 #endif
00124
00125
00126
00127
00128 #define HAVE_SYS_TYPES_STD 1
00129 #define HAVE_SYS_TYPES_64 1
00130 #define HAVE_LONG_LONG 1
00131
00132
00133 #ifdef HAVE_SYS_TYPES_H
00134 #include <sys/types.h>
00135 #endif
00136
00137 #ifdef HAVE_BITS_WORSIZE_H
00138 #include <bits/wordtypes.h>
00139 #endif
00140
00141 #ifdef HAVE_SYS_TYPES_STD
00142 typedef int8_t int8;
00143 typedef u_int8_t uint8;
00144 typedef int16_t int16;
00145 typedef u_int16_t uint16;
00146 typedef int32_t int32;
00147 typedef u_int32_t uint32;
00148 #ifdef HAVE_SYS_TYPES_64
00149 #define HAVE_64_BITS
00150 typedef int64_t int64;
00151 typedef u_int64_t uint64;
00152 #endif
00153 #else
00154 typedef char int8;
00155 typedef unsigned char uint8;
00156 typedef short int16;
00157 typedef unsigned short uint16;
00158 typedef int int32;
00159 typedef unsigned int uint32;
00160 #endif
00161
00162 #ifndef HAVE_SYS_TYPES_64
00163 #if defined(__WORDSIZE) || defined(__arch64__)
00164 #if __WORDSIZE >= 64 || defined(__arch64__)
00165 typedef long int int64;
00166 typedef unsigned long int uint64;
00167 #define HAVE_SYS_TYPES_64 1
00168 #define HAVE_64_BITS
00169 #endif
00170 #endif
00171 #endif
00172
00173 #ifndef HAVE_SYS_TYPES_64
00174 #ifdef __GNUC__
00175 #if defined(HAVE_LONG_LONG) || defined(_LONGLONG)
00176 __extension__
00177 typedef long long int int64;
00178 __extension__
00179 typedef unsigned long long int uint64;
00180 #define HAVE_SYS_TYPES_64 1
00181 #define HAVE_64_BITS
00182 #endif
00183 #endif
00184 #endif
00185
00186 #ifndef HAVE_SYS_TYPES_64
00187 #if defined(HAVE_LONG_LONG) || defined(_LONGLONG)
00188 #define HAVE_64_BITS
00189 typedef long long int64;
00190 typedef unsigned long long uint64;
00191 #endif
00192 #endif
00193
00194
00195
00196 #define CCXX_EXCEPTIONS 1
00197
00198
00199
00200
00201
00202 #define CCXX_HAVE_NEW_INIT 1
00203
00204
00205 #define CCXX_NAMESPACES 1
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 #define ETC_PREFIX "/etc/"
00230
00231
00232 #define HAVE_ALLOCA_H 1
00233
00234
00235 #define HAVE_ARPA_INET_H 1
00236
00237
00238
00239
00240
00241
00242
00243
00244 #define HAVE_BITS_WORDSIZE_H 1
00245
00246
00247 #define HAVE_BOOL_TYPE 1
00248
00249
00250
00251
00252
00253
00254
00255
00256 #define HAVE_DLFCN_H 1
00257
00258
00259 #define HAVE_ENDIAN_H 1
00260
00261
00262 #define HAVE_ERRNO_H 1
00263
00264
00265 #define HAVE_EXCEPTION 1
00266
00267
00268 #define HAVE_EXTRAS 1
00269
00270
00271 #define HAVE_FCNTL_H 1
00272
00273
00274 #define HAVE_FEATURES_H 1
00275
00276
00277
00278
00279
00280
00281
00282
00283 #define HAVE_GETADDRINFO 1
00284
00285
00286 #define HAVE_GETGRNAM_R 1
00287
00288
00289 #define HAVE_GETHOSTBYNAME2 1
00290
00291
00292 #define HAVE_GETOPT 1
00293
00294
00295 #define HAVE_GETOPT_H 1
00296
00297
00298 #define HAVE_GETOPT_LONG 1
00299
00300
00301 #define HAVE_GETPAGESIZE 1
00302
00303
00304 #define HAVE_GETPWNAM_R 1
00305
00306
00307 #define HAVE_GETPWUID_R 1
00308
00309
00310 #define HAVE_GETTIMEOFDAY 1
00311
00312
00313 #define HAVE_HIRES_TIMER 1
00314
00315
00316 #define HAVE_INET_ATON 1
00317
00318
00319 #define HAVE_INET_PTON 1
00320
00321
00322 #define HAVE_INET_SOCKETS 1
00323
00324
00325 #define HAVE_INTTYPES_H 1
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346 #define HAVE_LIMITS_H 1
00347
00348
00349 #define HAVE_LINUX_IN6_H 1
00350
00351
00352
00353
00354
00355
00356
00357
00358 #define HAVE_LOCALTIME_R 1
00359
00360
00361 #define HAVE_LOCKF 1
00362
00363
00364 #define HAVE_LONG_LONG 1
00365
00366
00367 #define HAVE_LSTAT 1
00368
00369
00370
00371
00372
00373
00374
00375
00376 #define HAVE_MEMMOVE 1
00377
00378
00379 #define HAVE_MEMORY_H 1
00380
00381
00382 #define HAVE_MLOCK 1
00383
00384
00385 #define HAVE_MLOCKALL 1
00386
00387
00388 #define HAVE_MODULES 1
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406 #define HAVE_NETINET_IN_H 1
00407
00408
00409 #define HAVE_NETINET_IN_SYSTM_H 1
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421 #define HAVE_NETINET_IP_H 1
00422
00423
00424
00425
00426
00427 #define HAVE_NET_IF_H 1
00428
00429
00430
00431
00432
00433
00434
00435
00436 #define HAVE_POLL 1
00437
00438
00439 #define HAVE_POLL_H 1
00440
00441
00442 #define HAVE_POSIX_MEMALIGN 1
00443
00444
00445 #define HAVE_PREAD_PWRITE 1
00446
00447
00448 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
00449
00450
00451 #define HAVE_PTHREAD_CANCEL 1
00452
00453
00454
00455
00456
00457 #define HAVE_PTHREAD_H 1
00458
00459
00460
00461
00462
00463
00464
00465
00466 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
00467
00468
00469
00470
00471
00472 #define HAVE_PTHREAD_NANOSLEEP 1
00473
00474
00475
00476
00477
00478 #define HAVE_PTHREAD_RWLOCK 1
00479
00480
00481
00482
00483
00484
00485
00486
00487 #define HAVE_PTHREAD_SETCANCELTYPE 1
00488
00489
00490
00491
00492
00493 #define HAVE_PTHREAD_YIELD 1
00494
00495
00496
00497
00498
00499 #define HAVE_READDIR_R 1
00500
00501
00502 #define HAVE_REALPATH 1
00503
00504
00505 #define HAVE_SCHED_GETSCHEDULER 1
00506
00507
00508 #define HAVE_SCHED_H 1
00509
00510
00511
00512
00513
00514 #define HAVE_SEMAPHORE_H 1
00515
00516
00517 #define HAVE_SETEGID 1
00518
00519
00520 #define HAVE_SETENV 1
00521
00522
00523 #define HAVE_SETITIMER 1
00524
00525
00526 #define HAVE_SETPGRP 1
00527
00528
00529
00530
00531
00532 #define HAVE_SIGACTION 1
00533
00534
00535 #define HAVE_SIGWAIT 1
00536
00537
00538 #define HAVE_SIGWAIT2 1
00539
00540
00541 #define HAVE_SNPRINTF 1
00542
00543
00544 #define HAVE_SOCKLEN_T 1
00545
00546
00547 #define HAVE_SSTREAM 1
00548
00549
00550
00551
00552
00553 #define HAVE_STDINT_H 1
00554
00555
00556 #define HAVE_STDLIB_H 1
00557
00558
00559 #define HAVE_STRCASECMP 1
00560
00561
00562 #define HAVE_STRDUP 1
00563
00564
00565 #define HAVE_STRERROR_R 1
00566
00567
00568 #define HAVE_STRINGS_H 1
00569
00570
00571 #define HAVE_STRING_H 1
00572
00573
00574 #define HAVE_STRTOK_R 1
00575
00576
00577 #define HAVE_SYSLOG_H 1
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589 #define HAVE_SYS_FCNTL_H 1
00590
00591
00592 #define HAVE_SYS_FILE_H 1
00593
00594
00595 #define HAVE_SYS_IOCTL_H 1
00596
00597
00598
00599
00600
00601
00602
00603
00604 #define HAVE_SYS_PARAM_H 1
00605
00606
00607 #define HAVE_SYS_POLL_H 1
00608
00609
00610
00611
00612
00613 #define HAVE_SYS_SELECT_H 1
00614
00615
00616 #define HAVE_SYS_SOCKET_H 1
00617
00618
00619
00620
00621
00622 #define HAVE_SYS_STAT_H 1
00623
00624
00625
00626
00627
00628 #define HAVE_SYS_TIME_H 1
00629
00630
00631 #define HAVE_SYS_TYPES_64 1
00632
00633
00634 #define HAVE_SYS_TYPES_H 1
00635
00636
00637 #define HAVE_SYS_TYPES_STD 1
00638
00639
00640 #define HAVE_SYS_UN_H 1
00641
00642
00643 #define HAVE_SYS_WAIT_H 1
00644
00645
00646
00647
00648
00649 #define HAVE_UNISTD_H 1
00650
00651
00652 #define HAVE_UNIX_SOCKETS 1
00653
00654
00655 #define HAVE_WAIT4 1
00656
00657
00658 #define HAVE_WAITPID 1
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670 #define HAVE_ZLIB_H 1
00671
00672
00673
00674 #define LT_OBJDIR ".libs/"
00675
00676
00677 #define CCXX_PACKAGE "commoncpp2"
00678
00679
00680 #define CCXX_PACKAGE_BUGREPORT ""
00681
00682
00683 #define CCXX_PACKAGE_NAME ""
00684
00685
00686 #define CCXX_PACKAGE_STRING ""
00687
00688
00689 #define CCXX_PACKAGE_TARNAME ""
00690
00691
00692 #define CCXX_PACKAGE_URL ""
00693
00694
00695 #define CCXX_PACKAGE_CCXX_VERSION ""
00696
00697
00698 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00699
00700
00701 #define RETSIGTYPE void
00702
00703
00704 #define STDC_HEADERS 1
00705
00706
00707 #define TIME_WITH_SYS_TIME 1
00708
00709
00710 #define USE_MONOTONIC_TIMER 1
00711
00712
00713 #ifndef _ALL_SOURCE
00714 # define _ALL_SOURCE 1
00715 #endif
00716
00717 #ifndef _GNU_SOURCE
00718 # define _GNU_SOURCE 1
00719 #endif
00720
00721 #ifndef _POSIX_PTHREAD_SEMANTICS
00722 # define _POSIX_PTHREAD_SEMANTICS 1
00723 #endif
00724
00725 #ifndef _TANDEM_SOURCE
00726 # define _TANDEM_SOURCE 1
00727 #endif
00728
00729 #ifndef __EXTENSIONS__
00730 # define __EXTENSIONS__ 1
00731 #endif
00732
00733
00734
00735 #define CCXX_VERSION "1.6.1"
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758 #ifndef HAVE_STRERROR_R
00759 #define strerror_r(e, b, l) b = ::strerror(e)
00760 #endif
00761
00762 #ifndef HAVE_GETPWUID_R
00763 #define getpwuid_r(uid, rec, buf, size, ptr) ptr = ::getpwuid(uid)
00764 #define getpwnam_r(name, rec, buf, size, ptr) ptr = ::getpwnam(name)
00765 #endif
00766
00767
00768
00769
00770 #ifdef HAVE_POLL_H
00771 #include <poll.h>
00772 #else
00773 #ifdef HAVE_SYS_POLL_H
00774 #include <sys/poll.h>
00775 #endif
00776 #endif
00777
00778 #if defined(HAVE_POLL) && defined(POLLRDNORM)
00779 #define USE_POLL
00780 #endif
00781
00782
00783
00784
00785
00786 #ifdef HAVE_SYS_LIBCSYS_H
00787 #include <sys/libcsys.h>
00788 #endif
00789
00790 #ifdef HAVE_WINSOCK2_H
00791 #include <winsock2.h>
00792 #else
00793 #ifdef HAVE_WINSOCK_H
00794 #include <winsock.h>
00795 #else
00796 #ifdef HAVE_SYS_SOCKET_H
00797 #include <sys/socket.h>
00798 #ifdef HAVE_SELECT_H
00799 #include <select.h>
00800 #else
00801 #ifdef HAVE_SYS_SELECT_H
00802 #include <sys/select.h>
00803 #endif
00804 #endif
00805
00806 #ifdef HAVE_NETINET_IN_H
00807 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
00808
00809 #endif
00810 #include <netinet/in.h>
00811 #ifdef __hpux
00812 #define _XOPEN_SOURCE_EXTENDED
00813 #endif
00814 #endif
00815 #ifdef HAVE_ARPA_INET_H
00816 #include <arpa/inet.h>
00817 #include <netdb.h>
00818 #endif
00819
00820 #ifdef HAVE_NETINET6_IN6_H
00821 #include <netinet6/in6.h>
00822 #endif
00823
00824 #ifdef HAVE_LINIX_IN6_H
00825 #include <linux/in6.h>
00826 #endif
00827
00828 #ifdef HAVE_NETINET_IN_SYSTM_H
00829 #include <netinet/in_systm.h>
00830 #endif
00831 #ifdef HAVE_NETINET_IP_H
00832 #include <netinet/ip.h>
00833 #endif
00834 #ifdef HAVE_SYS_UN_H
00835 #include <sys/un.h>
00836 #endif
00837 #endif
00838 #endif
00839 #endif
00840
00841 #ifndef HAVE_INET_ATON
00842 #define inet_aton(cp, addr) (((*(unsigned long int *)(addr)) = inet_addr(cp)) != -1)
00843 #endif
00844
00845 #ifndef SUN_LEN
00846 #ifdef SCM_RIGHTS
00847 #define HAVE_UN_LEN
00848 #endif
00849 #ifdef __linux__
00850 #define HAVE_UN_LEN
00851 #endif
00852 #ifdef HAVE_UN_LEN
00853 #define SUN_LEN(ptr) sizeof(sockaddr_un.sun_len) + sizeof(sockaddr_un.sun_family) + sizeof(sockaddr_un.sun_path) + 1
00854 #else
00855 #define SUN_LEN(ptr) ((size_t)((struct sockaddr_un *)0)->sun_path) + strlen((ptr)->sun_path))
00856 #endif
00857 #endif
00858
00859 #ifndef _OSF_SOURCE
00860 #ifndef HAVE_SOCKLEN_T
00861 #if defined(i386) && defined(__svr4__)
00862 #define HAVE_SOCKLEN_U
00863 #else
00864 #if defined(__CYGWIN32__)
00865 #define socklen_t int
00866 #else
00867 typedef int socklen_t;
00868 #endif
00869 #endif
00870
00871 #ifdef HAVE_SOCKLEN_U
00872 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
00873 typedef unsigned socklen_t;
00874 #else
00875 typedef int socklen_t;
00876 #endif
00877 #endif
00878 #endif
00879 #endif
00880
00881 #ifdef __hpux
00882 #ifdef mutable
00883
00884 #endif
00885 #endif
00886
00887 #if defined(AF_INET6) && defined(HAVE_INET_PTON)
00888 #define CCXX_IPV6
00889 #endif
00890
00891 #define CCXX_MULTIFAMILY_IP
00892
00893
00894
00895
00896 #ifndef HAVE_BOOL_TYPE
00897 typedef enum { true=1, false=0 } bool;
00898 #endif
00899
00900
00901
00902
00903
00904 #ifndef CCXX_EXCEPTIONS
00905
00906 #ifdef HAVE_EXCEPTION
00907 #define HAVE_EXCEPTION 1
00908 #endif
00909
00910 #define THROW(x) abort()
00911
00912 #define THROWS(x)
00913
00914 #define NEW_THROWS
00915 #define THROWS_EMPTY
00916
00917
00918
00919 #else
00920 #define THROW(x) throw x
00921 #define THROWS(x) throw(x)
00922 #define NEW_THROWS throw()
00923 #define THROWS_EMPTY throw()
00924 #endif
00925
00926
00927
00928
00929 #ifdef CCXX_NAMESPACES
00930 #define USING(x) using namespace x;
00931 #else
00932 #define USING(x)
00933 #endif
00934
00935 #ifdef __KCC
00936 #define KAI_NONSTD_IOSTREAM 1
00937 #endif
00938
00939
00940
00941
00942 #ifdef HAVE_SS_H
00943 #include <ss.h>
00944 #define COMMON_SECURE
00945 #endif
00946
00947 #define COMMON_NAMESPACE ost
00948 #define NAMESPACE_COMMON namespace ost {
00949 #define END_NAMESPACE }
00950
00951 #ifdef HAVE_VISIBILITY
00952 #define __EXPORT __attribute__ ((visibility("default")))
00953 #define __DLLRTL __attribute__ ((visibility("default")))
00954 #define __LOCAL __attribute__ ((visibility("hidden")))
00955 #else
00956 #define __EXPORT
00957 #define __DLLRTL
00958 #define __LOCAL
00959 #endif
00960
00961 #ifndef ETC_PREFIX
00962 #ifdef WIN32
00963 #define ETC_PREFIX "/etc/"
00964 #endif
00965
00966 #ifndef ETC_PREFIX
00967 #define ETC_PREFIX "/etc/"
00968 #endif
00969 #endif
00970
00971 #endif
00972
00973
00974
00975
00976
00977 #ifndef HAVE_FCNTL_H
00978 #ifdef HAVE_SYS_FCNTL_H
00979 #include <sys/fcntl.h>
00980 #endif
00981 #else
00982 #include <fcntl.h>
00983 #ifndef O_NDELAY
00984 #ifdef HAVE_SYS_FCNTL_H
00985 #include <sys/fcntl.h>
00986 #endif
00987 #endif
00988 #endif
00989
00990
00991
00992 #if defined(HAVE_ENDIAN_H)
00993 #include <endian.h>
00994 #elif defined(HAVE_SYS_ISA_DEFS_H)
00995 #include <sys/isa_defs.h>
00996 #ifdef _LITTLE_ENDIAN
00997 #define __BYTE_ORDER 1234
00998 #else
00999 #define __BYTE_ORDER 4321
01000 #endif
01001 #if _ALIGNMENT_REQUIRED > 0
01002 #define __BYTE_ALIGNMENT _MAX_ALIGNMENT
01003 #else
01004 #define __BYTE_ALIGNMENT 1
01005 #endif
01006 #endif
01007
01008 #ifndef __LITTLE_ENDIAN
01009 #define __LITTLE_ENDIAN 1234
01010 #define __BIG_ENDIAN 4321
01011 #endif
01012
01013 #ifndef __BYTE_ORDER
01014 #define __BYTE_ORDER 1234
01015 #endif
01016
01017 #ifndef __BYTE_ALIGNMENT
01018 #if defined(SPARC) || defined(sparc)
01019 #if defined(__arch64__) || defined(__sparcv9)
01020 #define __BYTE_ALIGNMENT 8
01021 #else
01022 #define __BYTE_ALIGNMENT 4
01023 #endif
01024 #endif
01025 #endif
01026
01027 #ifndef __BYTE_ALIGNMENT
01028 #define __BYTE_ALIGNMENT 1
01029 #endif
01030
01031
01032
01033
01034 #ifdef HAVE_SIGACTION
01035 #ifdef HAVE_BSD_SIGNAL_H
01036
01037 #endif
01038 #endif
01039
01040
01041
01042
01043
01044 #ifdef HAVE_SIGWAIT2
01045 #ifndef _POSIX_PTHREAD_SEMANTICS
01046 #define _POSIX_PTHREAD_SEMANTICS 1
01047 #endif
01048 #endif
01049
01050 #ifdef HAVE_BSD_SIGNAL_H
01051 #include <bsd/signal.h>
01052 #else
01053 #include <signal.h>
01054 #endif
01055 #ifndef SA_ONESHOT
01056 #define SA_ONESHOT SA_RESETHAND
01057 #endif
01058
01059
01060
01061
01062 #include <cstring>
01063 #ifdef HAVE_STRINGS_H
01064 #ifndef _AIX
01065 #include <strings.h>
01066 #endif
01067 #endif
01068
01069 #ifdef HAVE_ALLOCA_H
01070 #include <alloca.h>
01071 #endif
01072
01073 #ifndef HAVE_SNPRINTF
01074 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1400
01075 #define snprintf _snprintf
01076 #define vsnprintf _vsnprintf
01077 #endif
01078 #endif
01079
01080 #ifdef HAVE_STRCASECMP
01081 #ifndef stricmp
01082 #define stricmp(x,y) strcasecmp(x,y)
01083 #endif
01084 #ifndef strnicmp
01085 #define strnicmp(x,y,n) strncasecmp(x,y,n)
01086 #endif
01087 #ifndef stristr
01088 #define stristr(x, y) strcasestr(x,y)
01089 #endif
01090 #endif
01091
01092
01093
01094
01095 #ifdef HAVE_THREAD_H
01096 #include "/usr/include/thread.h"
01097 #if defined(i386) && defined(__svr4__) && !defined(__sun)
01098 #define _THR_UNIXWARE
01099 #endif
01100 #if defined(__SVR4) && defined(__sun)
01101 #define _THR_SUNOS5
01102 #else
01103 #if defined(__SVR4__) && defined(__SUN__)
01104 #define _THR_SUNOS5
01105 #endif
01106 #endif
01107 #endif
01108
01109 #ifdef HAVE_WORKING_SYS_ATOMIC_H
01110 #include <sys/atomic.h>
01111 #define HAVE_ATOMIC
01112 #elif defined(HAVE_ATOMIC_AIX)
01113 #include <sys/atomic_op.h>
01114 #ifndef HAVE_ATOMIC
01115 #define HAVE_ATOMIC
01116 #endif
01117 #endif
01118
01119 #if defined(__cplusplus)
01120 #if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
01121 #include <bits/atomicity.h>
01122 #define HAVE_ATOMIC
01123 #endif
01124 #endif
01125
01126 #if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
01127
01128 #ifdef __QNX__
01129 #define __EXT_QNX
01130 #endif
01131
01132 #include <pthread.h>
01133
01134 #ifdef HAVE_PTHREAD_NP_H
01135 #include <pthread_np.h>
01136 #endif
01137
01138 #ifdef HAVE_SEMAPHORE_H
01139 #include <semaphore.h>
01140 #endif
01141 #ifdef _POSIX_PRIORITY_SCHEDULING
01142 #ifdef HAVE_SCHED_H
01143 #include <sched.h>
01144 #else
01145 #ifdef HAVE_SYS_SCHED_H
01146 #include <sys/sched.h>
01147 #endif
01148 #endif
01149 #endif
01150
01151 #define __PTHREAD_H__
01152 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
01153 #ifdef MUTEX_TYPE_COUNTING_FAST
01154 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
01155 #endif
01156 #endif
01157 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
01158 #ifdef PTHREAD_MUTEX_RECURSIVE
01159 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
01160 #endif
01161 #endif
01162 #ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
01163 #if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
01164 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
01165 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
01166 #endif
01167 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
01168 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
01169 #endif
01170 #if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
01171 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
01172 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
01173 #endif
01174 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
01175 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
01176 #endif
01177 #endif
01178
01179 #ifdef HAVE_PTHREAD_MACH_THREAD_NP
01180 #define _THR_MACH
01181 #endif
01182
01183 #ifndef HAVE_PTHREAD_YIELD
01184 #ifdef HAVE_PTHREAD_YIELD_NP
01185 #define pthread_yield() pthread_yield_np()
01186 #define HAVE_PTHREAD_YIELD 1
01187 #endif
01188 #endif
01189
01190 #ifndef HAVE_PTHREAD_YIELD
01191 #ifdef HAVE_PTHREAD_SCHED_YIELD
01192 #define pthread_yield() sched_yield()
01193 #define HAVE_PTHREAD_YIELD 1
01194 #endif
01195 #endif
01196
01197 #ifndef HAVE_PTHREAD_DELAY
01198 #ifdef HAVE_PTHREAD_DELAY_NP
01199 #define HAVE_PTHREAD_DELAY
01200 #define pthread_delay(x) pthread_delay_np(x)
01201 #endif
01202 #if defined(HAVE_PTHREAD_NANOSLEEP)
01203 #ifndef HAVE_PTHREAD_DELAY
01204 #define HAVE_PTHREAD_DELAY
01205 #ifdef __FreeBSD__
01206 #ifdef __cplusplus
01207 extern "C" int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
01208 #endif
01209 #endif
01210 #define pthread_delay(x) nanosleep(x, NULL)
01211 #endif
01212 #endif
01213 #endif
01214
01215 #ifdef HAVE_PTHREAD_ATTR_SETSTACK
01216 #ifndef PTHREAD_STACK_MIN
01217 #define PTHREAD_STACK_MIN 32768
01218 #endif
01219 #endif
01220
01221 #ifndef HAVE_PTHREAD_CANCEL
01222 #ifdef SIGCANCEL
01223 #define CCXX_SIG_THREAD_CANCEL SIGCANCEL
01224 #else
01225 #define CCXX_SIG_THREAD_CANCEL SIGQUIT
01226 #endif
01227 #define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
01228 #define pthread_setcanceltype(x, y)
01229 #define pthread_setcancelstate(x, y)
01230 #endif
01231
01232 #ifndef HAVE_PTHREAD_SETCANCELTYPE
01233 #ifdef HAVE_PTHREAD_SETCANCEL
01234 enum
01235 { PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
01236 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
01237 enum
01238 { PTHREAD_CANCEL_ENABLE = CANCEL_ON,
01239 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
01240 #define pthread_setcancelstate(x, y) \
01241 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
01242 #define pthread_setcanceltype(x, y) \
01243 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
01244 #else
01245 #define pthread_setcanceltype(x, y)
01246 #define pthread_setcancelstate(x, y)
01247 #endif
01248 #endif
01249
01250 #ifdef _AIX
01251 #ifdef HAVE_PTHREAD_SUSPEND
01252
01253 #endif
01254 #endif
01255
01256 #endif
01257
01258
01259