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