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