00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ACE_OS_H
00016 #define ACE_OS_H
00017
00018 #include "ace/pre.h"
00019
00020 #include "ace/config-all.h"
00021
00022 #if defined (ACE_HAS_VIRTUAL_TIME)
00023 #include <sys/times.h>
00024 #endif
00025
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif
00029
00030
00031 #include "ace/OS_Dirent.h"
00032 #include "ace/OS_String.h"
00033 #include "ace/OS_Memory.h"
00034 #include "ace/OS_TLI.h"
00035 #include "ace/OS_Errno.h"
00036
00037 #include "ace/Time_Value.h"
00038
00039 class ACE_Timeout_Manager;
00040
00041 #if !defined (_SC_AIO_MAX)
00042 #define _SC_AIO_MAX 1
00043 #endif
00044
00045
00046 #define ACE_ASCII_SIZE 128
00047 #define ACE_EBCDIC_SIZE 256
00048
00049 #if 'a' < 'A'
00050 #define ACE_HAS_EBCDIC
00051 #define ACE_STANDARD_CHARACTER_SET_SIZE 256
00052 #else
00053 #define ACE_HAS_ASCII
00054 #define ACE_STANDARD_CHARACTER_SET_SIZE 128
00055 #endif
00056
00057 # if defined (ACE_PSOS_TM)
00058 typedef long long longlong_t;
00059 typedef long id_t;
00060 # endif
00061
00062
00063 # if defined (ACE_HAS_BROKEN_NAMESPACES)
00064 # define ACE_CORBA_1(NAME) CORBA_##NAME
00065 # define ACE_CORBA_2(TYPE, NAME) CORBA_##TYPE##_##NAME
00066 # define ACE_CORBA_3(TYPE, NAME) CORBA_##TYPE::NAME
00067 # define ACE_NESTED_CLASS(TYPE, NAME) NAME
00068 # else
00069 # define ACE_CORBA_1(NAME) CORBA::NAME
00070 # define ACE_CORBA_2(TYPE, NAME) CORBA::TYPE::NAME
00071 # define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME
00072 # define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME
00073 # endif
00074
00075
00076
00077
00078 #include "ace/Default_Constants.h"
00079
00080 # if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG)
00081
00082 # define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE)
00083 # if defined (ACE_LACKS_CMSG_DATA_MACRO)
00084 # if defined (ACE_LACKS_CMSG_DATA_MEMBER)
00085 # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
00086 # else
00087 # define CMSG_DATA(cmsg) ((cmsg)->cmsg_data)
00088 # endif
00089 # endif
00090 # endif
00091
00092
00093
00094 # if defined (FD_SETSIZE)
00095 int const ACE_FD_SETSIZE = FD_SETSIZE;
00096 # else
00097 # define ACE_FD_SETSIZE FD_SETSIZE
00098 # endif
00099
00100 # if !defined (ACE_DEFAULT_SELECT_REACTOR_SIZE)
00101 # define ACE_DEFAULT_SELECT_REACTOR_SIZE ACE_FD_SETSIZE
00102 # endif
00103
00104
00105
00106
00107 #include "ace/Global_Macros.h"
00108
00109 #if !defined (ACE_WIN32)
00110 #define ACE_MAX_USERID L_cuserid
00111 #endif
00112
00113
00114 # include "ace/Min_Max.h"
00115
00116
00117
00118
00119
00120 # if defined (ACE_LACKS_KEY_T)
00121 # if defined (ACE_WIN32)
00122
00123
00124 typedef char *key_t;
00125 # else
00126 typedef int key_t;
00127 # endif
00128 # endif
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 # if defined (ACE_PSOS)
00140
00141 # if defined (ACE_LACKS_ASSERT_MACRO)
00142 # define assert(expr)
00143 # endif
00144
00145 # if defined (ACE_PSOSIM)
00146
00147 # include "ace/sys_conf.h"
00148 # include <psos.h>
00149 # include <pna.h>
00150
00151
00152 # define size_t unsigned int
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 # include <sys/stat.h>
00167 # include <sys/ioctl.h>
00168 # include <sys/sockio.h>
00169 # include <netinet/tcp.h>
00170
00171 # define TCP_
00172 # if ! defined (BUFSIZ)
00173 # define BUFSIZ 1024
00174 # endif
00175
00176
00177 # else
00178
00179 # if defined (ACE_PSOS_CANT_USE_SYS_TYPES)
00180
00181
00182 # if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES)
00183 typedef unsigned char u_char;
00184 typedef unsigned short u_short;
00185 # endif
00186 typedef unsigned int u_int;
00187 # if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES)
00188 typedef unsigned long u_long;
00189 # endif
00190
00191
00192 # if 0
00193 typedef unsigned char uchar_t;
00194 typedef unsigned short ushort_t;
00195 typedef unsigned int uint_t;
00196 typedef unsigned long ulong_t;
00197 # endif
00198 typedef char * caddr_t;
00199
00200 # if defined (ACE_PSOS_DIAB_PPC)
00201
00202 # if 0
00203 typedef unsigned long pid_t;
00204 # endif
00205 # define ACE_INVALID_PID ((pid_t) ~0)
00206 # else
00207 typedef long pid_t;
00208 # define ACE_INVALID_PID ((pid_t) -1)
00209 # endif
00210
00211
00212 # endif
00213
00214 # include "ace/sys_conf.h"
00215 # include <configs.h>
00216
00217 # include <pna.h>
00218 # include <phile.h>
00219
00220 # if defined (ACE_PSOS_DIAB_MIPS)
00221 # if defined (ACE_PSOS_USES_DIAB_SYS_CALLS)
00222 # include <unistd.h>
00223 # else
00224 # include <prepc.h>
00225 # endif
00226 # include <sys/wait.h>
00227 # endif
00228
00229
00230
00231
00232
00233 # if !defined (AF_UNIX)
00234 # define AF_UNIX 0x1
00235 # endif
00236 # define PF_UNIX AF_UNIX
00237 # define PF_INET AF_INET
00238 # if !defined (AF_MAX)
00239 # define AF_MAX AF_INET
00240 # endif
00241 # if !defined (IFF_LOOPBACK)
00242 # define IFF_LOOPBACK IFF_EXTLOOPBACK
00243 # endif
00244
00245 typedef long fd_mask;
00246 # define IPPORT_RESERVED 1024
00247 # define IPPORT_USERRESERVED 5000
00248
00249 # if !defined (howmany)
00250 # define howmany(x, y) (((x)+((y)-1))/(y))
00251 # endif
00252
00253 extern "C"
00254 {
00255 typedef void (* ACE_SignalHandler) (void);
00256 typedef void (* ACE_SignalHandlerV) (void);
00257 }
00258
00259 # if !defined(SIG_DFL)
00260 # define SIG_DFL (ACE_SignalHandler) 0
00261 # endif
00262
00263 # endif
00264
00265
00266
00267
00268 # include <errno.h>
00269
00270 # if !defined (EPERM)
00271 # define EPERM 1
00272 # endif
00273 # if !defined (ENOENT)
00274 # define ENOENT 2
00275 # endif
00276 # if !defined (ESRCH)
00277 # define ESRCH 3
00278 # endif
00279 # if ! defined (EINTR)
00280 # define EINTR 4
00281 # endif
00282 # if !defined (EBADF)
00283 # define EBADF 9
00284 # endif
00285 # if !defined (EAGAIN)
00286 # define EAGAIN 11
00287 # endif
00288 # if !defined (EWOULDBLOCK)
00289 # define EWOULDBLOCK EAGAIN
00290 # endif
00291 # if !defined (ENOMEM)
00292 # define ENOMEM 12
00293 # endif
00294 # if !defined (EACCES)
00295 # define EACCES 13
00296 # endif
00297 # if !defined (EFAULT)
00298 # define EFAULT 14
00299 # endif
00300 # if !defined (EEXIST)
00301 # define EEXIST 17
00302 # endif
00303 # if !defined (ENOSPC)
00304 # define ENOSPC 28
00305 # endif
00306 # if !defined (EPIPE)
00307 # define EPIPE 32
00308 # endif
00309 # if !defined (ETIME)
00310 # define ETIME 62
00311 # endif
00312 # if !defined (ENAMETOOLONG)
00313 # define ENAMETOOLONG 78
00314 # endif
00315 # if !defined (ENOSYS)
00316 # define ENOSYS 89
00317 # endif
00318 # if !defined (EADDRINUSE)
00319 # define EADDRINUSE 125
00320 # endif
00321 # if !defined (ENETUNREACH)
00322 # define ENETUNREACH 128
00323 # endif
00324 # if !defined (EISCONN)
00325 # define EISCONN 133
00326 # endif
00327 # if !defined (ESHUTDOWN)
00328 # define ESHUTDOWN 143
00329 # endif
00330 # if !defined (ECONNREFUSED)
00331 # define ECONNREFUSED 146
00332 # endif
00333 # if !defined (EINPROGRESS)
00334 # define EINPROGRESS 150
00335 # endif
00336 # if !defined (ERRMAX)
00337 # define ERRMAX 151
00338 # endif
00339
00340 # if ! defined (NSIG)
00341 # define NSIG 32
00342 # endif
00343
00344 # if ! defined (TCP_NODELAY)
00345 # define TCP_NODELAY 1
00346 # endif
00347
00348
00349
00350 # define ACE_BITS_PER_ULONG (8 * sizeof (u_long))
00351
00352 typedef u_long ACE_idtype_t;
00353 typedef u_long ACE_id_t;
00354 # define ACE_SELF (0)
00355 typedef u_long ACE_pri_t;
00356
00357
00358 # if !defined (ACE_PSOS_DIAB_PPC)
00359 typedef XDIR ACE_DIR;
00360 # endif
00361
00362
00363 typedef struct
00364 {
00365
00366 u_long sema_;
00367
00368
00369 char name_[4];
00370 } ACE_sema_t;
00371
00372
00373 # if !defined (ACE_DEFAULT_SVC_CONF)
00374 # if (ACE_USES_CLASSIC_SVC_CONF == 1)
00375 # define ACE_DEFAULT_SVC_CONF "./svc.conf"
00376 # else
00377 # define ACE_DEFAULT_SVC_CONF "./svc.conf.xml"
00378 # endif
00379 # endif
00380
00381 # if !defined (ACE_DEFAULT_SEM_KEY)
00382 # define ACE_DEFAULT_SEM_KEY 1234
00383 # endif
00384
00385 # define ACE_STDIN 0
00386 # define ACE_STDOUT 1
00387 # define ACE_STDERR 2
00388
00389 # define ACE_DIRECTORY_SEPARATOR_STR_A "/"
00390 # define ACE_DIRECTORY_SEPARATOR_CHAR_A '/'
00391 # define ACE_PLATFORM_A "pSOS"
00392 # define ACE_PLATFORM_EXE_SUFFIX_A ""
00393
00394 # define ACE_DLL_SUFFIX ACE_LIB_TEXT (".so")
00395 # define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib")
00396 # define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("LD_LIBRARY_PATH")
00397 # define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (":")
00398 # define ACE_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon")
00399
00400 # define ACE_MAX_DEFAULT_PORT 65535
00401
00402 # if ! defined(MAXPATHLEN)
00403 # define MAXPATHLEN 1024
00404 # endif
00405
00406 # if ! defined(MAXNAMLEN)
00407 # define MAXNAMLEN 255
00408 # endif
00409
00410 # if defined (ACE_LACKS_MMAP)
00411 # define PROT_READ 0
00412 # define PROT_WRITE 0
00413 # define PROT_EXEC 0
00414 # define PROT_NONE 0
00415 # define PROT_RDWR 0
00416 # define MAP_PRIVATE 0
00417 # define MAP_SHARED 0
00418 # define MAP_FIXED 0
00419 # endif
00420
00421 typedef int ACE_exitcode;
00422
00423 typedef ACE_HANDLE ACE_SHLIB_HANDLE;
00424 # define ACE_SHLIB_INVALID_HANDLE ACE_INVALID_HANDLE
00425 # define ACE_DEFAULT_SHLIB_MODE 0
00426
00427 # define ACE_INVALID_SEM_KEY -1
00428
00429 struct hostent {
00430 char *h_name;
00431 char **h_aliases;
00432 int h_addrtype;
00433 int h_length;
00434 char **h_addr_list;
00435 # define h_addr h_addr_list[0]
00436 };
00437
00438 struct servent {
00439 char *s_name;
00440 char **s_aliases;
00441 int s_port;
00442 char *s_proto;
00443 };
00444
00445 # define ACE_SEH_TRY if (1)
00446 # define ACE_SEH_EXCEPT(X) while (0)
00447 # define ACE_SEH_FINALLY if (1)
00448
00449 # if !defined (LPSECURITY_ATTRIBUTES)
00450 # define LPSECURITY_ATTRIBUTES int
00451 # endif
00452 # if !defined (GENERIC_READ)
00453 # define GENERIC_READ 0
00454 # endif
00455 # if !defined (FILE_SHARE_READ)
00456 # define FILE_SHARE_READ 0
00457 # endif
00458 # if !defined (OPEN_EXISTING)
00459 # define OPEN_EXISTING 0
00460 # endif
00461 # if !defined (FILE_ATTRIBUTE_NORMAL)
00462 # define FILE_ATTRIBUTE_NORMAL 0
00463 # endif
00464 # if !defined (MAXIMUM_WAIT_OBJECTS)
00465 # define MAXIMUM_WAIT_OBJECTS 0
00466 # endif
00467 # if !defined (FILE_FLAG_OVERLAPPED)
00468 # define FILE_FLAG_OVERLAPPED 0
00469 # endif
00470 # if !defined (FILE_FLAG_SEQUENTIAL_SCAN)
00471 # define FILE_FLAG_SEQUENTIAL_SCAN 0
00472 # endif
00473 # if !defined(FILE_FLAG_WRITE_THROUGH)
00474 # define FILE_FLAG_WRITE_THROUGH 0
00475 # endif
00476 # if !defined(PIPE_WAIT)
00477 # define PIPE_WAIT 0
00478 # endif
00479 # if !defined(PIPE_NOWAIT)
00480 # define PIPE_NOWAIT 0
00481 # endif
00482 # if !defined(PIPE_READMODE_BYTE)
00483 # define PIPE_READMODE_BYTE 0
00484 # endif
00485 # if !defined(PIPE_READMODE_MESSAGE)
00486 # define PIPE_READMODE_MESSAGE 0
00487 # endif
00488 # if !defined(PIPE_TYPE_BYTE)
00489 # define PIPE_TYPE_BYTE 0
00490 # endif
00491 # if !defined(PIPE_TYPE_MESSAGE)
00492 # define PIPE_TYPE_MESSAGE 0
00493 # endif
00494
00495 struct ACE_OVERLAPPED
00496 {
00497 u_long Internal;
00498 u_long InternalHigh;
00499 u_long Offset;
00500 u_long OffsetHigh;
00501 ACE_HANDLE hEvent;
00502 };
00503
00504 # if !defined (USER_INCLUDE_SYS_TIME_TM)
00505 # if defined (ACE_PSOS_DIAB_PPC)
00506 typedef struct timespec timespec_t;
00507 # else
00508 typedef struct timespec
00509 {
00510 time_t tv_sec;
00511 long tv_nsec;
00512 } timespec_t;
00513 # endif
00514 # endif
00515
00516 #if defined (ACE_PSOS_HAS_TIME)
00517
00518
00519 class ACE_OS_Export ACE_PSOS_Time_t
00520 {
00521 public:
00522
00523 ACE_PSOS_Time_t (void);
00524
00525
00526 ACE_PSOS_Time_t (const timespec_t& t);
00527
00528
00529 operator timespec_t ();
00530
00531
00532 static u_long get_system_time (ACE_PSOS_Time_t& t);
00533
00534
00535 static u_long set_system_time (const ACE_PSOS_Time_t& t);
00536
00537 # if defined (ACE_PSOSIM)
00538
00539 static u_long init_simulator_time (void);
00540 # endif
00541
00542
00543 static const u_long max_ticks;
00544 private:
00545
00546 static const u_long year_mask;
00547 static const u_long month_mask;
00548 static const u_long day_mask;
00549 static const u_long hour_mask;
00550 static const u_long minute_mask;
00551 static const u_long second_mask;
00552 static const int year_shift;
00553 static const int month_shift;
00554 static const int hour_shift;
00555 static const int minute_shift;
00556 static const int year_origin;
00557 static const int month_origin;
00558
00559
00560 static const u_long err_notime;
00561 static const u_long err_illdate;
00562 static const u_long err_illtime;
00563 static const u_long err_illticks;
00564
00565
00566 u_long date_;
00567
00568
00569 u_long time_;
00570
00571
00572 u_long ticks_;
00573 } ;
00574 #endif
00575
00576 # endif
00577
00578 # if defined (ACE_HAS_CHARPTR_SPRINTF)
00579 # define ACE_SPRINTF_ADAPTER(X) ::strlen (X)
00580 # else
00581 # define ACE_SPRINTF_ADAPTER(X) X
00582 # endif
00583
00584
00585
00586 # if !defined (ACE_DEFAULT_BASE_ADDR)
00587 # define ACE_DEFAULT_BASE_ADDR ((char *) (64 * 1024 * 1024))
00588 # endif
00589
00590
00591
00592
00593 #if !defined (ACE_TIMER_SKEW)
00594 # define ACE_TIMER_SKEW 0
00595 #endif
00596
00597
00598 # if defined (ACE_HAS_PTHREADS)
00599 extern "C" {
00600 # define ACE_DONT_INCLUDE_ACE_SIGNAL_H
00601 # include <signal.h>
00602 # undef ACE_DONT_INCLUDE_ACE_SIGNAL_H
00603 # include <pthread.h>
00604 # if defined (DIGITAL_UNIX)
00605 # define pthread_self __pthread_self
00606 extern "C" pthread_t pthread_self (void);
00607 # endif
00608 }
00609 # if defined (HPUX_10)
00610
00611
00612 # include <dce/cma_sigwait.h>
00613 # endif
00614 # endif
00615
00616
00617
00618
00619
00620
00621 # if defined (ACE_HAS_PTHREADS_STD)
00622
00623 # if !defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R) && \
00624 !defined (ACE_HAS_STHREADS)
00625 # define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
00626 # endif
00627 # endif
00628
00629
00630
00631
00632 # if !defined(ACE_OS_TRACE)
00633 # define ACE_OS_TRACE(X)
00634 # endif
00635
00636 # if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
00637 (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
00638 using std::time_t;
00639 using std::tm;
00640 # if defined (ACE_WIN32)
00641 using std::_timezone;
00642 # else
00643 using std::timezone;
00644 # endif
00645 using std::difftime;
00646 # endif
00647
00648 # if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T))
00649 typedef int clockid_t;
00650 # if !defined (CLOCK_REALTIME)
00651 # define CLOCK_REALTIME 0
00652 # endif
00653 # endif
00654
00655 #if !defined (E2BIG)
00656 # define E2BIG 7
00657 #endif
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668 class ACE_OS_Export ACE_Countdown_Time
00669 {
00670 public:
00671
00672
00673 ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
00674
00675
00676 ~ACE_Countdown_Time (void);
00677
00678
00679 int start (void);
00680
00681
00682
00683 int stop (void);
00684
00685
00686
00687 int update (void);
00688
00689
00690 int stopped (void) const;
00691
00692 private:
00693
00694 ACE_Time_Value *max_wait_time_;
00695
00696
00697 ACE_Time_Value start_time_;
00698
00699
00700 int stopped_;
00701 };
00702
00703 # if defined (ACE_HAS_USING_KEYWORD)
00704 # define ACE_USING using
00705 # else
00706 # define ACE_USING
00707 # endif
00708
00709 # if defined (ACE_HAS_TYPENAME_KEYWORD)
00710 # define ACE_TYPENAME typename
00711 # else
00712 # define ACE_TYPENAME
00713 # endif
00714
00715 # if defined (ACE_HAS_STD_TEMPLATE_SPECIALIZATION)
00716 # define ACE_TEMPLATE_SPECIALIZATION template<>
00717 # else
00718 # define ACE_TEMPLATE_SPECIALIZATION
00719 # endif
00720
00721 # if defined (ACE_HAS_STD_TEMPLATE_METHOD_SPECIALIZATION)
00722 # define ACE_TEMPLATE_METHOD_SPECIALIZATION template<>
00723 # else
00724 # define ACE_TEMPLATE_METHOD_SPECIALIZATION
00725 # endif
00726
00727
00728
00729
00730
00731
00732 # if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
00733
00734
00735 # define ACE_SYNCH_DECL class _ACE_SYNCH
00736 # define ACE_SYNCH_USE _ACE_SYNCH
00737 # define ACE_SYNCH_MUTEX_T ACE_TYPENAME _ACE_SYNCH::MUTEX
00738 # define ACE_SYNCH_CONDITION_T ACE_TYPENAME _ACE_SYNCH::CONDITION
00739 # define ACE_SYNCH_SEMAPHORE_T ACE_TYPENAME _ACE_SYNCH::SEMAPHORE
00740
00741
00742 # define ACE_MEM_POOL_1 class _ACE_MEM_POOL
00743 # define ACE_MEM_POOL_2 _ACE_MEM_POOL
00744 # define ACE_MEM_POOL _ACE_MEM_POOL
00745 # define ACE_MEM_POOL_OPTIONS ACE_TYPENAME _ACE_MEM_POOL::OPTIONS
00746
00747
00748 # define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM
00749 # define ACE_PEER_STREAM_2 _ACE_PEER_STREAM
00750 # define ACE_PEER_STREAM _ACE_PEER_STREAM
00751 # define ACE_PEER_STREAM_ADDR ACE_TYPENAME _ACE_PEER_STREAM::PEER_ADDR
00752
00753
00754 # define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR
00755 # define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR
00756 # define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
00757 # define ACE_PEER_ACCEPTOR_ADDR ACE_TYPENAME _ACE_PEER_ACCEPTOR::PEER_ADDR
00758
00759
00760 # define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR
00761 # define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR
00762 # define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
00763 # define ACE_PEER_CONNECTOR_ADDR ACE_TYPENAME _ACE_PEER_CONNECTOR::PEER_ADDR
00764 # if !defined(ACE_HAS_TYPENAME_KEYWORD)
00765 # define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any
00766 # else
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785 # define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_ADDR_TYPEDEF::sap_any
00786 # endif
00787
00788
00789 # define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor
00790 # define ACE_SOCK_CONNECTOR ACE_SOCK_Connector
00791 # define ACE_SOCK_STREAM ACE_SOCK_Stream
00792
00793
00794 # define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor
00795 # define ACE_MEM_CONNECTOR ACE_MEM_Connector
00796 # define ACE_MEM_STREAM ACE_MEM_Stream
00797
00798
00799 # define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor
00800 # define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector
00801 # define ACE_LSOCK_STREAM ACE_LSOCK_Stream
00802
00803
00804 # define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor
00805 # define ACE_TLI_CONNECTOR ACE_TLI_Connector
00806 # define ACE_TLI_STREAM ACE_TLI_Stream
00807
00808
00809 # define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor
00810 # define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector
00811 # define ACE_SPIPE_STREAM ACE_SPIPE_Stream
00812
00813
00814 # define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor
00815 # define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector
00816 # define ACE_UPIPE_STREAM ACE_UPIPE_Stream
00817
00818
00819 # define ACE_FILE_CONNECTOR ACE_FILE_Connector
00820 # define ACE_FILE_STREAM ACE_FILE_IO
00821
00822
00823 # define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool
00824 # define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool
00825 # define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool
00826 # define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool
00827 # define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool
00828 # define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool
00829
00830 # else
00831
00832
00833 # if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE)
00834 # define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T, class _ACE_SYNCH_SEMAPHORE_T
00835 # define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T, _ACE_SYNCH_SEMAPHORE_T
00836 # else
00837 # define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T
00838 # define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T
00839 # endif
00840 # define ACE_SYNCH_MUTEX_T _ACE_SYNCH_MUTEX_T
00841 # define ACE_SYNCH_CONDITION_T _ACE_SYNCH_CONDITION_T
00842 # define ACE_SYNCH_SEMAPHORE_T _ACE_SYNCH_SEMAPHORE_T
00843
00844
00845 # define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS
00846 # define ACE_MEM_POOL_2 _ACE_MEM_POOL, _ACE_MEM_POOL_OPTIONS
00847 # define ACE_MEM_POOL _ACE_MEM_POOL
00848 # define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL_OPTIONS
00849
00850
00851 # define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM, class _ACE_PEER_ADDR
00852 # define ACE_PEER_STREAM_2 _ACE_PEER_STREAM, _ACE_PEER_ADDR
00853 # define ACE_PEER_STREAM _ACE_PEER_STREAM
00854 # define ACE_PEER_STREAM_ADDR _ACE_PEER_ADDR
00855
00856
00857 # define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR, class _ACE_PEER_ADDR
00858 # define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR, _ACE_PEER_ADDR
00859 # define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR
00860 # define ACE_PEER_ACCEPTOR_ADDR _ACE_PEER_ADDR
00861
00862
00863 # define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR
00864 # define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR
00865 # define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR
00866 # define ACE_PEER_CONNECTOR_ADDR _ACE_PEER_ADDR
00867 # define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any
00868
00869
00870 # define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr
00871 # define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr
00872 # define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr
00873
00874
00875 # define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, ACE_MEM_Addr
00876 # define ACE_MEM_CONNECTOR ACE_MEM_Connector, ACE_INET_Addr
00877 # define ACE_MEM_STREAM ACE_MEM_Stream, ACE_INET_Addr
00878
00879
00880 # define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor, ACE_UNIX_Addr
00881 # define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector, ACE_UNIX_Addr
00882 # define ACE_LSOCK_STREAM ACE_LSOCK_Stream, ACE_UNIX_Addr
00883
00884
00885 # define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr
00886 # define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr
00887 # define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr
00888
00889
00890 # define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr
00891 # define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr
00892 # define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr
00893
00894
00895 # define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr
00896 # define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr
00897 # define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr
00898
00899
00900 # define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr
00901 # define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr
00902
00903
00904 # define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
00905 # define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options
00906 # define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool, ACE_Sbrk_Memory_Pool_Options
00907 # define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool, ACE_Shared_Memory_Pool_Options
00908 # define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options
00909 # define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool, ACE_Pagefile_Memory_Pool_Options
00910 # endif
00911
00912
00913
00914 # define ACE_SYNCH_1 ACE_SYNCH_DECL
00915 # define ACE_SYNCH_2 ACE_SYNCH_USE
00916
00917
00918 # if !defined (ACE_WSOCK_VERSION)
00919 # define ACE_WSOCK_VERSION 0, 0
00920 # endif
00921
00922 # if defined (ACE_HAS_BROKEN_CTIME)
00923 # undef ctime
00924 # endif
00925
00926
00927
00928
00929 typedef void (*ACE_Service_Object_Exterminator)(void *);
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962 # define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS) \
00963 extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ;
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983 #define ACE_STATIC_SVC_DECLARE_EXPORT(EXPORT_NAME,SERVICE_CLASS) \
00984 extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS;
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016 #define ACE_STATIC_SVC_DEFINE(SERVICE_CLASS, NAME, TYPE, FN, FLAGS, ACTIVE) \
01017 ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS, ACTIVE };
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036 #if defined(ACE_LACKS_STATIC_CONSTRUCTORS)
01037 # define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
01038 class ACE_Static_Svc_##SERVICE_CLASS {\
01039 public:\
01040 ACE_Static_Svc_##SERVICE_CLASS() { \
01041 ACE_Service_Config::static_svcs ()->insert (\
01042 &ace_svc_desc_##SERVICE_CLASS); \
01043 } \
01044 };
01045 #define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS)\
01046 ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS
01047
01048 #else
01049
01050 # define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
01051 class ACE_Static_Svc_##SERVICE_CLASS {\
01052 public:\
01053 ACE_Static_Svc_##SERVICE_CLASS() { \
01054 ACE_Service_Config::static_svcs ()->insert (\
01055 &ace_svc_desc_##SERVICE_CLASS); \
01056 } \
01057 };\
01058 static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
01059 #define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS) do {} while (0)
01060
01061 #endif
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079 #define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \
01080 extern "C" CLS##_Export ACE_Service_Object *\
01081 _make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *);
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097 # define ACE_Local_Service_Export
01098
01099 # define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \
01100 void _gobble_##SERVICE_CLASS (void *p) { \
01101 ACE_Service_Object *_p = ACE_static_cast (ACE_Service_Object *, p); \
01102 ACE_ASSERT (_p != 0); \
01103 delete _p; } \
01104 extern "C" CLS##_Export ACE_Service_Object *\
01105 _make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \
01106 { \
01107 ACE_TRACE (#SERVICE_CLASS); \
01108 if (gobbler != 0) \
01109 *gobbler = (ACE_Service_Object_Exterminator) _gobble_##SERVICE_CLASS; \
01110 return new SERVICE_CLASS; \
01111 }
01112
01113
01114 #define ACE_SVC_NAME(SERVICE_CLASS) _make_##SERVICE_CLASS
01115
01116
01117
01118 #define ACE_SVC_INVOKE(SERVICE_CLASS) _make_##SERVICE_CLASS (0)
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129 # define ACE_SVC_FACTORY_DECLARE(X) ACE_FACTORY_DECLARE (ACE_Svc, X)
01130 # define ACE_SVC_FACTORY_DEFINE(X) ACE_FACTORY_DEFINE (ACE_Svc, X)
01131
01132
01133 # if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
01134 # define ACE_TSS_TYPE(T) ACE_TSS< T >
01135 # if defined (ACE_HAS_BROKEN_CONVERSIONS)
01136 # define ACE_TSS_GET(I, T) (*(I))
01137 # else
01138 # define ACE_TSS_GET(I, T) ((I)->operator T * ())
01139 # endif
01140 # else
01141 # define ACE_TSS_TYPE(T) T
01142 # define ACE_TSS_GET(I, T) (I)
01143 # endif
01144
01145 # if defined (ACE_LACKS_MODE_MASKS)
01146
01147
01148
01149
01150 # if !defined (ACE_HAS_USER_MODE_MASKS)
01151 # define S_IRWXU 00700
01152 # define S_IRUSR 00400
01153 # define S_IWUSR 00200
01154 # define S_IXUSR 00100
01155 # endif
01156 # define S_IRWXG 00070
01157 # define S_IRGRP 00040
01158 # define S_IWGRP 00020
01159 # define S_IXGRP 00010
01160 # define S_IRWXO 00007
01161 # define S_IROTH 00004
01162 # define S_IWOTH 00002
01163 # define S_IXOTH 00001
01164
01165
01166
01167 # if defined (ACE_HAS_WINCE)
01168 # define S_IFDIR 0040000
01169 # define S_IFREG 0100000
01170 # endif
01171 # endif
01172
01173 # if defined (ACE_LACKS_SEMBUF_T)
01174 struct sembuf
01175 {
01176
01177 unsigned short sem_num;
01178
01179
01180 short sem_op;
01181
01182
01183 short sem_flg;
01184 };
01185 # endif
01186
01187 # if defined (ACE_LACKS_MSGBUF_T)
01188 struct msgbuf {};
01189 # endif
01190
01191 # if defined (ACE_LACKS_STRRECVFD)
01192 struct strrecvfd {};
01193 # endif
01194
01195 # if defined (ACE_HAS_PROC_FS)
01196 # include <sys/procfs.h>
01197 # endif
01198
01199 # if defined(__rtems__)
01200 struct iovec {
01201
01202 char *iov_base;
01203
01204 size_t iov_len;
01205 };
01206 # endif
01207
01208 # if defined (ACE_HAS_BROKEN_WRITEV)
01209 typedef struct iovec ACE_WRITEV_TYPE;
01210 # else
01211 typedef const struct iovec ACE_WRITEV_TYPE;
01212 # endif
01213
01214 # if defined (ACE_HAS_BROKEN_READV)
01215 typedef const struct iovec ACE_READV_TYPE;
01216 # else
01217 typedef struct iovec ACE_READV_TYPE;
01218 # endif
01219
01220 # if defined (ACE_HAS_BROKEN_SETRLIMIT)
01221 typedef struct rlimit ACE_SETRLIMIT_TYPE;
01222 # else
01223 typedef const struct rlimit ACE_SETRLIMIT_TYPE;
01224 # endif
01225
01226 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
01227 # define ACE_MT(X) X
01228 # if !defined (_REENTRANT)
01229 # define _REENTRANT
01230 # endif
01231 # else
01232 # define ACE_MT(X)
01233 # endif
01234
01235 # if !defined (ACE_DEFAULT_THREAD_PRIORITY)
01236 # define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L)
01237 # endif
01238
01239 # if defined (ACE_HAS_POSIX_SEM)
01240 # include <semaphore.h>
01241 # if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM)
01242 # define SEM_FAILED ((sem_t *) -1)
01243 # endif
01244
01245 typedef struct
01246 {
01247
01248
01249
01250 sem_t *sema_;
01251
01252
01253
01254 char *name_;
01255
01256 # if defined (ACE_LACKS_NAMED_POSIX_SEM)
01257
01258
01259
01260 int new_sema_;
01261 # endif
01262 } ACE_sema_t;
01263 # endif
01264
01265 struct cancel_state
01266 {
01267
01268
01269 int cancelstate;
01270
01271
01272 int canceltype;
01273 };
01274
01275 # if defined (ACE_HAS_WINCE)
01276 # include <types.h>
01277
01278 # if (_WIN32_WCE < 400)
01279 typedef unsigned long ptrdiff_t;
01280 # else
01281 # include <stddef.h> // WinCE .NET puts it in stddef.h
01282 # endif
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298 typedef unsigned int dev_t;
01299
01300 struct stat
01301 {
01302
01303 dev_t st_dev;
01304
01305
01306 dev_t st_rdev;
01307
01308
01309 unsigned short st_mode;
01310
01311
01312 short st_nlink;
01313
01314
01315 ACE_Time_Value st_atime;
01316
01317
01318 ACE_Time_Value st_mtime;
01319
01320
01321 ACE_Time_Value st_ctime;
01322
01323
01324 off_t st_size;
01325
01326
01327
01328
01329 };
01330
01331 # else
01332 # if defined (ACE_LACKS_SYS_TYPES_H) \
01333 || (defined (__GLIBC__) && !defined (_BSD_SOURCE))
01334 # if ! defined (ACE_PSOS)
01335 typedef unsigned char u_char;
01336 typedef unsigned short u_short;
01337 typedef unsigned int u_int;
01338 typedef unsigned long u_long;
01339
01340 typedef unsigned char uchar_t;
01341 typedef unsigned short ushort_t;
01342 typedef unsigned int uint_t;
01343 typedef unsigned long ulong_t;
01344 # endif
01345 # else
01346 # include <sys/types.h>
01347 # endif
01348
01349 # if ! defined (ACE_PSOS)
01350 # include <sys/stat.h>
01351 # endif
01352 # endif
01353
01354
01355 #if defined (ACE_HAS_NO_THROW_SPEC)
01356 # define ACE_THROW_SPEC(X)
01357 #else
01358 # if defined (ACE_HAS_EXCEPTIONS)
01359 # define ACE_THROW_SPEC(X) throw X
01360 # if defined (ACE_WIN32) && defined(_MSC_VER) && !defined (ghs)
01361
01362
01363 # pragma warning( disable : 4290 )
01364 # endif
01365 # else
01366 # define ACE_THROW_SPEC(X)
01367 # endif
01368 #endif
01369
01370 #if !defined (ACE_LACKS_UNISTD_H)
01371 # include <unistd.h>
01372 #endif
01373
01374 #if defined (ACE_HAS_PRIOCNTL)
01375
01376
01377 # if defined (sun)
01378 # include <thread.h>
01379 # endif
01380
01381
01382 # include <sys/rtpriocntl.h>
01383 # include <sys/tspriocntl.h>
01384 #endif
01385
01386 # if defined (ACE_HAS_THREADS)
01387
01388 # if defined (ACE_HAS_STHREADS)
01389 # include <synch.h>
01390 # include <thread.h>
01391 # define ACE_SCOPE_PROCESS P_PID
01392 # define ACE_SCOPE_LWP P_LWPID
01393 # define ACE_SCOPE_THREAD (ACE_SCOPE_LWP + 1)
01394 # else
01395 # define ACE_SCOPE_PROCESS 0
01396 # define ACE_SCOPE_LWP 1
01397 # define ACE_SCOPE_THREAD 2
01398 # endif
01399
01400 # if !defined (ACE_HAS_PTHREADS)
01401 # define ACE_SCHED_OTHER 0
01402 # define ACE_SCHED_FIFO 1
01403 # define ACE_SCHED_RR 2
01404 # endif
01405
01406 # if defined (ACE_HAS_PTHREADS)
01407 # define ACE_SCHED_OTHER SCHED_OTHER
01408 # define ACE_SCHED_FIFO SCHED_FIFO
01409 # define ACE_SCHED_RR SCHED_RR
01410
01411
01412
01413 # if defined (ACE_HAS_PTHREADS_DRAFT6)
01414 # define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL
01415 # define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL
01416 # define PTHREAD_CREATE_UNDETACHED 0
01417 # define PTHREAD_CREATE_DETACHED 1
01418 # define PTHREAD_CREATE_JOINABLE 0
01419 # define PTHREAD_EXPLICIT_SCHED 0
01420 # define PTHREAD_MIN_PRIORITY 0
01421 # define PTHREAD_MAX_PRIORITY 126
01422 # endif
01423
01424
01425
01426
01427
01428
01429
01430
01431 # if defined (_POSIX_PRIORITY_SCHEDULING) && \
01432 !defined(_UNICOS) && !defined(UNIXWARE_7_1)
01433 # define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO))
01434 # define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR))
01435 # if defined (HPUX)
01436
01437
01438
01439
01440
01441 # define ACE_PROC_PRI_OTHER_MIN \
01442 (sched_get_priority_min(SCHED_OTHER))
01443 # else
01444 # define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER))
01445 # endif
01446 # else
01447
01448 # define ACE_PROC_PRI_FIFO_MIN 0
01449 # define ACE_PROC_PRI_RR_MIN 0
01450 # define ACE_PROC_PRI_OTHER_MIN 0
01451 # endif
01452
01453 # if defined (_POSIX_PRIORITY_SCHEDULING) && !defined(UNIXWARE_7_1)
01454 # define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO))
01455 # define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR))
01456 # if defined (HPUX)
01457 # define ACE_PROC_PRI_OTHER_MAX \
01458 (sched_get_priority_max(SCHED_OTHER))
01459 # else
01460 # define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER))
01461 # endif
01462 # else
01463 # define ACE_PROC_PRI_FIFO_MAX 59
01464 # define ACE_PROC_PRI_RR_MAX 59
01465 # define ACE_PROC_PRI_OTHER_MAX 59
01466 # endif
01467
01468 # if !defined(ACE_PROC_PRI_FIFO_DEF)
01469 # define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2)
01470 # endif
01471 # if !defined(ACE_PROC_PRI_RR_DEF)
01472 # define ACE_PROC_PRI_RR_DEF (ACE_PROC_PRI_RR_MIN + (ACE_PROC_PRI_RR_MAX - ACE_PROC_PRI_RR_MIN)/2)
01473 # endif
01474 # if !defined(ACE_PROC_PRI_OTHER_DEF)
01475 # define ACE_PROC_PRI_OTHER_DEF (ACE_PROC_PRI_OTHER_MIN + (ACE_PROC_PRI_OTHER_MAX - ACE_PROC_PRI_OTHER_MIN)/2)
01476 # endif
01477
01478
01479 # if defined(PRI_FIFO_MIN) && defined(PRI_FIFO_MAX) && defined(PRI_RR_MIN) && defined(PRI_RR_MAX) && defined(PRI_OTHER_MIN) && defined(PRI_OTHER_MAX)
01480 # if !defined (ACE_THR_PRI_FIFO_MIN)
01481 # define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN
01482 # endif
01483 # if !defined (ACE_THR_PRI_FIFO_MAX)
01484 # define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX
01485 # endif
01486 # if !defined (ACE_THR_PRI_RR_MIN)
01487 # define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN
01488 # endif
01489 # if !defined (ACE_THR_PRI_RR_MAX)
01490 # define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX
01491 # endif
01492 # if !defined (ACE_THR_PRI_OTHER_MIN)
01493 # define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN
01494 # endif
01495 # if !defined (ACE_THR_PRI_OTHER_MAX)
01496 # define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX
01497 # endif
01498 # elif defined (AIX)
01499
01500
01501
01502
01503
01504 # if !defined (ACE_THR_PRI_FIFO_MIN)
01505 # define ACE_THR_PRI_FIFO_MIN (long) 1
01506 # endif
01507 # if !defined (ACE_THR_PRI_FIFO_MAX)
01508 # define ACE_THR_PRI_FIFO_MAX (long) 127
01509 # endif
01510 # if !defined (ACE_THR_PRI_RR_MIN)
01511 # define ACE_THR_PRI_RR_MIN (long) 1
01512 # endif
01513 # if !defined (ACE_THR_PRI_RR_MAX)
01514 # define ACE_THR_PRI_RR_MAX (long) 127
01515 # endif
01516 # if !defined (ACE_THR_PRI_OTHER_MIN)
01517 # define ACE_THR_PRI_OTHER_MIN (long) 1
01518 # endif
01519 # if !defined (ACE_THR_PRI_OTHER_MAX)
01520 # define ACE_THR_PRI_OTHER_MAX (long) 127
01521 # endif
01522 # elif defined (sun)
01523 # if !defined (ACE_THR_PRI_FIFO_MIN)
01524 # define ACE_THR_PRI_FIFO_MIN (long) 0
01525 # endif
01526 # if !defined (ACE_THR_PRI_FIFO_MAX)
01527 # define ACE_THR_PRI_FIFO_MAX (long) 59
01528 # endif
01529 # if !defined (ACE_THR_PRI_RR_MIN)
01530 # define ACE_THR_PRI_RR_MIN (long) 0
01531 # endif
01532 # if !defined (ACE_THR_PRI_RR_MAX)
01533 # define ACE_THR_PRI_RR_MAX (long) 59
01534 # endif
01535 # if !defined (ACE_THR_PRI_OTHER_MIN)
01536 # define ACE_THR_PRI_OTHER_MIN (long) 0
01537 # endif
01538 # if !defined (ACE_THR_PRI_OTHER_MAX)
01539 # define ACE_THR_PRI_OTHER_MAX (long) 127
01540 # endif
01541 # else
01542 # if !defined (ACE_THR_PRI_FIFO_MIN)
01543 # define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN
01544 # endif
01545 # if !defined (ACE_THR_PRI_FIFO_MAX)
01546 # define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX
01547 # endif
01548 # if !defined (ACE_THR_PRI_RR_MIN)
01549 # define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN
01550 # endif
01551 # if !defined (ACE_THR_PRI_RR_MAX)
01552 # define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX
01553 # endif
01554 # if !defined (ACE_THR_PRI_OTHER_MIN)
01555 # define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN
01556 # endif
01557 # if !defined (ACE_THR_PRI_OTHER_MAX)
01558 # define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX
01559 # endif
01560 # endif
01561 # if !defined(ACE_THR_PRI_FIFO_DEF)
01562 # define ACE_THR_PRI_FIFO_DEF ((ACE_THR_PRI_FIFO_MIN + ACE_THR_PRI_FIFO_MAX)/2)
01563 # endif
01564 # if !defined(ACE_THR_PRI_RR_DEF)
01565 # define ACE_THR_PRI_RR_DEF ((ACE_THR_PRI_RR_MIN + ACE_THR_PRI_RR_MAX)/2)
01566 # endif
01567 # if !defined(ACE_THR_PRI_OTHER_DEF)
01568 # define ACE_THR_PRI_OTHER_DEF ((ACE_THR_PRI_OTHER_MIN + ACE_THR_PRI_OTHER_MAX)/2)
01569 # endif
01570
01571
01572 typedef pthread_t ACE_hthread_t;
01573 typedef pthread_t ACE_thread_t;
01574
01575 # if defined (ACE_HAS_TSS_EMULATION)
01576 typedef pthread_key_t ACE_OS_thread_key_t;
01577 typedef u_long ACE_thread_key_t;
01578 # else
01579 typedef pthread_key_t ACE_thread_key_t;
01580 # endif
01581
01582 # if !defined (ACE_LACKS_COND_T)
01583 typedef pthread_mutex_t ACE_mutex_t;
01584 typedef pthread_cond_t ACE_cond_t;
01585 typedef pthread_condattr_t ACE_condattr_t;
01586 typedef pthread_mutexattr_t ACE_mutexattr_t;
01587 # endif
01588 typedef pthread_mutex_t ACE_thread_mutex_t;
01589
01590 # if !defined (PTHREAD_CANCEL_DISABLE)
01591 # define PTHREAD_CANCEL_DISABLE 0
01592 # endif
01593
01594 # if !defined (PTHREAD_CANCEL_ENABLE)
01595 # define PTHREAD_CANCEL_ENABLE 0
01596 # endif
01597
01598 # if !defined (PTHREAD_CANCEL_DEFERRED)
01599 # define PTHREAD_CANCEL_DEFERRED 0
01600 # endif
01601
01602 # if !defined (PTHREAD_CANCEL_ASYNCHRONOUS)
01603 # define PTHREAD_CANCEL_ASYNCHRONOUS 0
01604 # endif
01605
01606 # define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
01607 # define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
01608 # define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
01609 # define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
01610
01611 # if !defined (PTHREAD_CREATE_JOINABLE)
01612 # if defined (PTHREAD_CREATE_UNDETACHED)
01613 # define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED
01614 # else
01615 # define PTHREAD_CREATE_JOINABLE 0
01616 # endif
01617 # endif
01618
01619 # if !defined (PTHREAD_CREATE_DETACHED)
01620 # define PTHREAD_CREATE_DETACHED 1
01621 # endif
01622
01623 # if !defined (PTHREAD_PROCESS_PRIVATE) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM)
01624 # if defined (PTHREAD_MUTEXTYPE_FAST)
01625 # define PTHREAD_PROCESS_PRIVATE PTHREAD_MUTEXTYPE_FAST
01626 # else
01627 # define PTHREAD_PROCESS_PRIVATE 0
01628 # endif
01629 # endif
01630
01631 # if !defined (PTHREAD_PROCESS_SHARED) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM)
01632 # if defined (PTHREAD_MUTEXTYPE_FAST)
01633 # define PTHREAD_PROCESS_SHARED PTHREAD_MUTEXTYPE_FAST
01634 # else
01635 # define PTHREAD_PROCESS_SHARED 1
01636 # endif
01637 # endif
01638
01639 # if defined (ACE_HAS_PTHREADS_DRAFT4)
01640 # if defined (PTHREAD_PROCESS_PRIVATE)
01641 # if !defined (USYNC_THREAD)
01642 # define USYNC_THREAD PTHREAD_PROCESS_PRIVATE
01643 # endif
01644 # else
01645 # if !defined (USYNC_THREAD)
01646 # define USYNC_THREAD MUTEX_NONRECURSIVE_NP
01647 # endif
01648 # endif
01649
01650 # if defined (PTHREAD_PROCESS_SHARED)
01651 # if !defined (USYNC_PROCESS)
01652 # define USYNC_PROCESS PTHREAD_PROCESS_SHARED
01653 # endif
01654 # else
01655 # if !defined (USYNC_PROCESS)
01656 # define USYNC_PROCESS MUTEX_NONRECURSIVE_NP
01657 # endif
01658 # endif
01659 # elif !defined (ACE_HAS_STHREADS)
01660 # if !defined (USYNC_THREAD)
01661 # define USYNC_THREAD PTHREAD_PROCESS_PRIVATE
01662 # endif
01663 # if !defined (USYNC_PROCESS)
01664 # define USYNC_PROCESS PTHREAD_PROCESS_SHARED
01665 # endif
01666 # endif
01667
01668
01669 #undef THR_BOUND
01670 #undef THR_NEW_LWP
01671 #undef THR_DETACHED
01672 #undef THR_SUSPENDED
01673 #undef THR_DAEMON
01674
01675 # define THR_BOUND 0x00000001
01676 # if defined (CHORUS)
01677 # define THR_NEW_LWP 0x00000000
01678 # else
01679 # define THR_NEW_LWP 0x00000002
01680 # endif
01681 # define THR_DETACHED 0x00000040
01682 # define THR_SUSPENDED 0x00000080
01683 # define THR_DAEMON 0x00000100
01684 # define THR_JOINABLE 0x00010000
01685 # define THR_SCHED_FIFO 0x00020000
01686 # define THR_SCHED_RR 0x00040000
01687 # define THR_SCHED_DEFAULT 0x00080000
01688
01689 # if defined (ACE_HAS_IRIX62_THREADS)
01690 # define THR_SCOPE_SYSTEM 0x00100000
01691 # else
01692 # define THR_SCOPE_SYSTEM THR_BOUND
01693 #endif
01694
01695 # define THR_SCOPE_PROCESS 0x00200000
01696 # define THR_INHERIT_SCHED 0x00400000
01697 # define THR_EXPLICIT_SCHED 0x00800000
01698 # define THR_SCHED_IO 0x01000000
01699
01700 # if !defined (ACE_HAS_STHREADS)
01701 # if !defined (ACE_HAS_POSIX_SEM)
01702
01703
01704
01705
01706
01707
01708
01709 class ACE_OS_Export ACE_sema_t
01710 {
01711 friend class ACE_OS;
01712 protected:
01713
01714 ACE_mutex_t lock_;
01715
01716
01717 ACE_cond_t count_nonzero_;
01718
01719
01720 u_long count_;
01721
01722
01723 u_long waiters_;
01724 };
01725 # endif
01726
01727 # if defined (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD)
01728
01729
01730 # if !defined (ACE_LACKS_RWLOCK_T)
01731 # include <synch.h>
01732 typedef rwlock_t ACE_rwlock_t;
01733 # endif
01734 # include <thread.h>
01735 # endif
01736
01737 # else
01738 # if !defined (ACE_HAS_POSIX_SEM)
01739 typedef sema_t ACE_sema_t;
01740 # endif
01741 # endif
01742 # elif defined (ACE_HAS_STHREADS)
01743
01744
01745 typedef thread_t ACE_thread_t;
01746 typedef thread_key_t ACE_thread_key_t;
01747 typedef mutex_t ACE_mutex_t;
01748 # if !defined (ACE_LACKS_RWLOCK_T)
01749 typedef rwlock_t ACE_rwlock_t;
01750 # endif
01751 # if !defined (ACE_HAS_POSIX_SEM)
01752 typedef sema_t ACE_sema_t;
01753 # endif
01754
01755 typedef cond_t ACE_cond_t;
01756 struct ACE_OS_Export ACE_condattr_t
01757 {
01758 int type;
01759 };
01760 struct ACE_OS_Export ACE_mutexattr_t
01761 {
01762 int type;
01763 };
01764 typedef ACE_thread_t ACE_hthread_t;
01765 typedef ACE_mutex_t ACE_thread_mutex_t;
01766
01767 # define THR_CANCEL_DISABLE 0
01768 # define THR_CANCEL_ENABLE 0
01769 # define THR_CANCEL_DEFERRED 0
01770 # define THR_CANCEL_ASYNCHRONOUS 0
01771 # define THR_JOINABLE 0
01772 # define THR_SCHED_FIFO 0
01773 # define THR_SCHED_RR 0
01774 # define THR_SCHED_DEFAULT 0
01775
01776 # elif defined (ACE_PSOS)
01777
01778
01779
01780
01781 typedef u_long ACE_mutex_t;
01782 typedef u_long ACE_thread_mutex_t;
01783 typedef u_long ACE_thread_t;
01784 typedef u_long ACE_hthread_t;
01785
01786 #if defined (ACE_PSOS_HAS_COND_T)
01787 typedef u_long ACE_cond_t;
01788 typedef u_long ACE_condattr_t;
01789 struct ACE_OS_Export ACE_mutexattr_t
01790 {
01791 int type;
01792 };
01793 #endif
01794
01795
01796
01797 # define PSOS_TASK_REG_TSS 0
01798 # define PSOS_TASK_REG_MAX 7
01799
01800 # define PSOS_TASK_MIN_PRIORITY 1
01801 # define PSOS_TASK_MAX_PRIORITY 239
01802
01803
01804
01805
01806
01807 # if defined (ACE_PSOS_HAS_TSS)
01808 typedef u_long ACE_thread_key_t;
01809 # else
01810 typedef u_int ACE_thread_key_t;
01811 # endif
01812
01813 # define THR_CANCEL_DISABLE 0
01814 # define THR_CANCEL_ENABLE 0
01815 # define THR_CANCEL_DEFERRED 0
01816 # define THR_CANCEL_ASYNCHRONOUS 0
01817
01818 # define THR_BOUND 0
01819 # define THR_NEW_LWP 0
01820 # define THR_DETACHED 0
01821 # define THR_SUSPENDED 0
01822 # define THR_DAEMON 0
01823 # define THR_JOINABLE 0
01824
01825 # define THR_SCHED_FIFO 0
01826 # define THR_SCHED_RR 0
01827 # define THR_SCHED_DEFAULT 0
01828 # define USYNC_THREAD T_LOCAL
01829 # define USYNC_PROCESS T_GLOBAL
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847 # elif defined (VXWORKS)
01848
01849
01850 # include <semLib.h>
01851
01852 # include <envLib.h>
01853 # include <hostLib.h>
01854 # include <ioLib.h>
01855 # include <remLib.h>
01856 # include <selectLib.h>
01857 # include <sigLib.h>
01858 # include <sockLib.h>
01859 # include <sysLib.h>
01860 # include <taskLib.h>
01861 # include <taskHookLib.h>
01862 # include <inetLib.h>
01863 extern "C"
01864 struct sockaddr_un {
01865 short sun_family;
01866 char sun_path[108];
01867 };
01868
01869 # define MAXNAMLEN 255
01870 # define NSIG (_NSIGS + 1)
01871
01872
01873
01874 # define VX_UNBREAKABLE 0x0002
01875 # define VX_FP_TASK 0x0008
01876 # define VX_PRIVATE_ENV 0x0080
01877 # define VX_NO_STACK_FILL 0x0100
01878
01879
01880 # define THR_CANCEL_DISABLE 0
01881 # define THR_CANCEL_ENABLE 0
01882 # define THR_CANCEL_DEFERRED 0
01883 # define THR_CANCEL_ASYNCHRONOUS 0
01884 # define THR_BOUND 0
01885 # define THR_NEW_LWP 0
01886 # define THR_DETACHED 0
01887 # define THR_SUSPENDED 0
01888 # define THR_DAEMON 0
01889 # define THR_JOINABLE 0
01890 # define THR_SCHED_FIFO 0
01891 # define THR_SCHED_RR 0
01892 # define THR_SCHED_DEFAULT 0
01893 # define THR_INHERIT_SCHED 0
01894 # define THR_EXPLICIT_SCHED 0
01895 # define THR_SCHED_IO 0
01896 # define THR_SCOPE_SYSTEM 0
01897 # define THR_SCOPE_PROCESS 0
01898 # define USYNC_THREAD 0
01899 # define USYNC_PROCESS 1
01900
01901
01902 # if !defined (ACE_DEFAULT_SYNCH_TYPE)
01903
01904
01905
01906 # define ACE_DEFAULT_SYNCH_TYPE SEM_Q_FIFO
01907 # endif
01908
01909 typedef SEM_ID ACE_mutex_t;
01910
01911
01912 typedef ACE_mutex_t ACE_thread_mutex_t;
01913 # if !defined (ACE_HAS_POSIX_SEM)
01914
01915 typedef struct
01916 {
01917
01918 SEM_ID sema_;
01919
01920
01921 char *name_;
01922 } ACE_sema_t;
01923 # endif
01924 typedef char * ACE_thread_t;
01925 typedef int ACE_hthread_t;
01926
01927
01928
01929 typedef u_int ACE_thread_key_t;
01930
01931
01932
01933 # define ACE_THR_ID_ALLOCATED '\022'
01934
01935 # elif defined (ACE_HAS_WTHREADS)
01936
01937 typedef CRITICAL_SECTION ACE_thread_mutex_t;
01938
01939 typedef struct
01940 {
01941
01942 int type_;
01943 union
01944 {
01945 HANDLE proc_mutex_;
01946 CRITICAL_SECTION thr_mutex_;
01947 };
01948 } ACE_mutex_t;
01949
01950
01951 typedef HANDLE ACE_event_t;
01952
01953 # if defined (ACE_WIN32)
01954
01955
01956
01957 # if !defined (ACE_USES_WINCE_SEMA_SIMULATION)
01958 typedef HANDLE ACE_sema_t;
01959 # else
01960
01961
01962
01963
01964
01965 class ACE_OS_Export ACE_sema_t
01966 {
01967 public:
01968
01969 ACE_thread_mutex_t lock_;
01970
01971
01972 ACE_event_t count_nonzero_;
01973
01974
01975 u_int count_;
01976 };
01977
01978 # endif
01979 # endif
01980
01981
01982 # define USYNC_THREAD 1
01983 # define USYNC_PROCESS 2
01984
01985 # define THR_CANCEL_DISABLE 0
01986 # define THR_CANCEL_ENABLE 0
01987 # define THR_CANCEL_DEFERRED 0
01988 # define THR_CANCEL_ASYNCHRONOUS 0
01989 # define THR_DETACHED 0x02000000
01990 # define THR_BOUND 0
01991 # define THR_NEW_LWP 0
01992 # define THR_DAEMON 0
01993 # define THR_JOINABLE 0
01994 # define THR_SUSPENDED CREATE_SUSPENDED
01995 # define THR_USE_AFX 0x01000000
01996 # define THR_SCHED_FIFO 0
01997 # define THR_SCHED_RR 0
01998 # define THR_SCHED_DEFAULT 0
01999 # define THR_SCOPE_PROCESS 0
02000 # define THR_SCOPE_SYSTEM 0
02001 # endif
02002
02003
02004
02005
02006 # if defined (ACE_LACKS_COND_T)
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017 class ACE_OS_Export ACE_cond_t
02018 {
02019 public:
02020 friend class ACE_OS;
02021
02022
02023 long waiters (void) const;
02024
02025 protected:
02026
02027 long waiters_;
02028
02029
02030 ACE_thread_mutex_t waiters_lock_;
02031
02032
02033 ACE_sema_t sema_;
02034
02035 # if defined (VXWORKS) || defined (ACE_PSOS)
02036
02037
02038
02039
02040
02041 ACE_sema_t waiters_done_;
02042 # elif defined (ACE_WIN32)
02043
02044
02045
02046
02047
02048 HANDLE waiters_done_;
02049 # else
02050 # error "Please implement this feature or check your config.h file!"
02051 # endif
02052
02053
02054 size_t was_broadcast_;
02055 };
02056
02057 struct ACE_OS_Export ACE_condattr_t
02058 {
02059 int type;
02060 };
02061
02062 struct ACE_OS_Export ACE_mutexattr_t
02063 {
02064 int type;
02065 };
02066 # endif
02067
02068 # if defined (ACE_LACKS_RWLOCK_T) && !defined (ACE_HAS_PTHREADS_UNIX98_EXT)
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079 struct ACE_OS_Export ACE_rwlock_t
02080 {
02081 protected:
02082 friend class ACE_OS;
02083
02084 ACE_mutex_t lock_;
02085
02086
02087 ACE_cond_t waiting_readers_;
02088
02089
02090 int num_waiting_readers_;
02091
02092
02093 ACE_cond_t waiting_writers_;
02094
02095
02096 int num_waiting_writers_;
02097
02098
02099 int ref_count_;
02100
02101
02102
02103 int important_writer_;
02104
02105
02106 ACE_cond_t waiting_important_writer_;
02107
02108 };
02109 # elif defined (ACE_HAS_PTHREADS_UNIX98_EXT)
02110 typedef pthread_rwlock_t ACE_rwlock_t;
02111 # elif defined (ACE_HAS_STHREADS)
02112 # include <synch.h>
02113 typedef rwlock_t ACE_rwlock_t;
02114 # endif
02115
02116
02117
02118
02119
02120
02121 # if !defined(ACE_THR_PRI_FIFO_DEF)
02122 # if defined (ACE_WTHREADS)
02123
02124
02125
02126
02127 # define ACE_THR_PRI_FIFO_DEF THREAD_PRIORITY_ABOVE_NORMAL
02128 # else
02129 # define ACE_THR_PRI_FIFO_DEF 0
02130 # endif
02131 # endif
02132
02133 # if !defined(ACE_THR_PRI_OTHER_DEF)
02134 # if defined (ACE_WTHREADS)
02135
02136
02137
02138
02139 # define ACE_THR_PRI_OTHER_DEF THREAD_PRIORITY_NORMAL
02140 # else
02141 # define ACE_THR_PRI_OTHER_DEF 0
02142 # endif
02143 # endif
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162 #if defined (ACE_HAS_RECURSIVE_MUTEXES)
02163 typedef ACE_thread_mutex_t ACE_recursive_thread_mutex_t;
02164 # if defined (ACE_WIN32)
02165
02166
02167
02168 struct ACE_recursive_mutex_state
02169 {
02170
02171
02172 LONG relock_count_;
02173 };
02174 # else
02175
02176 typedef int ACE_recursive_mutex_state;
02177 # endif
02178 #else
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189 class ACE_recursive_thread_mutex_t
02190 {
02191 public:
02192
02193 ACE_thread_mutex_t nesting_mutex_;
02194
02195
02196
02197 ACE_cond_t lock_available_;
02198
02199
02200 int nesting_level_;
02201
02202
02203 ACE_thread_t owner_id_;
02204 };
02205
02206
02207
02208 struct ACE_recursive_mutex_state
02209 {
02210 int nesting_level_;
02211 ACE_thread_t owner_id_;
02212 };
02213 #endif
02214
02215 # else
02216
02217
02218 # define ACE_SCOPE_PROCESS 0
02219 # define ACE_SCOPE_LWP 1
02220 # define ACE_SCOPE_THREAD 2
02221 # define ACE_SCHED_OTHER 0
02222 # define ACE_SCHED_FIFO 1
02223 # define ACE_SCHED_RR 2
02224 # if !defined (THR_CANCEL_DISABLE)
02225 # define THR_CANCEL_DISABLE 0
02226 # endif
02227 # if !defined (THR_CANCEL_ENABLE)
02228 # define THR_CANCEL_ENABLE 0
02229 # endif
02230 # if !defined (THR_CANCEL_DEFERRED)
02231 # define THR_CANCEL_DEFERRED 0
02232 # endif
02233 # if !defined (THR_CANCEL_ASYNCHRONOUS)
02234 # define THR_CANCEL_ASYNCHRONOUS 0
02235 # endif
02236 # if !defined (THR_JOINABLE)
02237 # define THR_JOINABLE 0
02238 # endif
02239 # if !defined (THR_DETACHED)
02240 # define THR_DETACHED 0
02241 # endif
02242 # if !defined (THR_DAEMON)
02243 # define THR_DAEMON 0
02244 # endif
02245 # if !defined (THR_BOUND)
02246 # define THR_BOUND 0
02247 # endif
02248 # if !defined (THR_NEW_LWP)
02249 # define THR_NEW_LWP 0
02250 # endif
02251 # if !defined (THR_SUSPENDED)
02252 # define THR_SUSPENDED 0
02253 # endif
02254 # if !defined (THR_SCHED_FIFO)
02255 # define THR_SCHED_FIFO 0
02256 # endif
02257 # if !defined (THR_SCHED_RR)
02258 # define THR_SCHED_RR 0
02259 # endif
02260 # if !defined (THR_SCHED_DEFAULT)
02261 # define THR_SCHED_DEFAULT 0
02262 # endif
02263 # if !defined (USYNC_THREAD)
02264 # define USYNC_THREAD 0
02265 # endif
02266 # if !defined (USYNC_PROCESS)
02267 # define USYNC_PROCESS 0
02268 # endif
02269 # if !defined (THR_SCOPE_PROCESS)
02270 # define THR_SCOPE_PROCESS 0
02271 # endif
02272 # if !defined (THR_SCOPE_SYSTEM)
02273 # define THR_SCOPE_SYSTEM 0
02274 # endif
02275
02276
02277 typedef int ACE_cond_t;
02278 struct ACE_OS_Export ACE_condattr_t
02279 {
02280 int type;
02281 };
02282 struct ACE_OS_Export ACE_mutexattr_t
02283 {
02284 int type;
02285 };
02286 typedef int ACE_mutex_t;
02287 typedef int ACE_thread_mutex_t;
02288 typedef int ACE_recursive_thread_mutex_t;
02289 typedef int ACE_recursive_mutex_state;
02290 # if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS)
02291 typedef int ACE_sema_t;
02292 # endif
02293 typedef int ACE_rwlock_t;
02294 typedef int ACE_thread_t;
02295 typedef int ACE_hthread_t;
02296 typedef u_int ACE_thread_key_t;
02297
02298
02299
02300
02301
02302
02303 # if !defined(ACE_THR_PRI_FIFO_DEF)
02304 # define ACE_THR_PRI_FIFO_DEF 0
02305 # endif
02306 # if !defined(ACE_THR_PRI_OTHER_DEF)
02307 # define ACE_THR_PRI_OTHER_DEF 0
02308 # endif
02309
02310 # endif
02311
02312 # if defined (ACE_PSOS)
02313
02314
02315 class ACE_OS_Export ACE_event_t
02316 {
02317 friend class ACE_OS;
02318
02319 protected:
02320
02321
02322 ACE_mutex_t lock_;
02323
02324
02325 ACE_cond_t condition_;
02326
02327
02328 int manual_reset_;
02329
02330
02331 int is_signaled_;
02332
02333
02334 u_long waiting_threads_;
02335 };
02336
02337 # endif
02338
02339
02340
02341 # include <stdarg.h>
02342 # if !defined (ACE_HAS_WINCE)
02343 # include <assert.h>
02344 # include <stdio.h>
02345
02346
02347
02348 # if defined (ACE_PSOS)
02349 # if defined (BUFSIZ)
02350 # undef BUFSIZ
02351 # endif
02352 # define BUFSIZ LC_BUFSIZ
02353 # endif
02354
02355 #if defined (ACE_PSOS_DIAB_MIPS)
02356 #undef size_t
02357 typedef unsigned int size_t;
02358 #endif
02359
02360 # if !defined (ACE_LACKS_NEW_H)
02361 # if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
02362 # include <new>
02363 # else
02364 # include <new.h>
02365 # endif
02366 # endif
02367
02368 # if !defined (ACE_PSOS_DIAB_MIPS) && !defined (VXWORKS)
02369 # define ACE_DONT_INCLUDE_ACE_SIGNAL_H
02370 # include <signal.h>
02371 # undef ACE_DONT_INCLUDE_ACE_SIGNAL_H
02372 # endif
02373
02374 # if ! defined (ACE_PSOS_DIAB_MIPS)
02375 # include <fcntl.h>
02376 # endif
02377 # endif
02378
02379 # include <limits.h>
02380 # include <ctype.h>
02381 # if ! defined (ACE_PSOS_DIAB_MIPS)
02382 # include <string.h>
02383 # include <stdlib.h>
02384 # endif
02385 # include <float.h>
02386
02387
02388
02389
02390 # if !defined (IOV_MAX)
02391 # define IOV_MAX 16
02392 # endif
02393
02394 # if !defined (ACE_IOV_MAX)
02395 #define ACE_IOV_MAX IOV_MAX
02396 # endif
02397
02398 # if defined (ACE_PSOS_SNARFS_HEADER_INFO)
02399
02400
02401
02402
02403 extern FILE *fdopen(int, const char *);
02404 extern int getopt(int, char *const *, const char *);
02405 extern char *tempnam(const char *, const char *);
02406 extern "C" int fileno(FILE *);
02407
02408
02409
02410
02411 extern char *strdup (const char *);
02412
02413
02414 extern mode_t umask (mode_t);
02415 extern int mkfifo (const char *, mode_t);
02416 extern int mkdir (const char *, mode_t);
02417
02418
02419 extern int putenv (char *);
02420
02421 int isatty (int h);
02422
02423 # endif
02424
02425 # if defined (ACE_NEEDS_SCHED_H)
02426 # include <sched.h>
02427 # endif
02428
02429 #if !defined (ACE_OSTREAM_TYPE)
02430 # if defined (ACE_LACKS_IOSTREAM_TOTALLY)
02431 # define ACE_OSTREAM_TYPE FILE
02432 # else
02433 # define ACE_OSTREAM_TYPE ostream
02434 # endif
02435 #endif
02436
02437 #if !defined (ACE_DEFAULT_LOG_STREAM)
02438 # if defined (ACE_LACKS_IOSTREAM_TOTALLY)
02439 # define ACE_DEFAULT_LOG_STREAM 0
02440 # else
02441 # define ACE_DEFAULT_LOG_STREAM (&cerr)
02442 # endif
02443 #endif
02444
02445
02446
02447 # if defined (ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION)
02448
02449 # include "ace/iosfwd.h"
02450 # else
02451
02452 # include "ace/streams.h"
02453 # endif
02454
02455 # if !defined (ACE_HAS_WINCE)
02456 # if ! defined (ACE_PSOS_DIAB_MIPS)
02457 # include <fcntl.h>
02458 # endif
02459 # endif
02460
02461
02462 # if defined (SCO)
02463 # define SIGIO SIGPOLL
02464 # include <sys/regset.h>
02465 # endif
02466
02467 # if defined ACE_HAS_BYTESEX_H
02468 # include <bytesex.h>
02469 # endif
02470 # include "ace/Basic_Types.h"
02471
02472
02473 # if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
02474 # if ACE_SIZEOF_LONG == 8
02475 typedef off_t ACE_LOFF_T;
02476 # elif defined (__sgi) || defined (AIX) || defined (HPUX) \
02477 || defined (__QNX__)
02478 typedef off64_t ACE_LOFF_T;
02479 # elif defined (__sun)
02480 typedef offset_t ACE_LOFF_T;
02481 # elif defined (WIN32) //Add by Nick Lin -- for win32 llseek
02482 typedef __int64 ACE_LOFF_T;
02483 # else
02484 typedef loff_t ACE_LOFF_T;
02485 # endif
02486 # endif
02487
02488
02489 static const ACE_UINT32 ACE_U_ONE_SECOND_IN_MSECS = 1000U;
02490 static const ACE_UINT32 ACE_U_ONE_SECOND_IN_USECS = 1000000U;
02491 static const ACE_UINT32 ACE_U_ONE_SECOND_IN_NSECS = 1000000000U;
02492
02493 # if defined (ACE_HAS_SIG_MACROS)
02494 # undef sigemptyset
02495 # undef sigfillset
02496 # undef sigaddset
02497 # undef sigdelset
02498 # undef sigismember
02499 # endif
02500
02501
02502
02503
02504 # if defined (linux) && defined (__OPTIMIZE__)
02505 # undef sigemptyset
02506 # undef sigfillset
02507 # endif
02508
02509
02510
02511
02512 #if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \
02513 !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)
02514 extern "C" pid_t getpgid (pid_t pid);
02515 #endif
02516
02517
02518 #if defined (ACE_LACKS_STRPTIME_PROTOTYPE) && !defined (_XOPEN_SOURCE)
02519 extern "C" char *strptime (const char *s, const char *fmt, struct tm *tp);
02520 #endif
02521
02522 #if defined (ACE_LACKS_STRTOK_R_PROTOTYPE) && !defined (_POSIX_SOURCE)
02523 extern "C" char *strtok_r (char *s, const char *delim, char **save_ptr);
02524 #endif
02525
02526 #if !defined (_LARGEFILE64_SOURCE)
02527 # if defined (ACE_LACKS_LSEEK64_PROTOTYPE) && \
02528 defined (ACE_LACKS_LLSEEK_PROTOTYPE)
02529 # error Define either ACE_LACKS_LSEEK64_PROTOTYPE or ACE_LACKS_LLSEEK_PROTOTYPE, not both!
02530 # elif defined (ACE_LACKS_LSEEK64_PROTOTYPE)
02531 extern "C" ACE_LOFF_T lseek64 (int fd, ACE_LOFF_T offset, int whence);
02532 # elif defined (ACE_LACKS_LLSEEK_PROTOTYPE)
02533 extern "C" ACE_LOFF_T llseek (int fd, ACE_LOFF_T offset, int whence);
02534 # endif
02535 #endif
02536
02537 #if defined (ACE_LACKS_PREAD_PROTOTYPE) && (_XOPEN_SOURCE - 0) < 500
02538
02539
02540
02541 extern "C" ssize_t pread (int fd,
02542 void *buf,
02543 size_t nbytes,
02544 off_t offset);
02545
02546 extern "C" ssize_t pwrite (int fd,
02547 const void *buf,
02548 size_t n,
02549 off_t offset);
02550 #endif
02551
02552 # if defined (ACE_LACKS_UALARM_PROTOTYPE)
02553 extern "C" u_int ualarm (u_int usecs, u_int interval);
02554 # endif
02555
02556 # if defined (ACE_HAS_BROKEN_SENDMSG)
02557 typedef struct msghdr ACE_SENDMSG_TYPE;
02558 # else
02559 typedef const struct msghdr ACE_SENDMSG_TYPE;
02560 # endif
02561
02562 # if defined (ACE_HAS_BROKEN_RANDR)
02563
02564
02565 typedef u_int ACE_RANDR_TYPE;
02566 extern "C" int rand_r (ACE_RANDR_TYPE seed);
02567 # else
02568 # if defined (HPUX_10)
02569
02570 typedef long ACE_RANDR_TYPE;
02571 # else
02572 typedef u_int ACE_RANDR_TYPE;
02573 # endif
02574 # endif
02575
02576 # if defined (ACE_HAS_UTIME)
02577 # include <utime.h>
02578 # endif
02579
02580 # if !defined (ACE_HAS_MSG) && !defined (SCO)
02581 struct msghdr {};
02582 # endif
02583
02584 # if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS)
02585 # if !defined (msg_accrights)
02586 # undef msg_control
02587 # define msg_accrights msg_control
02588 # endif
02589
02590 # if !defined (msg_accrightslen)
02591 # undef msg_controllen
02592 # define msg_accrightslen msg_controllen
02593 # endif
02594 # endif
02595
02596 # if !defined (ACE_HAS_SIG_ATOMIC_T)
02597 typedef int sig_atomic_t;
02598 # endif
02599
02600 # if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
02601
02602 # if defined (ACE_HAS_SIG_C_FUNC)
02603 extern "C" {
02604 # endif
02605 # if !defined (ACE_PSOS)
02606 typedef void (*ACE_SignalHandler)(int);
02607 typedef void (*ACE_SignalHandlerV)(int);
02608 # endif
02609 # if defined (ACE_HAS_SIG_C_FUNC)
02610 }
02611 # endif
02612 # elif defined (ACE_HAS_LYNXOS_SIGNALS)
02613 typedef void (*ACE_SignalHandler)(...);
02614 typedef void (*ACE_SignalHandlerV)(...);
02615 # elif defined (ACE_HAS_TANDEM_SIGNALS)
02616 typedef void (*ACE_SignalHandler)(...);
02617 typedef void (*ACE_SignalHandlerV)(...);
02618 # elif defined (ACE_HAS_IRIX_53_SIGNALS)
02619 typedef void (*ACE_SignalHandler)(...);
02620 typedef void (*ACE_SignalHandlerV)(...);
02621 # elif defined (ACE_HAS_SPARCWORKS_401_SIGNALS)
02622 typedef void (*ACE_SignalHandler)(int, ...);
02623 typedef void (*ACE_SignalHandlerV)(int,...);
02624 # elif defined (ACE_HAS_SUNOS4_SIGNAL_T)
02625 typedef void (*ACE_SignalHandler)(...);
02626 typedef void (*ACE_SignalHandlerV)(...);
02627 # elif defined (ACE_HAS_SVR4_SIGNAL_T)
02628
02629 typedef void (*ACE_SignalHandler)(int);
02630 # if !defined (m88k)
02631 typedef void (*ACE_SignalHandlerV)(void);
02632 # else
02633 typedef void (*ACE_SignalHandlerV)(int);
02634 # endif
02635 # elif defined (ACE_WIN32)
02636 typedef void (__cdecl *ACE_SignalHandler)(int);
02637 typedef void (__cdecl *ACE_SignalHandlerV)(int);
02638 # elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T)
02639 typedef void (*ACE_SignalHandler)(int);
02640 typedef void (*ACE_SignalHandlerV)(...);
02641 # else
02642 # if defined (SIG_PF)
02643 # define ACE_SignalHandler SIG_PF
02644 # else
02645 typedef void (*ACE_SignalHandler)(int);
02646 # endif
02647 typedef void (*ACE_SignalHandlerV)(...);
02648 # endif
02649
02650 # if defined (BUFSIZ)
02651 # define ACE_STREAMBUF_SIZE BUFSIZ
02652 # else
02653 # define ACE_STREAMBUF_SIZE 1024
02654 # endif
02655
02656 # if defined (ACE_WIN32)
02657
02658
02659
02660
02661 # if !defined (ALL_WARNINGS) && defined(_MSC_VER) && !defined(ghs) && !defined(__MINGW32__)
02662
02663 # pragma warning(disable: 4127)
02664 # pragma warning(disable: 4134)
02665 # pragma warning(disable: 4511)
02666 # pragma warning(disable: 4512)
02667 # pragma warning(disable: 4514)
02668 # pragma warning(disable: 4710)
02669 # pragma warning(disable: 4705)
02670
02671
02672 # pragma warning(disable: 4791)
02673
02674 # pragma warning(disable: 4275)
02675 # pragma warning(disable: 4251)
02676 # pragma warning(disable: 4786)
02677 # pragma warning(disable: 4097)
02678 # endif
02679
02680
02681
02682
02683
02684
02685 # if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0)
02686 # if !defined (STRICT)
02687 # define STRICT
02688 # endif
02689 # endif
02690
02691 # if !defined (ACE_HAS_WINCE)
02692 # include <sys/timeb.h>
02693 # endif
02694
02695
02696 # if !defined (ACE_MAX_DEFAULT_PORT)
02697 # define ACE_MAX_DEFAULT_PORT 65535
02698 # endif
02699
02700
02701 # define ACE_PLATFORM_A "Win32"
02702 # define ACE_PLATFORM_EXE_SUFFIX_A ".exe"
02703
02704
02705 # if !defined (ACE_DEFAULT_SVC_CONF)
02706 # if (ACE_USES_CLASSIC_SVC_CONF == 1)
02707 # define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf")
02708 # else
02709 # define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf.xml")
02710 # endif
02711 # endif
02712
02713
02714
02715 # if defined (ACE_HAS_WINCE)
02716 # define ACE_STDIN _fileno (stdin)
02717 # define ACE_STDOUT _fileno (stdout)
02718 # define ACE_STDERR _fileno (stderr)
02719 # else
02720 # define ACE_STDIN GetStdHandle (STD_INPUT_HANDLE)
02721 # define ACE_STDOUT GetStdHandle (STD_OUTPUT_HANDLE)
02722 # define ACE_STDERR GetStdHandle (STD_ERROR_HANDLE)
02723 # endif // ACE_HAS_WINCE
02724
02725
02726 # if !defined (ACE_DEFAULT_SEM_KEY)
02727 # define ACE_DEFAULT_SEM_KEY "ACE_SEM_KEY"
02728 # endif
02729
02730 # define ACE_INVALID_SEM_KEY 0
02731
02732 # if !defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
02733 # define ACE_SEH_TRY if (1)
02734 # define ACE_SEH_EXCEPT(X) while (0)
02735 # define ACE_SEH_FINALLY if (1)
02736 # elif defined(__BORLANDC__)
02737 # if (__BORLANDC__ >= 0x0530)
02738 # define ACE_SEH_TRY try
02739 # define ACE_SEH_EXCEPT(X) __except(X)
02740 # define ACE_SEH_FINALLY __finally
02741 # else
02742 # define ACE_SEH_TRY if (1)
02743 # define ACE_SEH_EXCEPT(X) while (0)
02744 # define ACE_SEH_FINALLY if (1)
02745 # endif
02746 # elif defined (__IBMCPP__) && (__IBMCPP__ >= 400)
02747 # define ACE_SEH_TRY if (1)
02748 # define ACE_SEH_EXCEPT(X) while (0)
02749 # define ACE_SEH_FINALLY if (1)
02750 # else
02751 # define ACE_SEH_TRY __try
02752 # define ACE_SEH_EXCEPT(X) __except(X)
02753 # define ACE_SEH_FINALLY __finally
02754 # endif
02755
02756
02757 # define ACE_DEV_NULL "nul"
02758
02759
02760 # define ACE_DIRECTORY_SEPARATOR_STR_A "\\"
02761 # define ACE_DIRECTORY_SEPARATOR_CHAR_A '\\'
02762 # define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("PATH")
02763 # define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (";")
02764 # define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dll")
02765 # if defined (__MINGW32__)
02766 # define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib")
02767 # else
02768 # define ACE_DLL_PREFIX ACE_LIB_TEXT ("")
02769 # endif
02770
02771
02772 # define NFDBITS 32
02773
02774 # define MAP_PRIVATE 1
02775 # define MAP_SHARED 2
02776 # define MAP_FIXED 4
02777
02778 # define RUSAGE_SELF 1
02779
02780 struct shmaddr { };
02781 struct msqid_ds {};
02782
02783
02784
02785 struct rusage
02786 {
02787 FILETIME ru_utime;
02788 FILETIME ru_stime;
02789 };
02790
02791
02792 # define PROT_READ PAGE_READONLY
02793 # define PROT_WRITE PAGE_READWRITE
02794 # define PROT_RDWR PAGE_READWRITE
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
02806 # include <ws2tcpip.h>
02807 # endif
02808
02809
02810 # define ETIME ERROR_SEM_TIMEOUT
02811 # define EWOULDBLOCK WSAEWOULDBLOCK
02812 # define EINPROGRESS WSAEINPROGRESS
02813 # define EALREADY WSAEALREADY
02814 # define ENOTSOCK WSAENOTSOCK
02815 # define EDESTADDRREQ WSAEDESTADDRREQ
02816 # define EMSGSIZE WSAEMSGSIZE
02817 # define EPROTOTYPE WSAEPROTOTYPE
02818 # define ENOPROTOOPT WSAENOPROTOOPT
02819 # define EPROTONOSUPPORT WSAEPROTONOSUPPORT
02820 # define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
02821 # define EOPNOTSUPP WSAEOPNOTSUPP
02822 # define EPFNOSUPPORT WSAEPFNOSUPPORT
02823 # define EAFNOSUPPORT WSAEAFNOSUPPORT
02824 # define EADDRINUSE WSAEADDRINUSE
02825 # define EADDRNOTAVAIL WSAEADDRNOTAVAIL
02826 # define ENETDOWN WSAENETDOWN
02827 # define ENETUNREACH WSAENETUNREACH
02828 # define ENETRESET WSAENETRESET
02829 # define ECONNABORTED WSAECONNABORTED
02830 # define ECONNRESET WSAECONNRESET
02831 # define ENOBUFS WSAENOBUFS
02832 # define EISCONN WSAEISCONN
02833 # define ENOTCONN WSAENOTCONN
02834 # define ESHUTDOWN WSAESHUTDOWN
02835 # define ETOOMANYREFS WSAETOOMANYREFS
02836 # define ETIMEDOUT WSAETIMEDOUT
02837 # define ECONNREFUSED WSAECONNREFUSED
02838 # define ELOOP WSAELOOP
02839 # define EHOSTDOWN WSAEHOSTDOWN
02840 # define EHOSTUNREACH WSAEHOSTUNREACH
02841 # define EPROCLIM WSAEPROCLIM
02842 # define EUSERS WSAEUSERS
02843 # define EDQUOT WSAEDQUOT
02844 # define ESTALE WSAESTALE
02845 # define EREMOTE WSAEREMOTE
02846
02847
02848
02849
02850 # if defined (__BORLANDC__) && (__BORLANDC__ <= 0x540)
02851 # define ENOTEMPTY WSAENOTEMPTY
02852 # endif
02853
02854
02855 # if !defined (ACE_HAS_WINCE)
02856 # include <time.h>
02857 # include <direct.h>
02858 # include <process.h>
02859 # include <io.h>
02860 # endif
02861
02862 # if defined (__BORLANDC__)
02863 # include <fcntl.h>
02864 # define _chdir chdir
02865 # define _ftime ftime
02866 # undef _access
02867 # define _access access
02868 # if (__BORLANDC__ <= 0x540)
02869 # define _getcwd getcwd
02870 # define _stat stat
02871 # endif
02872 # define _isatty isatty
02873 # define _umask umask
02874 # define _fstat fstat
02875 # define _stricmp stricmp
02876 # define _strnicmp strnicmp
02877
02878 # define _timeb timeb
02879
02880 # define _O_CREAT O_CREAT
02881 # define _O_EXCL O_EXCL
02882 # define _O_TRUNC O_TRUNC
02883
02884 # define _O_TEMPORARY 0x08
02885 # define _O_RDWR O_RDWR
02886 # define _O_WRONLY O_WRONLY
02887 # define _O_RDONLY O_RDONLY
02888 # define _O_APPEND O_APPEND
02889 # define _O_BINARY O_BINARY
02890 # define _O_TEXT O_TEXT
02891 # endif
02892
02893 typedef OVERLAPPED ACE_OVERLAPPED;
02894
02895 typedef DWORD ACE_thread_t;
02896 # if !defined(__MINGW32__)
02897 typedef long pid_t;
02898 # endif
02899 typedef HANDLE ACE_hthread_t;
02900
02901 #define ACE_INVALID_PID ((pid_t) -1)
02902 # if defined (ACE_HAS_TSS_EMULATION)
02903 typedef DWORD ACE_OS_thread_key_t;
02904 typedef u_int ACE_thread_key_t;
02905 # else
02906 typedef DWORD ACE_thread_key_t;
02907 # endif
02908
02909 # if !defined (ACE_LACKS_LONGLONG_T)
02910
02911 typedef unsigned __int64 ACE_QWORD;
02912 typedef unsigned __int64 ACE_hrtime_t;
02913 inline ACE_QWORD ACE_MAKE_QWORD (DWORD lo, DWORD hi) { return ACE_QWORD (lo) | (ACE_QWORD (hi) << 32); }
02914 inline DWORD ACE_LOW_DWORD (ACE_QWORD q) { return (DWORD) q; }
02915 inline DWORD ACE_HIGH_DWORD (ACE_QWORD q) { return (DWORD) (q >> 32); }
02916 # else
02917
02918 typedef ACE_UINT64 ACE_hrtime_t;
02919 # endif // ACE_LACKS_LONGLONG_T
02920
02921
02922
02923
02924 # if defined (ACE_HAS_WINCE)
02925 # if !defined (PIPE_TYPE_MESSAGE)
02926 # define PIPE_TYPE_MESSAGE 0
02927 # endif
02928 # if !defined (PIPE_READMODE_MESSAGE)
02929 # define PIPE_READMODE_MESSAGE 0
02930 # endif
02931 # if !defined (PIPE_WAIT)
02932 # define PIPE_WAIT 0
02933 # endif
02934 # endif
02935
02936 # if !defined (__BORLANDC__)
02937 typedef DWORD nlink_t;
02938 # if !defined(__MINGW32__)
02939 typedef u_short mode_t;
02940 # endif
02941 typedef long uid_t;
02942 typedef long gid_t;
02943 # endif
02944 typedef char *caddr_t;
02945
02946 typedef DWORD ACE_exitcode;
02947 # define ACE_SYSCALL_FAILED 0xFFFFFFFF
02948
02949
02950 # define MS_ASYNC 0
02951 # define MS_INVALIDATE 0
02952
02953
02954
02955 # define O_NDELAY 1
02956 # if !defined (MAXPATHLEN)
02957 # define MAXPATHLEN _MAX_PATH
02958 # endif
02959 # define MAXNAMLEN _MAX_FNAME
02960 # define EADDRINUSE WSAEADDRINUSE
02961
02962
02963
02964 struct iovec
02965 {
02966
02967 u_long iov_len;
02968
02969 char *iov_base;
02970
02971
02972 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
02973 operator WSABUF &(void) { return *((WSABUF *) this); }
02974 #endif
02975 };
02976
02977 struct msghdr
02978 {
02979
02980 sockaddr * msg_name;
02981
02982
02983 int msg_namelen;
02984
02985
02986 iovec *msg_iov;
02987
02988
02989 int msg_iovlen;
02990
02991
02992 caddr_t msg_accrights;
02993
02994 int msg_accrightslen;
02995 };
02996
02997 typedef int ACE_idtype_t;
02998 typedef DWORD ACE_id_t;
02999 # define ACE_SELF (0)
03000 typedef int ACE_pri_t;
03001
03002
03003 typedef HINSTANCE ACE_SHLIB_HANDLE;
03004 # define ACE_SHLIB_INVALID_HANDLE 0
03005 # define ACE_DEFAULT_SHLIB_MODE 0
03006
03007 # elif defined (ACE_PSOS)
03008
03009 typedef ACE_UINT64 ACE_hrtime_t;
03010
03011 # if defined (ACE_SIGINFO_IS_SIGINFO_T)
03012 typedef struct siginfo siginfo_t;
03013 # endif
03014
03015 # else
03016
03017 # if defined (m88k)
03018 # define RUSAGE_SELF 1
03019 # endif
03020
03021
03022 # define ACE_MAX_DEFAULT_PORT 65535
03023
03024
03025 # if !defined (ACE_DEFAULT_SEM_KEY)
03026 # define ACE_DEFAULT_SEM_KEY 1234
03027 # endif
03028
03029 # define ACE_INVALID_SEM_KEY -1
03030
03031
03032 # define ACE_DIRECTORY_SEPARATOR_STR_A "/"
03033 # define ACE_DIRECTORY_SEPARATOR_CHAR_A '/'
03034
03035
03036 # define ACE_PLATFORM_A "UNIX"
03037 # define ACE_PLATFORM_EXE_SUFFIX_A ""
03038
03039 # if !defined (ACE_LD_SEARCH_PATH)
03040 # define ACE_LD_SEARCH_PATH "LD_LIBRARY_PATH"
03041 # endif
03042 # if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR)
03043 # define ACE_LD_SEARCH_PATH_SEPARATOR_STR ":"
03044 # endif
03045
03046 # if !defined (ACE_DLL_SUFFIX)
03047 # define ACE_DLL_SUFFIX ".so"
03048 # endif
03049 # if !defined (ACE_DLL_PREFIX)
03050 # define ACE_DLL_PREFIX "lib"
03051 # endif
03052
03053
03054 # if !defined (ACE_DEFAULT_SVC_CONF)
03055 # if (ACE_USES_CLASSIC_SVC_CONF == 1)
03056 # define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf")
03057 # else
03058 # define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf.xml")
03059 # endif
03060 # endif
03061
03062
03063
03064 # define ACE_STDIN 0
03065 # define ACE_STDOUT 1
03066 # define ACE_STDERR 2
03067
03068
03069 typedef int ACE_exitcode;
03070 # define ACE_INVALID_HANDLE -1
03071 # define ACE_SYSCALL_FAILED -1
03072
03073 # define ACE_SEH_TRY if (1)
03074 # define ACE_SEH_EXCEPT(X) while (0)
03075 # define ACE_SEH_FINALLY if (1)
03076
03077 # if !defined (ACE_INVALID_PID)
03078 # define ACE_INVALID_PID ((pid_t) -1)
03079 # endif
03080
03081
03082 # define ACE_DEV_NULL "/dev/null"
03083
03084
03085
03086
03087
03088
03089 class ACE_OS_Export ACE_event_t
03090 {
03091 friend class ACE_OS;
03092 protected:
03093
03094 ACE_mutex_t lock_;
03095
03096
03097 ACE_cond_t condition_;
03098
03099
03100 int manual_reset_;
03101
03102
03103 int is_signaled_;
03104
03105
03106 u_long waiting_threads_;
03107 };
03108
03109 struct ACE_OVERLAPPED
03110 {
03111 u_long Internal;
03112 u_long InternalHigh;
03113 u_long Offset;
03114 u_long OffsetHigh;
03115 ACE_HANDLE hEvent;
03116 };
03117
03118
03119
03120 # if !defined (LPSECURITY_ATTRIBUTES)
03121 # define LPSECURITY_ATTRIBUTES int
03122 # endif
03123 # if !defined (GENERIC_READ)
03124 # define GENERIC_READ 0
03125 # endif
03126 # if !defined (FILE_SHARE_READ)
03127 # define FILE_SHARE_READ 0
03128 # endif
03129 # if !defined (OPEN_EXISTING)
03130 # define OPEN_EXISTING 0
03131 # endif
03132 # if !defined (FILE_ATTRIBUTE_NORMAL)
03133 # define FILE_ATTRIBUTE_NORMAL 0
03134 # endif
03135 # if !defined (MAXIMUM_WAIT_OBJECTS)
03136 # define MAXIMUM_WAIT_OBJECTS 0
03137 # endif
03138 # if !defined (FILE_FLAG_OVERLAPPED)
03139 # define FILE_FLAG_OVERLAPPED 0
03140 # endif
03141 # if !defined (FILE_FLAG_SEQUENTIAL_SCAN)
03142 # define FILE_FLAG_SEQUENTIAL_SCAN 0
03143 # endif
03144 # if !defined(FILE_FLAG_WRITE_THROUGH)
03145 # define FILE_FLAG_WRITE_THROUGH 0
03146 # endif
03147 # if !defined(PIPE_WAIT)
03148 # define PIPE_WAIT 0
03149 # endif
03150 # if !defined(PIPE_NOWAIT)
03151 # define PIPE_NOWAIT 0
03152 # endif
03153 # if !defined(PIPE_READMODE_BYTE)
03154 # define PIPE_READMODE_BYTE 0
03155 # endif
03156 # if !defined(PIPE_READMODE_MESSAGE)
03157 # define PIPE_READMODE_MESSAGE 0
03158 # endif
03159 # if !defined(PIPE_TYPE_BYTE)
03160 # define PIPE_TYPE_BYTE 0
03161 # endif
03162 # if !defined(PIPE_TYPE_MESSAGE)
03163 # define PIPE_TYPE_MESSAGE 0
03164 # endif
03165
03166 # if defined (ACE_HAS_BROKEN_IF_HEADER)
03167 struct ifafilt;
03168 # endif
03169
03170 # if defined (ACE_HAS_AIX_BROKEN_SOCKET_HEADER)
03171 # undef __cplusplus
03172 # include <sys/socket.h>
03173 # define __cplusplus
03174 # else
03175 # include <sys/socket.h>
03176 # endif
03177
03178 extern "C"
03179 {
03180 # if defined (VXWORKS)
03181 struct hostent {
03182 char *h_name;
03183 char **h_aliases;
03184 int h_addrtype;
03185 int h_length;
03186 char **h_addr_list;
03187 # define h_addr h_addr_list[0]
03188 };
03189 # elif defined (ACE_HAS_CYGWIN32_SOCKET_H)
03190 # include <cygwin32/socket.h>
03191 # else
03192 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
03193 # define queue _Queue_
03194 # endif
03195 # include <netdb.h>
03196 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
03197 # undef queue
03198 # endif
03199 # endif
03200
03201
03202
03203
03204 # if defined (ACE_HAS_STL_MAP_CONFLICT)
03205 # define map _Resource_Allocation_Map_
03206 # endif
03207 # include <net/if.h>
03208 # if defined (ACE_HAS_STL_MAP_CONFLICT)
03209 # undef map
03210 # endif
03211
03212 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
03213 # define queue _Queue_
03214 # endif
03215 # include <netinet/in.h>
03216 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
03217 # undef queue
03218 # endif
03219
03220 # if defined (ACE_VXWORKS) && ACE_VXWORKS <= 0x540
03221
03222 unsigned long inet_addr (const char *);
03223 char *inet_ntoa (const struct in_addr);
03224 struct in_addr inet_makeaddr (const int, const int);
03225 unsigned long inet_network (const char *);
03226 # else
03227 # include <arpa/inet.h>
03228 # endif
03229 }
03230 # if !defined (ACE_LACKS_TCP_H)
03231 # if defined(ACE_HAS_CONFLICTING_XTI_MACROS)
03232 # if defined(TCP_NODELAY)
03233 # undef TCP_NODELAY
03234 # endif
03235 # if defined(TCP_MAXSEG)
03236 # undef TCP_MAXSEG
03237 # endif
03238 # endif
03239 # include <netinet/tcp.h>
03240 # endif
03241
03242 # if defined (__Lynx__)
03243 # ifndef howmany
03244 # define howmany(x, y) (((x)+((y)-1))/(y))
03245 # endif
03246 # endif
03247
03248 # if defined (CHORUS)
03249 # include <chorus.h>
03250 # if !defined(CHORUS_4)
03251 # include <cx/select.h>
03252 # else
03253 # include <stdio.h>
03254 # endif
03255 # include <sys/uio.h>
03256 # include <time.h>
03257 # include <stdfileio.h>
03258 # include <am/afexec.h>
03259 # include <sys/types.h>
03260 # include <sys/signal.h>
03261 # include <sys/wait.h>
03262 # include <pwd.h>
03263 # include <timer/chBench.h>
03264 extern_C int getgid __((void));
03265 extern_C int getuid __((void));
03266 extern_C char* getcwd __((char* buf, size_t size));
03267 extern_C int pipe __((int* fildes));
03268 extern_C int gethostname __((char*, size_t));
03269
03270
03271 # define MAXPATHLEN _POSIX_PATH_MAX
03272
03273 # if !defined(CHORUS_4)
03274 typedef cx_fd_mask fd_mask;
03275 typedef void (*__sighandler_t)(int);
03276 # endif
03277 # ifndef howmany
03278 # define howmany(x, y) (((x)+((y)-1))/(y))
03279 # endif
03280 # elif defined (CYGWIN32)
03281 # include <sys/uio.h>
03282 # include <sys/file.h>
03283 # include <sys/time.h>
03284 # include <sys/resource.h>
03285 # include <sys/wait.h>
03286 # include <pwd.h>
03287 # elif defined (__QNX__)
03288 # include <sys/uio.h>
03289 # include <sys/ipc.h>
03290 # include <sys/sem.h>
03291 # include <sys/time.h>
03292 # include <sys/wait.h>
03293 # include <sys/resource.h>
03294 # include <pwd.h>
03295
03296 # include <unix.h>
03297 # include <sys/param.h>
03298 typedef long fd_mask;
03299 # if !defined (NFDBITS)
03300 # define NFDBITS (sizeof(fd_mask) * NBBY)
03301 # endif
03302 # if !defined (howmany)
03303 # define howmany(x, y) (((x)+((y)-1))/(y))
03304 # endif
03305 # elif defined(__rtems__)
03306 # include <sys/file.h>
03307 # include <sys/resource.h>
03308 # include <sys/fcntl.h>
03309 # include <sys/time.h>
03310 # include <sys/utsname.h>
03311 # include <sys/wait.h>
03312 # include <pwd.h>
03313
03314 extern "C"
03315 {
03316 int select (int n, fd_set *readfds, fd_set *writefds,
03317 fd_set *exceptfds, const struct timeval *timeout);
03318 };
03319 # elif ! defined (VXWORKS)
03320 # include <sys/uio.h>
03321 # include <sys/ipc.h>
03322 # if !defined(ACE_LACKS_SYSV_SHMEM)
03323
03324 # include <sys/shm.h>
03325 # endif
03326 # include <sys/sem.h>
03327 # include <sys/file.h>
03328 # include <sys/time.h>
03329 # include <sys/resource.h>
03330 # include <sys/wait.h>
03331 # include <pwd.h>
03332 # endif
03333 # include <sys/ioctl.h>
03334
03335
03336 # if defined (ACE_HAS_BSTRING)
03337 # include <bstring.h>
03338 # endif
03339
03340
03341 # if defined (ACE_HAS_STRINGS)
03342 # include <strings.h>
03343 # endif
03344
03345 # if defined (ACE_HAS_TERM_IOCTLS)
03346 # if defined (__QNX__)
03347 # include <termios.h>
03348 # else
03349 # include <sys/termios.h>
03350 # endif
03351 # if defined (HPUX)
03352 # include <sys/modem.h>
03353 # endif
03354 # endif
03355
03356 #if !defined (VMIN)
03357 #define ACE_VMIN 4
03358 #else
03359 #define ACE_VMIN VMIN
03360 #endif
03361
03362 #if !defined (VTIME)
03363 #define ACE_VTIME 5
03364 #else
03365 #define ACE_VTIME VTIME
03366 #endif
03367
03368 # if defined (ACE_HAS_AIO_CALLS)
03369 # include <aio.h>
03370 # endif
03371
03372 # if !defined (ACE_LACKS_PARAM_H)
03373 # include <sys/param.h>
03374 # endif
03375
03376
03377
03378
03379
03380 # if defined (__hpux)
03381 # include <sys/pstat.h>
03382 # endif
03383
03384 # if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) && !defined (VXWORKS)
03385 # include <sys/un.h>
03386 # endif
03387
03388 # if defined (ACE_HAS_SIGINFO_T)
03389 # if !defined (ACE_LACKS_SIGINFO_H)
03390 # if defined (__QNX__) || defined (__OpenBSD__)
03391 # include <sys/siginfo.h>
03392 # elif defined(__rtems__)
03393 # include <signal.h>
03394 # else
03395 # include <siginfo.h>
03396 # endif
03397 # endif
03398 # if !defined (ACE_LACKS_UCONTEXT_H)
03399 # include <ucontext.h>
03400 # endif
03401 # endif
03402
03403 # if defined (ACE_HAS_POLL)
03404 # include <poll.h>
03405 # endif
03406
03407 # if defined (ACE_HAS_STREAMS)
03408 # if defined (AIX)
03409 # if !defined (_XOPEN_EXTENDED_SOURCE)
03410 # define _XOPEN_EXTENDED_SOURCE
03411 # endif
03412 # include <stropts.h>
03413 # undef _XOPEN_EXTENDED_SOURCE
03414 # else
03415 # include <stropts.h>
03416 # endif
03417 # endif
03418
03419 # if defined (DIGITAL_UNIX)
03420
03421
03422
03423
03424 # if defined (__DECCXX_VER)
03425 # undef sigwait
03426
03427
03428
03429 extern "C" int _Psigwait __((const sigset_t *set, int *sig));
03430 # elif defined (__KCC)
03431 # undef sigwait
03432 inline int sigwait (const sigset_t* set, int* sig)
03433 { return _Psigwait (set, sig); }
03434 # endif
03435 # elif !defined (ACE_HAS_SIGWAIT)
03436 # if defined(__rtems__)
03437 extern "C" int sigwait (const sigset_t *set, int *sig);
03438 # else
03439 extern "C" int sigwait (sigset_t *set);
03440 # endif
03441 # endif
03442
03443 # if defined (ACE_HAS_SELECT_H)
03444 # include <sys/select.h>
03445 # endif
03446
03447 # if defined (ACE_HAS_ALLOCA_H)
03448 # include <alloca.h>
03449 # endif
03450
03451
03452
03453
03454
03455 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
03456 # if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C)
03457 extern "C" {
03458 # endif
03459 # include <dlfcn.h>
03460 # if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C)
03461 }
03462 # endif
03463 typedef void *ACE_SHLIB_HANDLE;
03464 # define ACE_SHLIB_INVALID_HANDLE 0
03465 # if defined (__KCC) && defined(RTLD_GROUP) && defined(RTLD_NODELETE)
03466 # define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GROUP | RTLD_NODELETE
03467 # else
03468 # define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY
03469 # endif
03470 # elif defined (__hpux)
03471 # if defined(__GNUC__) || __cplusplus >= 199707L
03472 # include <dl.h>
03473 # else
03474 # include <cxxdl.h>
03475 # endif
03476 typedef shl_t ACE_SHLIB_HANDLE;
03477 # define ACE_SHLIB_INVALID_HANDLE 0
03478 # define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED
03479 # else
03480 typedef void *ACE_SHLIB_HANDLE;
03481 # define ACE_SHLIB_INVALID_HANDLE 0
03482 # define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY
03483
03484 # endif
03485
03486 #if !defined (RTLD_LAZY)
03487 #define RTLD_LAZY 1
03488 #endif
03489
03490 #if !defined (RTLD_NOW)
03491 #define RTLD_NOW 2
03492 #endif
03493
03494 #if !defined (RTLD_GLOBAL)
03495 #define RTLD_GLOBAL 3
03496 #endif
03497
03498 # if defined (ACE_HAS_SOCKIO_H)
03499 # include <sys/sockio.h>
03500 # endif
03501
03502
03503 # if !defined (RLIMIT_NOFILE)
03504 # if defined (linux) || defined (AIX) || defined (SCO)
03505 # if defined (RLIMIT_OFILE)
03506 # define RLIMIT_NOFILE RLIMIT_OFILE
03507 # else
03508 # define RLIMIT_NOFILE 200
03509 # endif
03510 # endif
03511 # endif
03512
03513 # if defined (ACE_LACKS_MMAP)
03514 # define PROT_READ 0
03515 # define PROT_WRITE 0
03516 # define PROT_EXEC 0
03517 # define PROT_NONE 0
03518 # define PROT_RDWR 0
03519 # define MAP_PRIVATE 0
03520 # define MAP_SHARED 0
03521 # define MAP_FIXED 0
03522 # endif
03523
03524
03525 # if defined (ACE_HAS_BROKEN_MMAP_H)
03526 extern "C"
03527 {
03528 # include <sys/mman.h>
03529 }
03530 # elif !defined (ACE_LACKS_MMAP)
03531 # include <sys/mman.h>
03532 # endif
03533
03534
03535 # if defined (ACE_HAS_BROKEN_MSG_H)
03536 # define _KERNEL
03537 # endif
03538 # if !defined (ACE_LACKS_SYSV_MSG_H)
03539 # include <sys/msg.h>
03540 # endif
03541 # if defined (ACE_HAS_BROKEN_MSG_H)
03542 # undef _KERNEL
03543 # endif
03544
03545 # if defined (ACE_LACKS_SYSV_MSQ_PROTOS)
03546 extern "C"
03547 {
03548 int msgget (key_t, int);
03549 int msgrcv (int, void *, size_t, long, int);
03550 int msgsnd (int, const void *, size_t, int);
03551 int msgctl (int, int, struct msqid_ds *);
03552 }
03553 # endif
03554
03555 # if defined (ACE_HAS_PRIOCNTL)
03556 # include <sys/priocntl.h>
03557 # endif
03558
03559 # if defined (ACE_HAS_IDTYPE_T)
03560 typedef idtype_t ACE_idtype_t;
03561 # else
03562 typedef int ACE_idtype_t;
03563 # endif
03564
03565 # if defined (ACE_HAS_STHREADS) || defined (DIGITAL_UNIX)
03566 # if defined (ACE_LACKS_PRI_T)
03567 typedef int pri_t;
03568 # endif
03569 typedef id_t ACE_id_t;
03570 # define ACE_SELF P_MYID
03571 typedef pri_t ACE_pri_t;
03572 # else
03573 typedef long ACE_id_t;
03574 # define ACE_SELF (-1)
03575 typedef short ACE_pri_t;
03576 # endif
03577
03578 # if defined (ACE_HAS_HI_RES_TIMER) && !defined (ACE_LACKS_LONGLONG_T)
03579
03580 typedef hrtime_t ACE_hrtime_t;
03581 # else
03582 typedef ACE_UINT64 ACE_hrtime_t;
03583 # endif
03584
03585 # endif
03586
03587
03588 # if defined (ACE_HAS_WCHAR)
03589 # define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A)
03590 # define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A)
03591 # define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A)
03592 # define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A)
03593 # endif
03594
03595 # define ACE_DIRECTORY_SEPARATOR_STR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A)
03596 # define ACE_DIRECTORY_SEPARATOR_CHAR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A)
03597 # define ACE_PLATFORM ACE_LIB_TEXT (ACE_PLATFORM_A)
03598 # define ACE_PLATFORM_EXE_SUFFIX ACE_LIB_TEXT (ACE_PLATFORM_EXE_SUFFIX_A)
03599
03600
03601 # if !defined (ACE_DEFAULT_LOCALNAME_A)
03602 # define ACE_DEFAULT_LOCALNAME_A "localnames"
03603 # endif
03604 # if !defined (ACE_DEFAULT_GLOBALNAME_A)
03605 # define ACE_DEFAULT_GLOBALNAME_A "globalnames"
03606 # endif
03607
03608
03609
03610
03611 # if defined (ACE_LEGACY_MODE)
03612 # if defined (ACE_WIN32)
03613 # define ACE_DEFAULT_NAMESPACE_DIR_A "C:\\temp"
03614 # else
03615 # define ACE_DEFAULT_NAMESPACE_DIR_A "/tmp"
03616 # endif
03617 # if defined (ACE_HAS_WCHAR)
03618 # define ACE_DEFAULT_NAMESPACE_DIR_W ACE_TEXT_WIDE(ACE_DEFAULT_NAMESPACE_DIR_A)
03619 # endif
03620 # define ACE_DEFAULT_NAMESPACE_DIR ACE_LIB_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A)
03621 # endif
03622
03623 # if defined (ACE_HAS_WCHAR)
03624 # define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A)
03625 # define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A)
03626 # endif
03627
03628 # define ACE_DEFAULT_LOCALNAME ACE_LIB_TEXT (ACE_DEFAULT_LOCALNAME_A)
03629 # define ACE_DEFAULT_GLOBALNAME ACE_LIB_TEXT (ACE_DEFAULT_GLOBALNAME_A)
03630
03631
03632 # if !defined (O_BINARY)
03633 # define O_BINARY 0
03634 # endif
03635 # if !defined (_O_BINARY)
03636 # define _O_BINARY O_BINARY
03637 # endif
03638 # if !defined (O_TEXT)
03639 # define O_TEXT 0
03640 # endif
03641 # if !defined (_O_TEXT)
03642 # define _O_TEXT O_TEXT
03643 # endif
03644 # if !defined (O_RAW)
03645 # define O_RAW 0
03646 # endif
03647 # if !defined (_O_RAW)
03648 # define _O_RAW O_RAW
03649 # endif
03650
03651 # if !defined (ACE_DEFAULT_SYNCH_TYPE)
03652 # define ACE_DEFAULT_SYNCH_TYPE USYNC_THREAD
03653 # endif
03654
03655 # if !defined (ACE_MAP_PRIVATE)
03656 # define ACE_MAP_PRIVATE MAP_PRIVATE
03657 # endif
03658
03659 # if !defined (ACE_MAP_SHARED)
03660 # define ACE_MAP_SHARED MAP_SHARED
03661 # endif
03662
03663 # if !defined (ACE_MAP_FIXED)
03664 # define ACE_MAP_FIXED MAP_FIXED
03665 # endif
03666
03667 #if defined (ACE_LACKS_UTSNAME_T)
03668 # if !defined (SYS_NMLN)
03669 # define SYS_NMLN 257
03670 # endif
03671 # if !defined (_SYS_NMLN)
03672 # define _SYS_NMLN SYS_NMLN
03673 # endif
03674 struct ACE_utsname
03675 {
03676 ACE_TCHAR sysname[_SYS_NMLN];
03677 ACE_TCHAR nodename[_SYS_NMLN];
03678 ACE_TCHAR release[_SYS_NMLN];
03679 ACE_TCHAR version[_SYS_NMLN];
03680 ACE_TCHAR machine[_SYS_NMLN];
03681 };
03682 # else
03683 # include <sys/utsname.h>
03684 typedef struct utsname ACE_utsname;
03685 # endif
03686
03687
03688
03689
03690 #if !defined (AF_ANY)
03691 # define AF_ANY (-1)
03692 #endif
03693
03694 # define AF_SPIPE (AF_MAX + 1)
03695 # if !defined (AF_FILE)
03696 # define AF_FILE (AF_MAX + 2)
03697 # endif
03698 # define AF_DEV (AF_MAX + 3)
03699 # define AF_UPIPE (AF_SPIPE)
03700
03701 # if defined (ACE_SELECT_USES_INT)
03702 typedef int ACE_FD_SET_TYPE;
03703 # else
03704 typedef fd_set ACE_FD_SET_TYPE;
03705 # endif
03706
03707 # if !defined (MAXNAMELEN)
03708 # if defined (FILENAME_MAX)
03709 # define MAXNAMELEN FILENAME_MAX
03710 # else
03711 # define MAXNAMELEN 256
03712 # endif
03713 # endif
03714
03715 # if !defined(MAXHOSTNAMELEN)
03716 # define MAXHOSTNAMELEN 256
03717 # endif
03718
03719
03720
03721 # if !defined (INADDR_LOOPBACK)
03722 # define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001)
03723 # endif
03724
03725
03726 # if !defined (INADDR_NONE)
03727 # define INADDR_NONE ((ACE_UINT32) 0xffffffff)
03728 # endif
03729
03730
03731
03732
03733 # if !defined (INET_ADDRSTRLEN)
03734 # define INET_ADDRSTRLEN 16
03735 # endif
03736
03737
03738 # if !defined (INET6_ADDRSTRLEN)
03739 # define INET6_ADDRSTRLEN 46
03740 # endif
03741
03742 #if defined (ACE_HAS_IPV6)
03743
03744 # if defined (ACE_USES_IPV4_IPV6_MIGRATION)
03745 # define ACE_ADDRESS_FAMILY_INET AF_UNSPEC
03746 # define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC
03747 # else
03748 # define ACE_ADDRESS_FAMILY_INET AF_INET6
03749 # define ACE_PROTOCOL_FAMILY_INET PF_INET6
03750 # endif
03751
03752 #else
03753 # define ACE_ADDRESS_FAMILY_INET AF_INET
03754 # define ACE_PROTOCOL_FAMILY_INET PF_INET
03755 #endif
03756
03757 # if defined (ACE_LACKS_SIGSET)
03758 # if !defined(__MINGW32__)
03759 typedef u_int sigset_t;
03760 # endif
03761 # endif
03762
03763 # if defined (ACE_LACKS_SIGACTION)
03764 struct sigaction
03765 {
03766 int sa_flags;
03767 ACE_SignalHandlerV sa_handler;
03768 sigset_t sa_mask;
03769 };
03770 # endif
03771
03772 # if !defined (SIGHUP)
03773 # define SIGHUP 0
03774 # endif
03775
03776 # if !defined (SIGINT)
03777 # define SIGINT 0
03778 # endif
03779
03780 # if !defined (SIGSEGV)
03781 # define SIGSEGV 0
03782 # endif
03783
03784 # if !defined (SIGIO)
03785 # define SIGIO 0
03786 # endif
03787
03788 # if !defined (SIGUSR1)
03789 # define SIGUSR1 0
03790 # endif
03791
03792 # if !defined (SIGUSR2)
03793 # define SIGUSR2 0
03794 # endif
03795
03796 # if !defined (SIGCHLD)
03797 # define SIGCHLD 0
03798 # endif
03799
03800 # if !defined (SIGCLD)
03801 # define SIGCLD SIGCHLD
03802 # endif
03803
03804 # if !defined (SIGQUIT)
03805 # define SIGQUIT 0
03806 # endif
03807
03808 # if !defined (SIGPIPE)
03809 # define SIGPIPE 0
03810 # endif
03811
03812 # if !defined (SIGALRM)
03813 # define SIGALRM 0
03814 # endif
03815
03816 # if !defined (SIG_DFL)
03817 # if defined (ACE_PSOS_DIAB_MIPS) || defined (ACE_PSOS_DIAB_PPC)
03818 # define SIG_DFL ((void *) 0)
03819 # else
03820 # define SIG_DFL ((__sighandler_t) 0)
03821 # endif
03822 # endif
03823
03824 # if !defined (SIG_IGN)
03825 # if defined (ACE_PSOS_DIAB_MIPS) || defined (ACE_PSOS_DIAB_PPC)
03826 # define SIG_IGN ((void *) 1)
03827 # else
03828 # define SIG_IGN ((__sighandler_t) 1)
03829 # endif
03830 # endif
03831
03832 # if !defined (SIG_ERR)
03833 # if defined (ACE_PSOS_DIAB_MIPS) || defined (ACE_PSOS_DIAB_PPC)
03834 # define SIG_ERR ((void *) -1)
03835 # else
03836 # define SIG_ERR ((__sighandler_t) -1)
03837 # endif
03838 # endif
03839
03840 # if !defined (O_NONBLOCK)
03841 # define O_NONBLOCK 1
03842 # endif
03843
03844 # if !defined (SIG_BLOCK)
03845 # define SIG_BLOCK 1
03846 # endif
03847
03848 # if !defined (SIG_UNBLOCK)
03849 # define SIG_UNBLOCK 2
03850 # endif
03851
03852 # if !defined (SIG_SETMASK)
03853 # define SIG_SETMASK 3
03854 # endif
03855
03856 # if !defined (IPC_CREAT)
03857 # define IPC_CREAT 0
03858 # endif
03859
03860 # if !defined (IPC_NOWAIT)
03861 # define IPC_NOWAIT 0
03862 # endif
03863
03864 # if !defined (IPC_RMID)
03865 # define IPC_RMID 0
03866 # endif
03867
03868 # if !defined (IPC_EXCL)
03869 # define IPC_EXCL 0
03870 # endif
03871
03872 # if !defined (IP_DROP_MEMBERSHIP)
03873 # define IP_DROP_MEMBERSHIP 0
03874 # endif
03875
03876 # if !defined (IP_ADD_MEMBERSHIP)
03877 # define IP_ADD_MEMBERSHIP 0
03878 # define ACE_LACKS_IP_ADD_MEMBERSHIP
03879 # endif
03880
03881 # if !defined (IP_DEFAULT_MULTICAST_TTL)
03882 # define IP_DEFAULT_MULTICAST_TTL 0
03883 # endif
03884
03885 # if !defined (IP_DEFAULT_MULTICAST_LOOP)
03886 # define IP_DEFAULT_MULTICAST_LOOP 0
03887 # endif
03888
03889 # if !defined (IP_MULTICAST_IF)
03890 # define IP_MULTICAST_IF 0
03891 #endif
03892
03893 # if !defined (IP_MULTICAST_TTL)
03894 # define IP_MULTICAST_TTL 1
03895 #endif
03896
03897 # if !defined (IP_MAX_MEMBERSHIPS)
03898 # define IP_MAX_MEMBERSHIPS 0
03899 # endif
03900
03901 # if !defined (SIOCGIFBRDADDR)
03902 # define SIOCGIFBRDADDR 0
03903 # endif
03904
03905 # if !defined (SIOCGIFADDR)
03906 # define SIOCGIFADDR 0
03907 # endif
03908
03909 # if !defined (IPC_PRIVATE)
03910 # define IPC_PRIVATE ACE_INVALID_SEM_KEY
03911 # endif
03912
03913 # if !defined (IPC_STAT)
03914 # define IPC_STAT 0
03915 # endif
03916
03917 # if !defined (GETVAL)
03918 # define GETVAL 0
03919 # endif
03920
03921 # if !defined (F_GETFL)
03922 # define F_GETFL 0
03923 # endif
03924
03925 # if !defined (SETVAL)
03926 # define SETVAL 0
03927 # endif
03928
03929 # if !defined (GETALL)
03930 # define GETALL 0
03931 # endif
03932
03933 # if !defined (SETALL)
03934 # define SETALL 0
03935 # endif
03936
03937 # if !defined (SEM_UNDO)
03938 # define SEM_UNDO 0
03939 # endif
03940
03941 # if defined (__Lynx__)
03942
03943 # define ACE_NSIG (NSIG + 1)
03944 # elif defined (__rtems__)
03945 # define ACE_NSIG (SIGRTMAX)
03946 # else
03947
03948
03949 # define ACE_NSIG NSIG
03950 # endif
03951
03952 # if !defined (R_OK)
03953 # define R_OK 04
03954 # endif
03955
03956 # if !defined (W_OK)
03957 # define W_OK 02
03958 # endif
03959
03960 # if !defined (X_OK)
03961 # define X_OK 01
03962 # endif
03963
03964 # if !defined (F_OK)
03965 # define F_OK 0
03966 # endif
03967
03968 # if !defined (ESUCCESS)
03969 # define ESUCCESS 0
03970 # endif
03971
03972 # if !defined (EIDRM)
03973 # define EIDRM 0
03974 # endif
03975
03976 # if !defined (ENFILE)
03977 # define ENFILE EMFILE
03978 # endif
03979
03980 # if !defined (ECOMM)
03981
03982 # define ECOMM ECONNABORTED
03983 # endif
03984
03985 # if !defined (WNOHANG)
03986 # define WNOHANG 0100
03987 # endif
03988
03989 # if !defined (EDEADLK)
03990 # define EDEADLK 1000
03991 # endif
03992
03993 #if !defined (ENXIO)
03994 # define ENXIO 6
03995 #endif
03996
03997 # if !defined (MS_SYNC)
03998 # define MS_SYNC 0x0
03999 # endif
04000
04001 # if !defined (PIPE_BUF)
04002 # define PIPE_BUF 5120
04003 # endif
04004
04005 # if !defined (PROT_RDWR)
04006 # define PROT_RDWR (PROT_READ|PROT_WRITE)
04007 # endif
04008
04009 # if defined (ACE_HAS_POSIX_NONBLOCK)
04010 # define ACE_NONBLOCK O_NONBLOCK
04011 # else
04012 # define ACE_NONBLOCK O_NDELAY
04013 # endif
04014
04015
04016
04017
04018
04019
04020 # define ACE_SIGIO -1
04021 # define ACE_SIGURG -2
04022 # define ACE_CLOEXEC -3
04023
04024 # define LOCALNAME 0
04025 # define REMOTENAME 1
04026
04027 # if !defined (ETIMEDOUT) && defined (ETIME)
04028 # define ETIMEDOUT ETIME
04029 # endif
04030
04031 # if !defined (ETIME) && defined (ETIMEDOUT)
04032 # define ETIME ETIMEDOUT
04033 # endif
04034
04035 # if !defined (EBUSY)
04036 # define EBUSY ETIME
04037 # endif
04038
04039 # if !defined (_SC_TIMER_MAX)
04040 # define _SC_TIMER_MAX 44
04041 # endif
04042
04043
04044
04045 # if !defined (ACE_DEFAULT_TIMERS)
04046 # define ACE_DEFAULT_TIMERS _SC_TIMER_MAX
04047 # endif
04048
04049 # if defined (ACE_HAS_STRUCT_NETDB_DATA)
04050 typedef char ACE_HOSTENT_DATA[sizeof(struct hostent_data)];
04051 typedef char ACE_SERVENT_DATA[sizeof(struct servent_data)];
04052 typedef char ACE_PROTOENT_DATA[sizeof(struct protoent_data)];
04053 # else
04054 # if !defined ACE_HOSTENT_DATA_SIZE
04055 # define ACE_HOSTENT_DATA_SIZE (4*1024)
04056 # endif
04057 # if !defined ACE_SERVENT_DATA_SIZE
04058 # define ACE_SERVENT_DATA_SIZE (4*1024)
04059 # endif
04060 # if !defined ACE_PROTOENT_DATA_SIZE
04061 # define ACE_PROTOENT_DATA_SIZE (2*1024)
04062 # endif
04063 typedef char ACE_HOSTENT_DATA[ACE_HOSTENT_DATA_SIZE];
04064 typedef char ACE_SERVENT_DATA[ACE_SERVENT_DATA_SIZE];
04065 typedef char ACE_PROTOENT_DATA[ACE_PROTOENT_DATA_SIZE];
04066 # endif
04067
04068 # if !defined (ACE_HAS_SEMUN) || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED))
04069 union semun
04070 {
04071
04072 int val;
04073
04074 struct semid_ds *buf;
04075
04076 u_short *array;
04077 };
04078 # endif
04079
04080
04081
04082
04083 typedef const char **SYS_SIGLIST;
04084
04085 # if !defined (MAP_FAILED) || defined (ACE_HAS_BROKEN_MAP_FAILED)
04086 # undef MAP_FAILED
04087 # define MAP_FAILED ((void *) -1)
04088 # elif defined (ACE_HAS_LONG_MAP_FAILED)
04089 # undef MAP_FAILED
04090 # define MAP_FAILED ((void *) -1L)
04091 # endif
04092
04093 # if defined (ACE_HAS_CHARPTR_DL)
04094 typedef ACE_TCHAR * ACE_DL_TYPE;
04095 # else
04096 typedef const ACE_TCHAR * ACE_DL_TYPE;
04097 # endif
04098
04099 # if !defined (ACE_HAS_SIGINFO_T)
04100 struct ACE_OS_Export siginfo_t
04101 {
04102 siginfo_t (ACE_HANDLE handle);
04103 siginfo_t (ACE_HANDLE *handles);
04104
04105
04106 ACE_HANDLE si_handle_;
04107
04108
04109 ACE_HANDLE *si_handles_;
04110 };
04111 # endif
04112
04113
04114 extern "C"
04115 {
04116 typedef void (*ACE_SIGNAL_C_FUNC)(int,siginfo_t*,void*);
04117 }
04118
04119 # if !defined (ACE_HAS_UCONTEXT_T)
04120 typedef int ucontext_t;
04121 # endif
04122
04123 # if !defined (SA_SIGINFO)
04124 # define SA_SIGINFO 0
04125 # endif
04126
04127 # if !defined (SA_RESTART)
04128 # define SA_RESTART 0
04129 # endif
04130
04131 # if defined (ACE_HAS_TIMOD_H)
04132 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
04133 # define queue _Queue_
04134 # endif
04135 # include <sys/timod.h>
04136 # if defined (ACE_HAS_STL_QUEUE_CONFLICT)
04137 # undef queue
04138 # endif
04139 # elif defined (ACE_HAS_OSF_TIMOD_H)
04140 # include <tli/timod.h>
04141 # endif
04142
04143
04144
04145
04146
04147
04148 class ACE_OS_Export ACE_Thread_ID
04149 {
04150 public:
04151
04152 ACE_Thread_ID (ACE_thread_t, ACE_hthread_t);
04153 ACE_Thread_ID (const ACE_Thread_ID &id);
04154
04155
04156 ACE_thread_t id (void);
04157 void id (ACE_thread_t);
04158
04159
04160 ACE_hthread_t handle (void);
04161 void handle (ACE_hthread_t);
04162
04163
04164 int operator== (const ACE_Thread_ID &) const;
04165 int operator!= (const ACE_Thread_ID &) const;
04166
04167 private:
04168
04169 ACE_thread_t thread_id_;
04170
04171
04172 ACE_hthread_t thread_handle_;
04173 };
04174
04175
04176 typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext);
04177
04178
04179
04180
04181 typedef int ACE_Sched_Priority;
04182
04183
04184 class ACE_Sched_Params;
04185
04186 # if defined (ACE_LACKS_FILELOCKS)
04187 # if ! defined (VXWORKS) && ! defined (ACE_PSOS) && ! defined (__rtems__)
04188
04189
04190
04191 struct flock
04192 {
04193 short l_type;
04194 short l_whence;
04195 off_t l_start;
04196 off_t l_len;
04197 long l_sysid;
04198 pid_t l_pid;
04199 long l_pad[4];
04200 };
04201 # endif
04202 # endif
04203
04204 # if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP)
04205
04206
04207
04208 struct ip_mreq
04209 {
04210
04211 struct in_addr imr_multiaddr;
04212
04213 struct in_addr imr_interface;
04214 };
04215 # endif
04216
04217 # if !defined (ACE_HAS_STRBUF_T)
04218 struct strbuf
04219 {
04220
04221 int maxlen;
04222
04223 int len;
04224
04225 void *buf;
04226 };
04227 # endif
04228
04229
04230
04231
04232
04233
04234 class ACE_OS_Export ACE_Str_Buf : public strbuf
04235 {
04236 public:
04237
04238
04239 ACE_Str_Buf (void *b = 0, int l = 0, int max = 0);
04240
04241
04242 ACE_Str_Buf (strbuf &);
04243 };
04244
04245 # if defined (ACE_HAS_BROKEN_BITSHIFT)
04246
04247
04248
04249 # define ACE_MSB_MASK (~(ACE_UINT32 (1) << ACE_UINT32 (NFDBITS - 1)))
04250 # else
04251
04252 # if defined (ACE_WIN32)
04253
04254 # define ACE_MSB_MASK (~(1 << (NFDBITS - 1)))
04255 # else
04256 # define ACE_MSB_MASK (~((fd_mask) 1 << (NFDBITS - 1)))
04257 # endif
04258 # endif
04259
04260
04261
04262 # if defined (ACE_HAS_SIG_C_FUNC)
04263 extern "C" {
04264 # endif
04265 typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) ;
04266 # if defined (ACE_HAS_SIG_C_FUNC)
04267 }
04268 # endif
04269
04270 # if defined (ACE_WIN32)
04271
04272 int ACE_SEH_Default_Exception_Selector (void *);
04273 int ACE_SEH_Default_Exception_Handler (void *);
04274 # endif
04275
04276
04277
04278
04279
04280
04281 class ACE_OS_Export ACE_Cleanup
04282 {
04283 public:
04284
04285 ACE_Cleanup (void);
04286
04287
04288 virtual ~ACE_Cleanup (void);
04289
04290
04291 virtual void cleanup (void *param = 0);
04292 };
04293
04294
04295 extern "C" ACE_OS_Export
04296 void ace_cleanup_destroyer (ACE_Cleanup *, void *param = 0);
04297
04298
04299
04300
04301
04302
04303 class ACE_OS_Export ACE_Cleanup_Info
04304 {
04305 public:
04306
04307 ACE_Cleanup_Info (void);
04308
04309
04310 int operator== (const ACE_Cleanup_Info &o) const;
04311
04312
04313 int operator!= (const ACE_Cleanup_Info &o) const;
04314
04315
04316 void *object_;
04317
04318
04319 ACE_CLEANUP_FUNC cleanup_hook_;
04320
04321
04322 void *param_;
04323 };
04324
04325 class ACE_Cleanup_Info_Node;
04326
04327
04328
04329
04330
04331
04332
04333
04334 class ACE_OS_Export ACE_OS_Exit_Info
04335 {
04336 public:
04337
04338 ACE_OS_Exit_Info (void);
04339
04340
04341 ~ACE_OS_Exit_Info (void);
04342
04343
04344 int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param);
04345
04346
04347
04348 int find (void *object);
04349
04350
04351
04352 void call_hooks ();
04353
04354 private:
04355
04356
04357
04358
04359
04360 ACE_Cleanup_Info_Node *registered_objects_;
04361 };
04362
04363 class ACE_Base_Thread_Adapter;
04364 class ACE_Thread_Hook;
04365
04366 # if defined (ACE_HAS_PHARLAP_RT)
04367 #define ACE_IPPROTO_TCP SOL_SOCKET
04368 # else
04369 #define ACE_IPPROTO_TCP IPPROTO_TCP
04370 # endif
04371
04372 # if defined (ACE_LACKS_FLOATING_POINT)
04373 typedef ACE_UINT32 ACE_timer_t;
04374 # else
04375 typedef double ACE_timer_t;
04376 # endif
04377
04378 # if defined (ACE_HAS_PRUSAGE_T)
04379 typedef prusage_t ACE_Rusage;
04380 # elif defined (ACE_HAS_GETRUSAGE)
04381 typedef rusage ACE_Rusage;
04382 # else
04383 typedef int ACE_Rusage;
04384 # endif
04385
04386 # if !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SYSLOG)
04387 # include <syslog.h>
04388 # endif
04389
04390 # if defined (ACE_HAS_SYS_FILIO_H)
04391 # include <sys/filio.h>
04392 # endif
04393
04394 # if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__)
04395 typedef struct _stat ACE_stat;
04396 # else
04397 typedef struct stat ACE_stat;
04398 # endif
04399
04400
04401 extern "C" {
04402 typedef int (*ACE_COMPARE_FUNC)(const void *, const void *);
04403 }
04404
04405 #if defined (ACE_HAS_WINCE)
04406
04407
04408
04409
04410 struct tm {
04411 int tm_sec;
04412 int tm_min;
04413 int tm_hour;
04414 int tm_mday;
04415 int tm_mon;
04416 int tm_year;
04417 int tm_wday;
04418 int tm_yday;
04419 int tm_isdst;
04420 };
04421 #endif
04422
04423
04424
04425
04426
04427
04428
04429
04430
04431
04432
04433 inline long ace_timezone()
04434 {
04435 #if !defined (VXWORKS) && !defined (ACE_PSOS) && !defined (CHORUS)
04436 # if defined (ACE_HAS_WINCE)
04437 TIME_ZONE_INFORMATION tz;
04438 GetTimeZoneInformation (&tz);
04439 return tz.Bias * 60;
04440 # elif defined (ACE_WIN32)
04441 return _timezone;
04442 # elif ( defined (__Lynx__) || defined (__FreeBSD__) || defined (ACE_HAS_SUNOS4_GETTIMEOFDAY) ) && ( !defined (__linux__) )
04443 long result = 0;
04444 struct timeval time;
04445 struct timezone zone;
04446 ACE_UNUSED_ARG (result);
04447 ACE_OSCALL (::gettimeofday (&time, &zone), int, -1, result);
04448 return zone.tz_minuteswest * 60;
04449 # else
04450 # if defined (__linux__)
04451
04452
04453
04454
04455
04456
04457 ::tzset();
04458 # endif
04459 return timezone;
04460 # endif
04461 #else
04462 ACE_NOTSUP_RETURN (0);
04463 #endif
04464 }
04465
04466
04467 #if !defined (ACE_LACKS_DIFFTIME)
04468
04469
04470
04471
04472
04473
04474
04475
04476
04477 inline double ace_difftime(time_t t1, time_t t0)
04478 {
04479 # if defined (ACE_PSOS) && ! defined (ACE_PSOS_HAS_TIME)
04480
04481 return ((double)t1) - ((double)t0);
04482 # else
04483 return difftime (t1, t0);
04484 # endif
04485 }
04486 #endif
04487
04488
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501
04502
04503 #if !defined (ACE_LACKS_CUSERID) && !defined(ACE_HAS_ALT_CUSERID) \
04504 && !defined(ACE_WIN32) && !defined (VXWORKS)
04505 inline char *ace_cuserid(char *user)
04506 {
04507 return cuserid(user);
04508 }
04509 #endif
04510
04511 #if defined (SD_RECEIVE)
04512 #define ACE_SHUTDOWN_READ SD_RECEIVE
04513 #elif defined (SHUT_RD)
04514 #define ACE_SHUTDOWN_READ SHUT_RD
04515 #else
04516 #define ACE_SHUTDOWN_READ 0
04517 #endif
04518
04519 #if defined (SD_SEND)
04520 #define ACE_SHUTDOWN_WRITE SD_SEND
04521 #elif defined (SHUT_WR)
04522 #define ACE_SHUTDOWN_WRITE SHUT_WR
04523 #else
04524 #define ACE_SHUTDOWN_WRITE 1
04525 #endif
04526
04527 #if defined (SD_BOTH)
04528 #define ACE_SHUTDOWN_BOTH SD_BOTH
04529 #elif defined (SHUT_RDWR)
04530 #define ACE_SHUTDOWN_BOTH SHUT_RDWR
04531 #else
04532 #define ACE_SHUTDOWN_BOTH 2
04533 #endif
04534
04535 #if !defined (ACE_HAS_WINCE)
04536
04537 class ACE_QoS;
04538 class ACE_QoS_Params;
04539 class ACE_Accept_QoS_Params;
04540 #endif // ACE_HAS_WINCE
04541
04542 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
04543 typedef WSAPROTOCOL_INFO ACE_Protocol_Info;
04544
04545
04546
04547 typedef LPWSAOVERLAPPED_COMPLETION_ROUTINE ACE_OVERLAPPED_COMPLETION_FUNC;
04548 typedef GROUP ACE_SOCK_GROUP;
04549 #else
04550 struct ACE_Protocol_Info
04551 {
04552 u_long dwServiceFlags1;
04553 int iAddressFamily;
04554 int iProtocol;
04555 char szProtocol[255+1];
04556 };
04557
04558
04559
04560 typedef void (*ACE_OVERLAPPED_COMPLETION_FUNC) (u_long error,
04561 u_long bytes_transferred,
04562 ACE_OVERLAPPED *overlapped,
04563 u_long flags);
04564 typedef u_long ACE_SOCK_GROUP;
04565
04566 #endif
04567
04568
04569
04570
04571
04572
04573
04574
04575
04576
04577
04578
04579
04580
04581
04582
04583
04584
04585 class ACE_OS_Export ACE_OS
04586 : public ACE_OS_Dirent,
04587 public ACE_OS_String,
04588 public ACE_OS_Memory,
04589 public ACE_OS_TLI
04590 {
04591
04592 ACE_CLASS_IS_NAMESPACE (ACE_OS);
04593 public:
04594 friend class ACE_Timeout_Manager;
04595
04596 # if defined (CHORUS) && !defined (CHORUS_4)
04597
04598 enum ACE_HRTimer_Op
04599 {
04600 ACE_HRTIMER_START = K_BSTART,
04601 ACE_HRTIMER_INCR = K_BPOINT,
04602 ACE_HRTIMER_STOP = K_BSTOP,
04603 ACE_HRTIMER_GETTIME = 0xFFFF
04604 };
04605 # else
04606 enum ACE_HRTimer_Op
04607 {
04608 ACE_HRTIMER_START = 0x0,
04609 ACE_HRTIMER_INCR = 0x1,
04610 ACE_HRTIMER_STOP = 0x2,
04611 ACE_HRTIMER_GETTIME = 0xFFFF
04612 };
04613 # endif
04614
04615
04616
04617
04618
04619
04620 class ACE_OS_Export ace_flock_t
04621 {
04622 public:
04623
04624 void dump (void) const;
04625
04626 # if defined (ACE_WIN32)
04627 ACE_OVERLAPPED overlapped_;
04628 # else
04629 struct flock lock_;
04630 # endif
04631
04632
04633 const ACE_TCHAR *lockname_;
04634
04635
04636 ACE_HANDLE handle_;
04637
04638 # if defined (CHORUS)
04639
04640
04641 ACE_mutex_t *process_lock_;
04642 # endif
04643 };
04644
04645 # if defined (ACE_WIN32)
04646
04647 static LPSECURITY_ATTRIBUTES default_win32_security_attributes (LPSECURITY_ATTRIBUTES);
04648
04649
04650
04651 static const OSVERSIONINFO &get_win32_versioninfo (void);
04652
04653
04654
04655
04656
04657 static HINSTANCE get_win32_resource_module (void);
04658
04659
04660
04661
04662 static void set_win32_resource_module (HINSTANCE);
04663
04664 # endif
04665
04666
04667 static int atoi (const char *s);
04668
04669 # if defined (ACE_HAS_WCHAR)
04670 static int atoi (const wchar_t *s);
04671 # endif
04672
04673 #if defined (atop)
04674 #undef atop
04675 #endif
04676
04677 static void *atop (const char *s);
04678
04679 # if defined (ACE_HAS_WCHAR)
04680 static void *atop (const wchar_t *s);
04681 # endif
04682
04683
04684 static double floor (double x);
04685
04686
04687 static double ceil (double x);
04688
04689 static char *getenv (const char *symbol);
04690 # if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
04691 static wchar_t *getenv (const wchar_t *symbol);
04692 # endif
04693 static int putenv (const ACE_TCHAR *string);
04694 static ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
04695 static ACE_TCHAR *getenvstrings (void);
04696
04697 static int getopt (int argc,
04698 char *const *argv,
04699 const char *optstring);
04700 static int argv_to_string (ACE_TCHAR **argv,
04701 ACE_TCHAR *&buf,
04702 int substitute_env_args = 1);
04703 static int string_to_argv (ACE_TCHAR *buf,
04704 int &argc,
04705 ACE_TCHAR **&argv,
04706 int substitute_env_args = 1);
04707 static long sysconf (int);
04708
04709
04710 static int condattr_init (ACE_condattr_t &attributes,
04711 int type = ACE_DEFAULT_SYNCH_TYPE);
04712 static int condattr_destroy (ACE_condattr_t &attributes);
04713 static int cond_broadcast (ACE_cond_t *cv);
04714 static int cond_destroy (ACE_cond_t *cv);
04715 static int cond_init (ACE_cond_t *cv,
04716 short type = ACE_DEFAULT_SYNCH_TYPE,
04717 const char *name = 0,
04718 void *arg = 0);
04719 static int cond_init (ACE_cond_t *cv,
04720 ACE_condattr_t &attributes,
04721 const char *name = 0,
04722 void *arg = 0);
04723 # if defined (ACE_HAS_WCHAR)
04724 static int cond_init (ACE_cond_t *cv,
04725 short type,
04726 const wchar_t *name,
04727 void *arg = 0);
04728 static int cond_init (ACE_cond_t *cv,
04729 ACE_condattr_t &attributes,
04730 const wchar_t *name,
04731 void *arg = 0);
04732 # endif
04733 static int cond_signal (ACE_cond_t *cv);
04734 static int cond_timedwait (ACE_cond_t *cv,
04735 ACE_mutex_t *m,
04736 ACE_Time_Value *);
04737 static int cond_wait (ACE_cond_t *cv,
04738 ACE_mutex_t *m);
04739 # if defined (ACE_WIN32) && defined (ACE_HAS_WTHREADS)
04740 static int cond_timedwait (ACE_cond_t *cv,
04741 ACE_thread_mutex_t *m,
04742 ACE_Time_Value *);
04743 static int cond_wait (ACE_cond_t *cv,
04744 ACE_thread_mutex_t *m);
04745 # endif
04746
04747
04748
04749
04750 # if !defined (ACE_LACKS_CUSERID)
04751 #if defined(cuserid)
04752 # undef cuserid
04753 #endif
04754 static char *cuserid (char *user,
04755 size_t maxlen = ACE_MAX_USERID);
04756
04757 # if defined (ACE_HAS_WCHAR)
04758 static wchar_t *cuserid (wchar_t *user,
04759 size_t maxlen = ACE_MAX_USERID);
04760 # endif
04761 # endif
04762
04763
04764
04765 static int uname (ACE_utsname *name);
04766 static long sysinfo (int cmd,
04767 char *buf,
04768 long count);
04769 static int hostname (char *name,
04770 size_t maxnamelen);
04771
04772 #if defined (ACE_HAS_WCHAR)
04773 static int hostname (wchar_t *name,
04774 size_t maxnamelen);
04775 #endif
04776
04777
04778
04779 static int dlclose (ACE_SHLIB_HANDLE handle);
04780
04781 static ACE_TCHAR *dlerror (void);
04782 static ACE_SHLIB_HANDLE dlopen (const ACE_TCHAR *filename,
04783 int mode = ACE_DEFAULT_SHLIB_MODE);
04784 static void *dlsym (ACE_SHLIB_HANDLE handle,
04785 const ACE_TCHAR *symbol);
04786
04787
04788
04789 static int last_error (void);
04790 static void last_error (int);
04791 static int set_errno_to_last_error (void);
04792 static int set_errno_to_wsa_last_error (void);
04793 static int fclose (FILE *fp);
04794 static int fcntl (ACE_HANDLE handle,
04795 int cmd,
04796 long arg = 0);
04797 static int fdetach (const char *file);
04798
04799 static int fsync (ACE_HANDLE handle);
04800
04801 # if defined (ACE_USES_WCHAR)
04802
04803
04804 static void checkUnicodeFormat (FILE* fp);
04805 # endif // ACE_USES_WCHAR
04806
04807 static FILE *fopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode);
04808 static FILE *freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream);
04809 # if defined (fdopen)
04810 # undef fdopen
04811 # endif
04812 static FILE *fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode);
04813 static ACE_TCHAR *fgets (ACE_TCHAR *buf, int size, FILE *fp);
04814 static int stat (const ACE_TCHAR *file, ACE_stat *);
04815 static int truncate (const ACE_TCHAR *filename, off_t length);
04816
04817 static int fprintf (FILE *fp, const char *format, ...);
04818 static int sprintf (char *buf, const char *format, ...);
04819 static int snprintf (char *buf, size_t maxlen, const char *format, ...);
04820 static int vsprintf (char *buffer, const char *format, va_list argptr);
04821 static int printf (const char *format, ...);
04822 # if defined (ACE_HAS_WCHAR)
04823 static int sprintf (wchar_t *buf, const wchar_t *format, ...);
04824 static int snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format,...);
04825 static int fprintf (FILE *fp, const wchar_t *format, ...);
04826 static int vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr);
04827 # endif
04828
04829 static void perror (const ACE_TCHAR *s);
04830
04831
04832
04833
04834
04835
04836
04837
04838
04839
04840 static char *gets (char *str, int n = 0);
04841 static int puts (const ACE_TCHAR *s);
04842 static int fputs (const ACE_TCHAR *s,
04843 FILE *stream);
04844
04845 static int fflush (FILE *fp);
04846 static size_t fread (void *ptr,
04847 size_t size,
04848 size_t nelems,
04849 FILE *fp);
04850
04851 static int fgetc (FILE* fp);
04852
04853 #if !defined (ACE_LACKS_CLEARERR)
04854 static void clearerr (FILE* fp);
04855 #endif
04856
04857 #if defined (ACE_HAS_WCHAR)
04858 static wint_t fgetwc (FILE* fp);
04859 static wint_t ungetwc (wint_t c, FILE* fp);
04860 #endif
04861
04862 static int fseek (FILE *fp,
04863 long offset,
04864 int ptrname);
04865 static long ftell (FILE* fp);
04866 static int fgetpos (FILE* fp, fpos_t* pos);
04867 static int fsetpos (FILE* fp, fpos_t* pos);
04868 static int fstat (ACE_HANDLE,
04869 ACE_stat *);
04870 static int lstat (const char *,
04871 ACE_stat *);
04872 static int ftruncate (ACE_HANDLE,
04873 off_t);
04874 static size_t fwrite (const void *ptr,
04875 size_t size,
04876 size_t nitems,
04877 FILE *fp);
04878 static void rewind (FILE *fp);
04879
04880
04881
04882 static void *bsearch (const void *key,
04883 const void *base,
04884 size_t nel,
04885 size_t size,
04886 ACE_COMPARE_FUNC);
04887 static void qsort (void *base,
04888 size_t nel,
04889 size_t width,
04890 ACE_COMPARE_FUNC);
04891
04892
04893
04894 static int flock_init (ACE_OS::ace_flock_t *lock,
04895 int flags = 0,
04896 const ACE_TCHAR *name = 0,
04897 mode_t perms = 0);
04898 static int flock_destroy (ACE_OS::ace_flock_t *lock,
04899 int unlink_file = 1);
04900 # if defined (ACE_WIN32)
04901 static void adjust_flock_params (ACE_OS::ace_flock_t *lock,
04902 short whence,
04903 off_t &start,
04904 off_t &len);
04905 # endif
04906 static int flock_rdlock (ACE_OS::ace_flock_t *lock,
04907 short whence = 0,
04908 off_t start = 0,
04909 off_t len = 0);
04910 static int flock_tryrdlock (ACE_OS::ace_flock_t *lock,
04911 short whence = 0,
04912 off_t start = 0,
04913 off_t len = 0);
04914 static int flock_trywrlock (ACE_OS::ace_flock_t *lock,
04915 short whence = 0,
04916 off_t start = 0,
04917 off_t len = 0);
04918 static int flock_unlock (ACE_OS::ace_flock_t *lock,
04919 short whence = 0,
04920 off_t start = 0,
04921 off_t len = 0);
04922 static int flock_wrlock (ACE_OS::ace_flock_t *lock,
04923 short whence = 0,
04924 off_t start = 0,
04925 off_t len = 0);
04926
04927
04928
04929 static int atexit (ACE_EXIT_HOOK func);
04930 static int execl (const char *path,
04931 const char *arg0, ...);
04932 static int execle (const char *path,
04933 const char *arg0, ...);
04934 static int execlp (const char *file,
04935 const char *arg0, ...);
04936 static int execv (const char *path,
04937 char *const argv[]);
04938 static int execvp (const char *file,
04939 char *const argv[]);
04940 static int execve (const char *path,
04941 char *const argv[],
04942 char *const envp[]);
04943 static void _exit (int status = 0);
04944 static void exit (int status = 0);
04945 static void abort (void);
04946 static pid_t fork (void);
04947
04948 static int getpagesize (void);
04949 static int allocation_granularity (void);
04950
04951 static gid_t getgid (void);
04952 static int setgid (gid_t);
04953 static pid_t getpid (void);
04954 static pid_t getpgid (pid_t pid);
04955 static pid_t getppid (void);
04956 static uid_t getuid (void);
04957 static int setuid (uid_t);
04958 static pid_t setsid (void);
04959 static int setpgid (pid_t pid, pid_t pgid);
04960 static int setreuid (uid_t ruid, uid_t euid);
04961 static int setregid (gid_t rgid, gid_t egid);
04962 static int system (const ACE_TCHAR *s);
04963
04964
04965
04966
04967
04968 static pid_t fork (const ACE_TCHAR *program_name);
04969 static pid_t fork_exec (ACE_TCHAR *argv[]);
04970
04971
04972
04973
04974
04975
04976
04977
04978
04979
04980 static pid_t waitpid (pid_t pid,
04981 ACE_exitcode *status = 0,
04982 int wait_options = 0,
04983 ACE_HANDLE handle = 0);
04984
04985
04986
04987
04988
04989
04990
04991
04992
04993
04994 static pid_t wait (pid_t pid,
04995 ACE_exitcode *status,
04996 int wait_options = 0,
04997 ACE_HANDLE handle = 0);
04998
04999
05000
05001 static pid_t wait (int * = 0);
05002
05003
05004 static u_int alarm (u_int secs);
05005 static u_int ualarm (u_int usecs,
05006 u_int interval = 0);
05007 static u_int ualarm (const ACE_Time_Value &tv,
05008 const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
05009 static ACE_hrtime_t gethrtime (const ACE_HRTimer_Op = ACE_HRTIMER_GETTIME);
05010 # if defined (ACE_HAS_POWERPC_TIMER) && (defined (ghs) || defined (__GNUG__))
05011 static void readPPCTimeBase (u_long &most,
05012 u_long &least);
05013 # endif
05014 static int clock_gettime (clockid_t,
05015 struct timespec *);
05016 static ACE_Time_Value gettimeofday (void);
05017 static int getrusage (int who,
05018 struct rusage *rusage);
05019 static int getrlimit (int resource,
05020 struct rlimit *rl);
05021 static int setrlimit (int resource,
05022 ACE_SETRLIMIT_TYPE *rl);
05023 static int sleep (u_int seconds);
05024 static int sleep (const ACE_Time_Value &tv);
05025 static int nanosleep (const struct timespec *requested,
05026 struct timespec *remaining = 0);
05027
05028 # if defined (ACE_HAS_BROKEN_R_ROUTINES)
05029 # undef ctime_r
05030 # undef asctime_r
05031 # undef rand_r
05032 # undef getpwnam_r
05033 # endif
05034
05035
05036
05037
05038
05039 static time_t mktime (struct tm *timeptr);
05040
05041
05042 static void tzset (void);
05043
05044 # if defined (timezone)
05045 # undef timezone
05046 # endif
05047 static long timezone (void);
05048
05049 # if defined (difftime)
05050 # undef difftime
05051 # endif
05052 static double difftime (time_t t1,
05053 time_t t0);
05054 static time_t time (time_t *tloc = 0);
05055 static struct tm *localtime (const time_t *clock);
05056 static struct tm *localtime_r (const time_t *clock,
05057 struct tm *res);
05058 static struct tm *gmtime (const time_t *clock);
05059 static struct tm *gmtime_r (const time_t *clock,
05060 struct tm *res);
05061 static char *asctime (const struct tm *tm);
05062 static char *asctime_r (const struct tm *tm,
05063 char *buf, int buflen);
05064 static ACE_TCHAR *ctime (const time_t *t);
05065 static ACE_TCHAR *ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen);
05066 static size_t strftime (char *s,
05067 size_t maxsize,
05068 const char *format,
05069 const struct tm *timeptr);
05070
05071
05072
05073 static int msgctl (int msqid,
05074 int cmd,
05075 struct msqid_ds *);
05076 static int msgget (key_t key,
05077 int msgflg);
05078 static int msgrcv (int int_id,
05079 void *buf,
05080 size_t len,
05081 long type,
05082 int flags);
05083 static int msgsnd (int int_id,
05084 const void *buf,
05085 size_t len,
05086 int flags);
05087
05088
05089
05090 static int madvise (caddr_t addr,
05091 size_t len,
05092 int advice);
05093 static void *mmap (void *addr,
05094 size_t len,
05095 int prot,
05096 int flags,
05097 ACE_HANDLE handle,
05098 off_t off = 0,
05099 ACE_HANDLE *file_mapping = 0,
05100 LPSECURITY_ATTRIBUTES sa = 0,
05101 const ACE_TCHAR *file_mapping_name = 0);
05102 static int mprotect (void *addr,
05103 size_t len,
05104 int prot);
05105 static int msync (void *addr,
05106 size_t len,
05107 int sync);
05108 static int munmap (void *addr,
05109 size_t len);
05110
05111
05112
05113 static int recursive_mutex_init (ACE_recursive_thread_mutex_t *m,
05114 const ACE_TCHAR *name = 0,
05115 ACE_mutexattr_t *arg = 0,
05116 LPSECURITY_ATTRIBUTES sa = 0);
05117 static int recursive_mutex_destroy (ACE_recursive_thread_mutex_t *m);
05118 static int recursive_mutex_lock (ACE_recursive_thread_mutex_t *m);
05119 static int recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m);
05120 static int recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m);
05121
05122
05123
05124 static int recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m,
05125 ACE_recursive_mutex_state &state);
05126 static void recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m,
05127 ACE_recursive_mutex_state &state);
05128
05129
05130
05131 static int mutex_init (ACE_mutex_t *m,
05132 int type = ACE_DEFAULT_SYNCH_TYPE,
05133 const char *name = 0,
05134 ACE_mutexattr_t *arg = 0,
05135 LPSECURITY_ATTRIBUTES sa = 0);
05136 #if defined (ACE_HAS_WCHAR)
05137 static int mutex_init (ACE_mutex_t *m,
05138 int type,
05139 const wchar_t *name,
05140 ACE_mutexattr_t *arg = 0,
05141 LPSECURITY_ATTRIBUTES sa = 0);
05142 #endif
05143 static int mutex_destroy (ACE_mutex_t *m);
05144
05145
05146
05147 static int mutex_lock (ACE_mutex_t *m);
05148
05149
05150
05151 static int mutex_lock (ACE_mutex_t *m,
05152 int &abandoned);
05153
05154
05155
05156
05157
05158
05159
05160
05161
05162
05163 static int mutex_lock (ACE_mutex_t *m,
05164 const ACE_Time_Value &timeout);
05165
05166
05167
05168
05169
05170
05171
05172
05173
05174
05175 static int mutex_lock (ACE_mutex_t *m,
05176 const ACE_Time_Value *timeout);
05177
05178
05179
05180 static int mutex_trylock (ACE_mutex_t *m);
05181
05182
05183
05184 static int mutex_trylock (ACE_mutex_t *m,
05185 int &abandoned);
05186
05187 static int mutex_unlock (ACE_mutex_t *m);
05188
05189
05190
05191 static int thread_mutex_init (ACE_thread_mutex_t *m,
05192 int type = ACE_DEFAULT_SYNCH_TYPE,
05193 const char *name = 0,
05194 ACE_mutexattr_t *arg = 0);
05195 #if defined (ACE_HAS_WCHAR)
05196 static int thread_mutex_init (ACE_thread_mutex_t *m,
05197 int type,
05198 const wchar_t *name,
05199 ACE_mutexattr_t *arg = 0);
05200 #endif
05201 static int thread_mutex_destroy (ACE_thread_mutex_t *m);
05202 static int thread_mutex_lock (ACE_thread_mutex_t *m);
05203 static int thread_mutex_lock (ACE_thread_mutex_t *m,
05204 const ACE_Time_Value &timeout);
05205 static int thread_mutex_lock (ACE_thread_mutex_t *m,
05206 const ACE_Time_Value *timeout);
05207 static int thread_mutex_trylock (ACE_thread_mutex_t *m);
05208 static int thread_mutex_unlock (ACE_thread_mutex_t *m);
05209
05210
05211
05212 static int access (const char *path, int amode);
05213 #if defined (ACE_HAS_WCHAR)
05214 static int access (const wchar_t *path, int amode);
05215 #endif
05216
05217 static int close (ACE_HANDLE handle);
05218 static ACE_HANDLE creat (const ACE_TCHAR *filename,
05219 mode_t mode);
05220 static ACE_HANDLE dup (ACE_HANDLE handle);
05221 static int dup2 (ACE_HANDLE oldfd,
05222 ACE_HANDLE newfd);
05223 static int fattach (int handle,
05224 const char *path);
05225 static long filesize (ACE_HANDLE handle);
05226 static long filesize (const ACE_TCHAR *handle);
05227 static int getmsg (ACE_HANDLE handle,
05228 struct strbuf *ctl,
05229 struct strbuf
05230 *data, int *flags);
05231 static int getpmsg (ACE_HANDLE handle,
05232 struct strbuf *ctl,
05233 struct strbuf
05234 *data,
05235 int *band,
05236 int *flags);
05237
05238
05239 static int ioctl (ACE_HANDLE handle,
05240 int cmd,
05241 void * = 0);
05242
05243 #if !defined (ACE_HAS_WINCE)
05244
05245 static int ioctl (ACE_HANDLE socket,
05246 u_long io_control_code,
05247 void *in_buffer_p,
05248 u_long in_buffer,
05249 void *out_buffer_p,
05250 u_long out_buffer,
05251 u_long *bytes_returned,
05252 ACE_OVERLAPPED *overlapped,
05253 ACE_OVERLAPPED_COMPLETION_FUNC func);
05254
05255
05256
05257 static int ioctl (ACE_HANDLE socket,
05258 u_long io_control_code,
05259 ACE_QoS &ace_qos,
05260 u_long *bytes_returned,
05261 void *buffer_p = 0,
05262 u_long buffer = 0,
05263 ACE_OVERLAPPED *overlapped = 0,
05264 ACE_OVERLAPPED_COMPLETION_FUNC func = 0);
05265 #endif // ACE_HAS_WINCE
05266
05267 static int isastream (ACE_HANDLE handle);
05268 static int isatty (int handle);
05269 #if defined (ACE_WIN32)
05270 static int isatty (ACE_HANDLE handle);
05271 #endif
05272 static off_t lseek (ACE_HANDLE handle,
05273 off_t offset,
05274 int whence);
05275 #if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
05276 static ACE_LOFF_T llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence);
05277 #endif
05278
05279
05280
05281
05282
05283
05284
05285 #if defined (ACE_WIN32)
05286 # if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1)
05287 # define ACE_DEFAULT_OPEN_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE | \
05288 FILE_SHARE_DELETE)
05289 # else
05290 # define ACE_DEFAULT_OPEN_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE)
05291 # endif
05292 #else
05293 # define ACE_DEFAULT_OPEN_PERMS 0
05294 #endif
05295
05296
05297
05298
05299
05300
05301
05302 static ACE_HANDLE open (const char *filename,
05303 int mode,
05304 int perms = ACE_DEFAULT_OPEN_PERMS,
05305 LPSECURITY_ATTRIBUTES sa = 0);
05306 #if defined (ACE_HAS_WCHAR)
05307 static ACE_HANDLE open (const wchar_t *filename,
05308 int mode,
05309 int perms = ACE_DEFAULT_OPEN_PERMS,
05310 LPSECURITY_ATTRIBUTES sa = 0);
05311 #endif
05312 static int putmsg (ACE_HANDLE handle,
05313 const struct strbuf *ctl,
05314 const struct strbuf *data,
05315 int flags);
05316 static int putpmsg (ACE_HANDLE handle,
05317 const struct strbuf *ctl,
05318 const struct strbuf *data,
05319 int band,
05320 int flags);
05321 static ssize_t read (ACE_HANDLE handle,
05322 void *buf,
05323 size_t len);
05324 static ssize_t read (ACE_HANDLE handle,
05325 void *buf,
05326 size_t len,
05327 ACE_OVERLAPPED *);
05328
05329
05330
05331
05332
05333
05334
05335
05336 static ssize_t read_n (ACE_HANDLE handle,
05337 void *buf,
05338 size_t len,
05339 size_t *bytes_transferred = 0);
05340
05341 static int readlink (const char *path,
05342 char *buf,
05343 size_t bufsiz);
05344 static ssize_t pread (ACE_HANDLE handle,
05345 void *buf,
05346 size_t nbyte,
05347 off_t offset);
05348 static int recvmsg (ACE_HANDLE handle,
05349 struct msghdr *msg,
05350 int flags);
05351 static int sendmsg (ACE_HANDLE handle,
05352 const struct msghdr *msg,
05353 int flags);
05354 static ssize_t write (ACE_HANDLE handle,
05355 const void *buf,
05356 size_t nbyte);
05357 static ssize_t write (ACE_HANDLE handle,
05358 const void *buf,
05359 size_t nbyte,
05360 ACE_OVERLAPPED *);
05361
05362
05363
05364
05365
05366
05367
05368
05369 static ssize_t write_n (ACE_HANDLE handle,
05370 const void *buf,
05371 size_t len,
05372 size_t *bytes_transferred = 0);
05373
05374 static ssize_t pwrite (ACE_HANDLE handle,
05375 const void *buf,
05376 size_t nbyte,
05377 off_t offset);
05378 static ssize_t readv (ACE_HANDLE handle,
05379 iovec *iov,
05380 int iovlen);
05381 static ssize_t writev (ACE_HANDLE handle,
05382 const iovec *iov,
05383 int iovcnt);
05384 static ssize_t recvv (ACE_HANDLE handle,
05385 iovec *iov,
05386 int iovlen);
05387 static ssize_t sendv (ACE_HANDLE handle,
05388 const iovec *iov,
05389 int iovcnt);
05390
05391
05392
05393 static int select (int width,
05394 fd_set *rfds,
05395 fd_set *wfds = 0,
05396 fd_set *efds = 0,
05397 const ACE_Time_Value *tv = 0);
05398 static int select (int width,
05399 fd_set *rfds,
05400 fd_set *wfds,
05401 fd_set *efds,
05402 const ACE_Time_Value &tv);
05403 static int poll (struct pollfd *pollfds,
05404 u_long len,
05405 const ACE_Time_Value *tv = 0);
05406 static int poll (struct pollfd *pollfds,
05407 u_long len,
05408 const ACE_Time_Value &tv);
05409 static int pipe (ACE_HANDLE handles[]);
05410
05411 static ACE_HANDLE shm_open (const ACE_TCHAR *filename,
05412 int mode,
05413 int perms = 0,
05414 LPSECURITY_ATTRIBUTES sa = 0);
05415 static int shm_unlink (const ACE_TCHAR *path);
05416
05417
05418
05419 static mode_t umask (mode_t cmask);
05420
05421 #if !defined (ACE_LACKS_CHDIR)
05422 static int chdir (const char *path);
05423
05424 #if defined (ACE_HAS_WCHAR)
05425 static int chdir (const wchar_t *path);
05426 #endif
05427 #endif
05428
05429 static int mkdir (const ACE_TCHAR *path,
05430 mode_t mode = ACE_DEFAULT_DIR_PERMS);
05431 static int mkfifo (const ACE_TCHAR *file,
05432 mode_t mode = ACE_DEFAULT_FILE_PERMS);
05433 static ACE_TCHAR *mktemp (ACE_TCHAR *t);
05434 static ACE_HANDLE mkstemp (ACE_TCHAR *t);
05435 static ACE_TCHAR *getcwd (ACE_TCHAR *, size_t);
05436 static int rename (const ACE_TCHAR *old_name,
05437 const ACE_TCHAR *new_name,
05438 int flags = -1);
05439 static int unlink (const ACE_TCHAR *path);
05440 static ACE_TCHAR *tempnam (const ACE_TCHAR *dir = 0,
05441 const ACE_TCHAR *pfx = 0);
05442
05443
05444
05445 static int rand (void);
05446 static int rand_r (ACE_RANDR_TYPE &seed);
05447 static void srand (u_int seed);
05448
05449
05450
05451 static int rwlock_init (ACE_rwlock_t *rw,
05452 int type = ACE_DEFAULT_SYNCH_TYPE,
05453 const ACE_TCHAR *name = 0,
05454 void *arg = 0);
05455 static int rwlock_destroy (ACE_rwlock_t *rw);
05456 static int rw_rdlock (ACE_rwlock_t *rw);
05457 static int rw_wrlock (ACE_rwlock_t *rw);
05458 static int rw_tryrdlock (ACE_rwlock_t *rw);
05459 static int rw_trywrlock (ACE_rwlock_t *rw);
05460 static int rw_trywrlock_upgrade (ACE_rwlock_t *rw);
05461 static int rw_unlock (ACE_rwlock_t *rw);
05462
05463
05464
05465 static int event_init (ACE_event_t *event,
05466 int manual_reset = 0,
05467 int initial_state = 0,
05468 int type = ACE_DEFAULT_SYNCH_TYPE,
05469 const char *name = 0,
05470 void *arg = 0,
05471 LPSECURITY_ATTRIBUTES sa = 0);
05472 # if defined (ACE_HAS_WCHAR)
05473 static int event_init (ACE_event_t *event,
05474 int manual_reset,
05475 int initial_state,
05476 int type,
05477 const wchar_t *name,
05478 void *arg = 0,
05479 LPSECURITY_ATTRIBUTES sa = 0);
05480 # endif
05481 static int event_destroy (ACE_event_t *event);
05482 static int event_wait (ACE_event_t *event);
05483 static int event_timedwait (ACE_event_t *event,
05484 ACE_Time_Value *timeout,
05485 int use_absolute_time = 1);
05486 static int event_signal (ACE_event_t *event);
05487 static int event_pulse (ACE_event_t *event);
05488 static int event_reset (ACE_event_t *event);
05489
05490
05491
05492 static int sema_destroy (ACE_sema_t *s);
05493 static int sema_init (ACE_sema_t *s,
05494 u_int count,
05495 int type = ACE_DEFAULT_SYNCH_TYPE,
05496 const char *name = 0,
05497 void *arg = 0,
05498 int max = 0x7fffffff,
05499 LPSECURITY_ATTRIBUTES sa = 0);
05500 # if defined (ACE_HAS_WCHAR)
05501 static int sema_init (ACE_sema_t *s,
05502 u_int count,
05503 int type,
05504 const wchar_t *name,
05505 void *arg = 0,
05506 int max = 0x7fffffff,
05507 LPSECURITY_ATTRIBUTES sa = 0);
05508 # endif
05509 static int sema_post (ACE_sema_t *s);
05510 static int sema_post (ACE_sema_t *s,
05511 u_int release_count);
05512 static int sema_trywait (ACE_sema_t *s);
05513 static int sema_wait (ACE_sema_t *s);
05514 static int sema_wait (ACE_sema_t *s,
05515 ACE_Time_Value &tv);
05516 static int sema_wait (ACE_sema_t *s,
05517 ACE_Time_Value *tv);
05518
05519
05520
05521 static int semctl (int int_id,
05522 int semnum,
05523 int cmd,
05524 semun);
05525 static int semget (key_t key,
05526 int nsems,
05527 int flags);
05528 static int semop (int int_id,
05529 struct sembuf *sops,
05530 size_t nsops);
05531
05532
05533
05534
05535
05536 static int sched_params (const ACE_Sched_Params &, ACE_id_t id = ACE_SELF);
05537
05538
05539
05540 static void *shmat (int int_id,
05541 void *shmaddr,
05542 int shmflg);
05543 static int shmctl (int int_id,
05544 int cmd,
05545 struct shmid_ds *buf);
05546 static int shmdt (void *shmaddr);
05547 static int shmget (key_t key,
05548 int size,
05549 int flags);
05550
05551
05552
05553 static int kill (pid_t pid,
05554 int signum);
05555 static int sigaction (int signum,
05556 const struct sigaction *nsa,
05557 struct sigaction *osa);
05558 static int sigaddset (sigset_t *s,
05559 int signum);
05560 static int sigdelset (sigset_t *s,
05561 int signum);
05562 static int sigemptyset (sigset_t *s);
05563 static int sigfillset (sigset_t *s);
05564 static int sigismember (sigset_t *s,
05565 int signum);
05566 static ACE_SignalHandler signal (int signum,
05567 ACE_SignalHandler);
05568 static int sigsuspend (const sigset_t *set);
05569 static int sigprocmask (int how,
05570 const sigset_t *nsp,
05571 sigset_t *osp);
05572
05573 static int pthread_sigmask (int how,
05574 const sigset_t *nsp,
05575 sigset_t *osp);
05576
05577
05578
05579
05580 static ACE_HANDLE accept (ACE_HANDLE handle,
05581 struct sockaddr *addr,
05582 int *addrlen);
05583
05584 #if !defined (ACE_HAS_WINCE)
05585
05586
05587
05588
05589
05590 static ACE_HANDLE accept (ACE_HANDLE handle,
05591 struct sockaddr *addr,
05592 int *addrlen,
05593 const ACE_Accept_QoS_Params &qos_params);
05594 #endif // ACE_HAS_WINCE
05595
05596
05597 static int connect (ACE_HANDLE handle,
05598 struct sockaddr *addr,
05599 int addrlen);
05600
05601 #if !defined (ACE_HAS_WINCE)
05602
05603
05604
05605
05606
05607 static int connect (ACE_HANDLE handle,
05608 const sockaddr *addr,
05609 int addrlen,
05610 const ACE_QoS_Params &qos_params);
05611 #endif // ACE_HAS_WINCE
05612
05613 static int bind (ACE_HANDLE s,
05614 struct sockaddr *name,
05615 int namelen);
05616
05617 static int closesocket (ACE_HANDLE s);
05618 static struct hostent *gethostbyaddr (const char *addr,
05619 int length,
05620 int type);
05621 static struct hostent *gethostbyname (const char *name);
05622 static struct hostent *getipnodebyname (const char *name, int family,
05623 int flags = 0);
05624 static struct hostent *getipnodebyaddr (const void *src, size_t len,
05625 int family);
05626 static struct hostent *gethostbyaddr_r (const char *addr,
05627 int length,
05628 int type,
05629 struct hostent *result,
05630 ACE_HOSTENT_DATA buffer,
05631 int *h_errnop);
05632 static struct hostent *gethostbyname_r (const char *name,
05633 struct hostent *result,
05634 ACE_HOSTENT_DATA buffer,
05635 int *h_errnop);
05636 static int getpeername (ACE_HANDLE handle,
05637 struct sockaddr *addr,
05638 int *addrlen);
05639 static struct protoent *getprotobyname (const char *name);
05640 static struct protoent *getprotobyname_r (const char *name,
05641 struct protoent *result,
05642 ACE_PROTOENT_DATA buffer);
05643 static struct protoent *getprotobynumber (int proto);
05644 static struct protoent *getprotobynumber_r (int proto,
05645 struct protoent *result,
05646 ACE_PROTOENT_DATA buffer);
05647 static struct servent *getservbyname (const char *svc,
05648 const char *proto);
05649 static struct servent *getservbyname_r (const char *svc,
05650 const char *proto,
05651 struct servent *result,
05652 ACE_SERVENT_DATA buf);
05653 static int getsockname (ACE_HANDLE handle,
05654 struct sockaddr *addr,
05655 int *addrlen);
05656 static int getsockopt (ACE_HANDLE handle,
05657 int level,
05658 int optname,
05659 char *optval,
05660 int *optlen);
05661 static unsigned long inet_addr (const char *name);
05662 static char *inet_ntoa (const struct in_addr addr);
05663 static int inet_aton (const char *strptr,
05664 struct in_addr *addr);
05665 static const char *inet_ntop (int family,
05666 const void *addrptr,
05667 char *strptr,
05668 size_t len);
05669 static int inet_pton (int family,
05670 const char *strptr,
05671 void *addrptr);
05672
05673
05674 static int enum_protocols (int *protocols,
05675 ACE_Protocol_Info *protocol_buffer,
05676 u_long *buffer_length);
05677
05678 #if !defined (ACE_HAS_WINCE)
05679
05680 static ACE_HANDLE join_leaf (ACE_HANDLE socket,
05681 const sockaddr *name,
05682 int namelen,
05683 const ACE_QoS_Params &qos_params);
05684 #endif // ACE_HAS_WINCE
05685
05686 static int listen (ACE_HANDLE handle,
05687 int backlog);
05688 static int recv (ACE_HANDLE handle,
05689 char *buf,
05690 size_t len,
05691 int flags = 0);
05692 static int recvfrom (ACE_HANDLE handle,
05693 char *buf,
05694 size_t len,
05695 int flags,
05696 struct sockaddr *addr,
05697 int *addrlen);
05698 static int recvfrom (ACE_HANDLE handle,
05699 iovec *buffers,
05700 int buffer_count,
05701 size_t &number_of_bytes_recvd,
05702 int &flags,
05703 struct sockaddr *addr,
05704 int *addrlen,
05705 ACE_OVERLAPPED *overlapped,
05706 ACE_OVERLAPPED_COMPLETION_FUNC func);
05707 static int send (ACE_HANDLE handle,
05708 const char *buf,
05709 size_t len,
05710 int flags = 0);
05711 static int sendto (ACE_HANDLE handle,
05712 const char *buf,
05713 size_t len,
05714 int flags,
05715 const struct sockaddr *addr,
05716 int addrlen);
05717 static int sendto (ACE_HANDLE handle,
05718 const iovec *buffers,
05719 int buffer_count,
05720 size_t &number_of_bytes_sent,
05721 int flags,
05722 const struct sockaddr *addr,
05723 int addrlen,
05724 ACE_OVERLAPPED *overlapped,
05725 ACE_OVERLAPPED_COMPLETION_FUNC func);
05726
05727
05728 static int setsockopt (ACE_HANDLE handle,
05729 int level,
05730 int optname,
05731 const char *optval,
05732 int optlen);
05733 static int shutdown (ACE_HANDLE handle,
05734 int how);
05735
05736
05737 static ACE_HANDLE socket (int protocol_family,
05738 int type,
05739 int proto);
05740
05741
05742
05743 static ACE_HANDLE socket (int protocol_family,
05744 int type,
05745 int proto,
05746 ACE_Protocol_Info *protocolinfo,
05747 ACE_SOCK_GROUP g,
05748 u_long flags);
05749
05750 static int socketpair (int domain,
05751 int type,
05752 int protocol,
05753 ACE_HANDLE sv[2]);
05754
05755
05756
05757 static int socket_init (int version_high = 1,
05758 int version_low = 1);
05759
05760
05761 static int socket_fini (void);
05762
05763
05764
05765 static void setpwent (void);
05766 static void endpwent (void);
05767 static struct passwd *getpwent (void);
05768 static struct passwd *getpwnam (const char *user);
05769 static struct passwd *getpwnam_r (const char *name,
05770 struct passwd *pwent,
05771 char *buffer,
05772 int buflen);
05773
05774
05775
05776 static char *compile (const char *instring,
05777 char *expbuf,
05778 char *endbuf);
05779 static int step (const char *str,
05780 char *expbuf);
05781
05782
05783
05784
05785
05786
05787
05788
05789
05790
05791
05792 #if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
05793 typedef wchar_t WChar;
05794 #else
05795 typedef ACE_UINT16 WChar;
05796 #endif
05797 static u_int wslen (const WChar *);
05798 static WChar *wscpy (WChar *,
05799 const WChar *);
05800 static int wscmp (const WChar *,
05801 const WChar *);
05802 static int wsncmp (const WChar *,
05803 const WChar *,
05804 size_t len);
05805
05806
05807 # if 0
05808
05809 static int thr_continue (const ACE_Thread_ID &thread);
05810 static int thr_create (ACE_THR_FUNC,
05811 void *args,
05812 long flags,
05813 ACE_Thread_ID *,
05814 long priority = ACE_DEFAULT_THREAD_PRIORITY,
05815 void *stack = 0,
05816 size_t stacksize = 0);
05817 static int thr_getprio (ACE_Thread_ID thr_id,
05818 int &prio,
05819 int *policy = 0);
05820 static int thr_join (ACE_Thread_ID waiter_id,
05821 ACE_THR_FUNC_RETURN *status);
05822 static int thr_kill (ACE_Thread_ID thr_id,
05823 int signum);
05824 static ACE_Thread_ID thr_self (void);
05825 static int thr_setprio (ACE_Thread_ID thr_id,
05826 int prio);
05827 static int thr_setprio (const ACE_Sched_Priority prio);
05828 static int thr_suspend (ACE_Thread_ID target_thread);
05829 static int thr_cancel (ACE_Thread_ID t_id);
05830
05831 # endif
05832
05833
05834
05835
05836
05837 static int thr_continue (ACE_hthread_t target_thread);
05838
05839
05840
05841
05842
05843
05844
05845
05846
05847
05848
05849
05850
05851
05852
05853
05854
05855
05856
05857
05858
05859
05860
05861
05862
05863
05864
05865
05866
05867
05868
05869 static int thr_create (ACE_THR_FUNC func,
05870 void *args,
05871 long flags,
05872 ACE_thread_t *thr_id,
05873 ACE_hthread_t *t_handle = 0,
05874 long priority = ACE_DEFAULT_THREAD_PRIORITY,
05875 void *stack = 0,
05876 size_t stacksize = 0,
05877 ACE_Base_Thread_Adapter *thread_adapter = 0);
05878
05879 static int thr_join (ACE_hthread_t waiter_id,
05880 ACE_THR_FUNC_RETURN *status);
05881 static int thr_join (ACE_thread_t waiter_id,
05882 ACE_thread_t *thr_id,
05883 ACE_THR_FUNC_RETURN *status);
05884 static int thr_kill (ACE_thread_t thr_id,
05885 int signum);
05886 static ACE_thread_t thr_self (void);
05887 static void thr_self (ACE_hthread_t &);
05888 static int thr_getprio (ACE_hthread_t id,
05889 int &priority);
05890 static int thr_getprio (ACE_hthread_t id,
05891 int &priority,
05892 int &policy);
05893 static int thr_setprio (ACE_hthread_t id,
05894 int priority,
05895 int policy = -1);
05896 static int thr_setprio (const ACE_Sched_Priority prio);
05897 static int thr_suspend (ACE_hthread_t target_thread);
05898 static int thr_cancel (ACE_thread_t t_id);
05899
05900 static int thr_cmp (ACE_hthread_t t1,
05901 ACE_hthread_t t2);
05902 static int thr_equal (ACE_thread_t t1,
05903 ACE_thread_t t2);
05904 static void thr_exit (ACE_THR_FUNC_RETURN status = 0);
05905 static int thr_getconcurrency (void);
05906 static int lwp_getparams (ACE_Sched_Params &);
05907 # if defined (ACE_HAS_TSS_EMULATION) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
05908 static int thr_getspecific (ACE_OS_thread_key_t key,
05909 void **data);
05910 # endif
05911 static int thr_getspecific (ACE_thread_key_t key,
05912 void **data);
05913 static int thr_keyfree (ACE_thread_key_t key);
05914 static int thr_key_detach (void *inst);
05915 # if defined (ACE_HAS_THR_C_DEST)
05916 # if defined (ACE_HAS_TSS_EMULATION) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
05917 static int thr_keycreate (ACE_OS_thread_key_t *key,
05918 ACE_THR_C_DEST,
05919 void *inst = 0);
05920 # endif
05921 static int thr_keycreate (ACE_thread_key_t *key,
05922 ACE_THR_C_DEST,
05923 void *inst = 0);
05924 # else
05925 # if defined (ACE_HAS_TSS_EMULATION) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
05926 static int thr_keycreate (ACE_OS_thread_key_t *key,
05927 ACE_THR_DEST,
05928 void *inst = 0);
05929 # endif
05930 static int thr_keycreate (ACE_thread_key_t *key,
05931 ACE_THR_DEST,
05932 void *inst = 0);
05933 # endif
05934 static int thr_key_used (ACE_thread_key_t key);
05935 static size_t thr_min_stack (void);
05936 static int thr_setconcurrency (int hint);
05937 static int lwp_setparams (const ACE_Sched_Params &);
05938 # if defined (ACE_HAS_TSS_EMULATION) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
05939 static int thr_setspecific (ACE_OS_thread_key_t key,
05940 void *data);
05941 # endif
05942 static int thr_setspecific (ACE_thread_key_t key,
05943 void *data);
05944 static int thr_sigsetmask (int how,
05945 const sigset_t *nsm,
05946 sigset_t *osm);
05947 static int thr_setcancelstate (int new_state,
05948 int *old_state);
05949 static int thr_setcanceltype (int new_type,
05950 int *old_type);
05951 static int sigwait (sigset_t *set,
05952 int *sig = 0);
05953 static int sigtimedwait (const sigset_t *set,
05954 siginfo_t *info,
05955 const ACE_Time_Value *timeout);
05956 static int sigwaitinfo (const sigset_t *set,
05957 siginfo_t *info);
05958 static void thr_testcancel (void);
05959 static void thr_yield (void);
05960
05961
05962
05963
05964
05965
05966
05967
05968
05969 static void unique_name (const void *object,
05970 ACE_TCHAR *name,
05971 size_t length);
05972
05973
05974
05975 static ACE_thread_t NULL_thread;
05976
05977
05978
05979 static ACE_hthread_t NULL_hthread;
05980
05981
05982
05983 static ACE_thread_key_t NULL_key;
05984
05985 # if defined (CHORUS)
05986
05987
05988 static KnCap actorcaps_[ACE_CHORUS_MAX_ACTORS];
05989 # endif
05990
05991
05992 # if defined (ACE_WIN32)
05993
05994 static int socket_initialized_;
05995 # endif
05996
05997
05998 static void mutex_lock_cleanup (void *mutex);
05999
06000
06001
06002
06003
06004
06005 static void cleanup_tss (const u_int main_thread);
06006
06007 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
06008 static int netdb_acquire (void);
06009 static int netdb_release (void);
06010 # endif
06011
06012
06013 static int scheduling_class (const char *class_name, ACE_id_t &);
06014
06015
06016 static int set_scheduling_params (const ACE_Sched_Params &,
06017 ACE_id_t id = ACE_SELF);
06018
06019
06020
06021
06022
06023
06024 static int priority_control (ACE_idtype_t, ACE_id_t, int, void *);
06025
06026 #if defined (ACE_HAS_STRPTIME)
06027 static char *strptime (char *buf,
06028 const char *format,
06029 struct tm *tm);
06030
06031 # if defined (ACE_LACKS_NATIVE_STRPTIME)
06032 static int strptime_getnum (char *buf, int *num, int *bi,
06033 int *fi, int min, int max);
06034 # endif
06035 #endif
06036
06037
06038 static long num_processors (void);
06039
06040
06041 static long num_processors_online (void);
06042
06043 private:
06044
06045 #if defined (ACE_LACKS_WRITEV)
06046 static int writev_emulation (ACE_HANDLE handle,
06047 ACE_WRITEV_TYPE *iov,
06048 int iovcnt);
06049 #endif
06050
06051 #if defined (ACE_LACKS_READV)
06052 static ssize_t readv_emulation (ACE_HANDLE handle,
06053 ACE_READV_TYPE *iov,
06054 int iovcnt);
06055 #endif
06056
06057
06058 static ACE_EXIT_HOOK exit_hook_;
06059
06060
06061 static ACE_EXIT_HOOK set_exit_hook (ACE_EXIT_HOOK hook);
06062
06063
06064 friend class ACE_OS_Object_Manager;
06065
06066 # if defined (ACE_WIN32)
06067 # if defined (ACE_HAS_WINCE)
06068
06069 static const wchar_t *day_of_week_name[7];
06070 static const wchar_t *month_name[12];
06071 # endif
06072
06073
06074
06075 static void fopen_mode_to_open_mode_converter (ACE_TCHAR x, int &hmode);
06076
06077 static OSVERSIONINFO win32_versioninfo_;
06078
06079 static HINSTANCE win32_resource_module_;
06080
06081 # endif
06082
06083 #if defined (ACE_HAS_VIRTUAL_TIME)
06084 static clock_t times (struct tms *buf);
06085 #endif
06086
06087
06088
06089 static int cond_timedwait_i (ACE_cond_t *cv,
06090 ACE_mutex_t *m,
06091 ACE_Time_Value *);
06092
06093 static u_int alarm_i (u_int secs);
06094
06095 static u_int ualarm_i (u_int usecs, u_int interval = 0);
06096
06097 static u_int ualarm_i (const ACE_Time_Value &tv,
06098 const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
06099
06100 static int sleep_i (u_int seconds);
06101
06102 static int sleep_i (const ACE_Time_Value &tv);
06103
06104 static int nanosleep_i (const struct timespec *requested,
06105 struct timespec *remaining = 0);
06106
06107 static int select_i (int width,
06108 fd_set *rfds,
06109 fd_set *wfds,
06110 fd_set *efds,
06111 const ACE_Time_Value *tv = 0);
06112
06113 static int select_i (int width,
06114 fd_set *rfds,
06115 fd_set *wfds,
06116 fd_set *efds,
06117 const ACE_Time_Value &tv);
06118
06119 static int poll_i (struct pollfd *pollfds,
06120 u_long len,
06121 const ACE_Time_Value *tv = 0);
06122
06123 static int poll_i (struct pollfd *pollfds,
06124 u_long len,
06125 const ACE_Time_Value &tv);
06126
06127 static int sema_wait_i (ACE_sema_t *s);
06128
06129 static int sema_wait_i (ACE_sema_t *s,
06130 ACE_Time_Value &tv);
06131
06132 static int sigtimedwait_i (const sigset_t *set,
06133 siginfo_t *info,
06134 const ACE_Time_Value *timeout);
06135
06136 static ACE_Time_Value gettimeofday_i (void);
06137 };
06138
06139
06140
06141
06142
06143
06144
06145
06146 class ACE_OS_Export ACE_Object_Manager_Base
06147 {
06148 # if (defined (ACE_PSOS) && defined (__DIAB)) || \
06149 (defined (__DECCXX_VER) && __DECCXX_VER < 60000000)
06150
06151
06152
06153 public:
06154 # else
06155 protected:
06156 # endif
06157
06158 ACE_Object_Manager_Base (void);
06159
06160
06161 virtual ~ACE_Object_Manager_Base (void);
06162
06163 public:
06164
06165
06166
06167
06168
06169 virtual int init (void) = 0;
06170
06171
06172
06173
06174
06175
06176 virtual int fini (void) = 0;
06177
06178 enum Object_Manager_State
06179 {
06180 OBJ_MAN_UNINITIALIZED = 0,
06181 OBJ_MAN_INITIALIZING,
06182 OBJ_MAN_INITIALIZED,
06183 OBJ_MAN_SHUTTING_DOWN,
06184 OBJ_MAN_SHUT_DOWN
06185 };
06186
06187 protected:
06188
06189
06190
06191
06192
06193
06194
06195
06196
06197 int starting_up_i (void);
06198
06199
06200
06201
06202
06203
06204
06205
06206 int shutting_down_i (void);
06207
06208
06209 Object_Manager_State object_manager_state_;
06210
06211
06212
06213
06214
06215
06216
06217 u_int dynamically_allocated_;
06218
06219
06220 ACE_Object_Manager_Base *next_;
06221 private:
06222
06223 ACE_Object_Manager_Base (const ACE_Object_Manager_Base &);
06224 ACE_Object_Manager_Base &operator= (const ACE_Object_Manager_Base &);
06225 };
06226
06227 extern "C"
06228 void
06229 ACE_OS_Object_Manager_Internal_Exit_Hook (void);
06230
06231
06232
06233 class ACE_Log_Msg;
06234
06235 class ACE_OS_Export ACE_OS_Object_Manager : public ACE_Object_Manager_Base
06236 {
06237 public:
06238
06239 virtual int init (void);
06240
06241
06242 virtual int fini (void);
06243
06244
06245
06246
06247
06248
06249 static int starting_up (void);
06250
06251
06252
06253 static int shutting_down (void);
06254
06255
06256 enum Preallocated_Object
06257 {
06258 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
06259 ACE_OS_MONITOR_LOCK,
06260 ACE_TSS_CLEANUP_LOCK,
06261 ACE_LOG_MSG_INSTANCE_LOCK,
06262 # if defined (ACE_HAS_TSS_EMULATION)
06263 ACE_TSS_KEY_LOCK,
06264 # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
06265 ACE_TSS_BASE_LOCK,
06266 # endif
06267 # endif
06268 # else
06269
06270
06271
06272 ACE_OS_EMPTY_PREALLOCATED_OBJECT,
06273 # endif
06274
06275
06276 ACE_OS_PREALLOCATED_OBJECTS
06277 };
06278
06279
06280
06281 static sigset_t *default_mask (void);
06282
06283
06284 static ACE_Thread_Hook *thread_hook (void);
06285
06286
06287 static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *new_thread_hook);
06288
06289 #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
06290
06291 static ACE_SEH_EXCEPT_HANDLER seh_except_selector (void);
06292 static ACE_SEH_EXCEPT_HANDLER seh_except_selector (ACE_SEH_EXCEPT_HANDLER);
06293
06294 static ACE_SEH_EXCEPT_HANDLER seh_except_handler (void);
06295 static ACE_SEH_EXCEPT_HANDLER seh_except_handler (ACE_SEH_EXCEPT_HANDLER);
06296 #endif
06297
06298 public:
06299
06300
06301
06302
06303
06304
06305 ACE_OS_Object_Manager (void);
06306
06307
06308 ~ACE_OS_Object_Manager (void);
06309
06310 private:
06311
06312 static ACE_OS_Object_Manager *instance (void);
06313
06314
06315 static ACE_OS_Object_Manager *instance_;
06316
06317
06318 static void *preallocated_object[ACE_OS_PREALLOCATED_OBJECTS];
06319
06320
06321 sigset_t *default_mask_;
06322
06323
06324 ACE_Thread_Hook *thread_hook_;
06325
06326
06327 ACE_OS_Exit_Info exit_info_;
06328
06329 #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
06330
06331
06332 ACE_SEH_EXCEPT_HANDLER seh_except_selector_;
06333 ACE_SEH_EXCEPT_HANDLER seh_except_handler_;
06334 #endif
06335
06336
06337 int at_exit (ACE_EXIT_HOOK func);
06338
06339
06340 static void print_error_message (u_int line_number, const ACE_TCHAR *message);
06341
06342
06343 friend class ACE_OS;
06344 friend class ACE_Object_Manager;
06345 friend class ACE_OS_Object_Manager_Manager;
06346 friend class ACE_TSS_Cleanup;
06347 friend class ACE_TSS_Emulation;
06348 friend class ACE_Log_Msg;
06349 friend void ACE_OS_Object_Manager_Internal_Exit_Hook ();
06350 };
06351
06352 # if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
06353 extern "C" ssize_t recv_timedwait (ACE_HANDLE handle,
06354 char *buf,
06355 int len,
06356 int flags,
06357 struct timespec *timeout);
06358 extern "C" ssize_t read_timedwait (ACE_HANDLE handle,
06359 char *buf,
06360 size_t n,
06361 struct timespec *timeout);
06362 extern "C" ssize_t recvmsg_timedwait (ACE_HANDLE handle,
06363 struct msghdr *msg,
06364 int flags,
06365 struct timespec *timeout);
06366 extern "C" ssize_t recvfrom_timedwait (ACE_HANDLE handle,
06367 char *buf,
06368 int len,
06369 int flags,
06370 struct sockaddr *addr,
06371 int
06372 *addrlen,
06373 struct timespec *timeout);
06374 extern "C" ssize_t readv_timedwait (ACE_HANDLE handle,
06375 iovec *iov,
06376 int iovcnt,
06377 struct timespec* timeout);
06378 extern "C" ssize_t send_timedwait (ACE_HANDLE handle,
06379 const char *buf,
06380 int len,
06381 int flags,
06382 struct timespec *timeout);
06383 extern "C" ssize_t write_timedwait (ACE_HANDLE handle,
06384 const void *buf,
06385 size_t n,
06386 struct timespec *timeout);
06387 extern "C" ssize_t sendmsg_timedwait (ACE_HANDLE handle,
06388 ACE_SENDMSG_TYPE *msg,
06389 int flags,
06390 struct timespec *timeout);
06391 extern "C" ssize_t sendto_timedwait (ACE_HANDLE handle,
06392 const char *buf,
06393 int len,
06394 int flags,
06395 const struct sockaddr *addr,
06396 int addrlen,
06397 struct timespec *timeout);
06398 extern "C" ssize_t writev_timedwait (ACE_HANDLE handle,
06399 ACE_WRITEV_TYPE *iov,
06400 int iovcnt,
06401 struct timespec *timeout);
06402 # endif
06403
06404 # if defined (ACE_HAS_TSS_EMULATION)
06405
06406 # if !defined (ACE_DEFAULT_THREAD_KEYS)
06407 # define ACE_DEFAULT_THREAD_KEYS 64
06408 # endif
06409
06410
06411 class ACE_TSS_Keys;
06412
06413
06414
06415
06416
06417
06418
06419
06420
06421
06422
06423 class ACE_OS_Export ACE_TSS_Emulation
06424 {
06425 public:
06426 typedef void (*ACE_TSS_DESTRUCTOR)(void *value) ;
06427
06428
06429 enum { ACE_TSS_THREAD_KEYS_MAX = ACE_DEFAULT_THREAD_KEYS };
06430
06431
06432 static u_int total_keys ();
06433
06434
06435
06436 static int next_key (ACE_thread_key_t &key);
06437
06438
06439
06440 static int release_key (ACE_thread_key_t key);
06441
06442
06443
06444 static ACE_TSS_DESTRUCTOR tss_destructor (const ACE_thread_key_t key);
06445
06446
06447
06448 static void tss_destructor (const ACE_thread_key_t key,
06449 ACE_TSS_DESTRUCTOR destructor);
06450
06451
06452
06453 static void *&ts_object (const ACE_thread_key_t key);
06454
06455
06456
06457
06458
06459
06460
06461
06462
06463
06464
06465 static void *tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX]);
06466
06467
06468 static void tss_close ();
06469
06470 private:
06471
06472
06473
06474 static u_int total_keys_;
06475
06476
06477
06478 static ACE_TSS_DESTRUCTOR tss_destructor_ [ACE_TSS_THREAD_KEYS_MAX];
06479
06480
06481
06482 static ACE_TSS_Keys tss_keys_used_;
06483
06484 # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
06485
06486 static void **tss_base (void* ts_storage[] = 0, u_int *ts_created = 0);
06487 # else
06488
06489 static void **&tss_base ();
06490 # endif
06491
06492 # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)
06493
06494
06495 static ACE_OS_thread_key_t native_tss_key_;
06496
06497
06498 static int key_created_;
06499 # endif
06500 };
06501
06502 # else
06503 # if defined (TLS_MINIMUM_AVAILABLE)
06504
06505 # define ACE_DEFAULT_THREAD_KEYS TLS_MINIMUM_AVAILABLE
06506 # endif
06507
06508 # endif
06509
06510
06511
06512
06513 # if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) || (defined (ACE_PSOS) && defined (ACE_PSOS_HAS_TSS))
06514
06515
06516
06517
06518
06519
06520
06521
06522 class ACE_TSS_Ref
06523 {
06524 public:
06525
06526 ACE_TSS_Ref (ACE_thread_t id);
06527
06528
06529 ACE_TSS_Ref (void);
06530
06531
06532 int operator== (const ACE_TSS_Ref &) const;
06533
06534
06535 int operator!= (const ACE_TSS_Ref &) const;
06536
06537
06538
06539
06540 ACE_thread_t tid_;
06541 };
06542
06543
06544
06545
06546
06547
06548
06549
06550 class ACE_TSS_Info
06551 {
06552 public:
06553
06554 ACE_TSS_Info (ACE_thread_key_t key,
06555 void (*dest)(void *) = 0,
06556 void *tss_inst = 0);
06557
06558
06559 ACE_TSS_Info (void);
06560
06561
06562 int key_in_use (void) const { return thread_count_ != -1; }
06563
06564
06565
06566 void key_in_use (int flag) { thread_count_ = flag == 0 ? -1 : 1; }
06567
06568
06569 int operator== (const ACE_TSS_Info &) const;
06570
06571
06572 int operator!= (const ACE_TSS_Info &) const;
06573
06574
06575 void dump (void);
06576
06577 private:
06578
06579 ACE_thread_key_t key_;
06580
06581
06582 void (*destructor_)(void *);
06583
06584
06585 void *tss_obj_;
06586
06587
06588
06589 int thread_count_;
06590
06591 friend class ACE_TSS_Cleanup;
06592 };
06593
06594
06595
06596
06597
06598
06599
06600
06601
06602
06603
06604
06605 class ACE_TSS_Keys
06606 {
06607 public:
06608
06609 ACE_TSS_Keys (void);
06610
06611
06612
06613 int test_and_set (const ACE_thread_key_t key);
06614
06615
06616
06617 int test_and_clear (const ACE_thread_key_t key);
06618
06619
06620
06621 int is_set (const ACE_thread_key_t key) const;
06622
06623 private:
06624
06625 static void find (const u_int key, u_int &word, u_int &bit);
06626
06627 enum
06628 {
06629 # if ACE_SIZEOF_LONG == 8
06630 ACE_BITS_PER_WORD = 64,
06631 # elif ACE_SIZEOF_LONG == 4
06632 ACE_BITS_PER_WORD = 32,
06633 # else
06634 # error ACE_TSS_Keys only supports 32 or 64 bit longs.
06635 # endif
06636 ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1
06637 };
06638
06639
06640
06641 u_long key_bit_words_[ACE_WORDS];
06642 };
06643
06644 # endif
06645
06646
06647
06648 # if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T)
06649 # define ACE_KEY_INDEX(OBJ,KEY) \
06650 u_int OBJ; \
06651 ACE_OS::memcpy (&OBJ, &KEY, sizeof (u_int))
06652 # else
06653 # define ACE_KEY_INDEX(OBJ,KEY) u_int OBJ = KEY
06654 # endif
06655
06656
06657
06658
06659
06660 # define ACE_ALLOCATOR_RETURN(POINTER,ALLOCATOR,RET_VAL) \
06661 do { POINTER = ALLOCATOR; \
06662 if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
06663 } while (0)
06664 # define ACE_ALLOCATOR(POINTER,ALLOCATOR) \
06665 do { POINTER = ALLOCATOR; \
06666 if (POINTER == 0) { errno = ENOMEM; return; } \
06667 } while (0)
06668 # define ACE_ALLOCATOR_NORETURN(POINTER,ALLOCATOR) \
06669 do { POINTER = ALLOCATOR; \
06670 if (POINTER == 0) { errno = ENOMEM; } \
06671 } while (0)
06672
06673 # define ACE_NEW_MALLOC_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,RET_VAL) \
06674 do { POINTER = ALLOCATOR; \
06675 if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \
06676 else { new (POINTER) CONSTRUCTOR; } \
06677 } while (0)
06678 # define ACE_NEW_MALLOC(POINTER,ALLOCATOR,CONSTRUCTOR) \
06679 do { POINTER = ALLOCATOR; \
06680 if (POINTER == 0) { errno = ENOMEM; return;} \
06681 else { new (POINTER) CONSTRUCTOR; } \
06682 } while (0)
06683 # define ACE_NEW_MALLOC_NORETURN(POINTER,ALLOCATOR,CONSTRUCTOR) \
06684 do { POINTER = ALLOCATOR; \
06685 if (POINTER == 0) { errno = ENOMEM;} \
06686 else { new (POINTER) CONSTRUCTOR; } \
06687 } while (0)
06688
06689 # define ACE_NOOP(x)
06690
06691 # if defined (ACE_HAS_THR_C_FUNC)
06692
06693 extern "C" ACE_OS_Export void ace_mutex_lock_cleanup_adapter (void *args);
06694 # define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ace_mutex_lock_cleanup_adapter, (void *) A);
06695 # define ACE_PTHREAD_CLEANUP_POP(A) pthread_cleanup_pop(A)
06696 # elif defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CLEANUP)
06697
06698
06699
06700
06701 extern "C" ACE_OS_Export void ace_mutex_lock_cleanup_adapter (void *args);
06702 # define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ace_mutex_lock_cleanup_adapter, (void *) A);
06703 # define ACE_PTHREAD_CLEANUP_POP(A) pthread_cleanup_pop(A)
06704 # else
06705 # define ACE_PTHREAD_CLEANUP_PUSH(A)
06706 # define ACE_PTHREAD_CLEANUP_POP(A)
06707 # endif
06708
06709 # if !defined (ACE_DEFAULT_MUTEX_A)
06710 # define ACE_DEFAULT_MUTEX_A "ACE_MUTEX"
06711 # endif
06712
06713 # if defined (ACE_HAS_WCHAR)
06714 # define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A)
06715 # endif
06716
06717 # define ACE_DEFAULT_MUTEX ACE_LIB_TEXT (ACE_DEFAULT_MUTEX_A)
06718
06719 # if !defined (ACE_MAIN)
06720 # define ACE_MAIN main
06721 # endif
06722
06723 # if !defined (ACE_WMAIN)
06724 # define ACE_WMAIN wmain
06725 # endif
06726
06727 # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
06728 # define ACE_TMAIN wmain
06729 # else
06730 # define ACE_TMAIN main
06731 # endif
06732
06733 # if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
06734 # if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER)
06735 # define ACE_HAS_NONSTATIC_OBJECT_MANAGER
06736 # endif
06737 # endif
06738
06739 # if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
06740
06741 # if !defined (ACE_HAS_MINIMAL_ACE_OS)
06742 # include "ace/Object_Manager.h"
06743 # endif
06744
06745
06746
06747
06748
06749
06750
06751
06752 # if !defined (ACE_MAIN_OBJECT_MANAGER)
06753 # define ACE_MAIN_OBJECT_MANAGER \
06754 ACE_OS_Object_Manager ace_os_object_manager; \
06755 ACE_Object_Manager ace_object_manager;
06756 # endif
06757
06758 # if defined (ACE_PSOSIM)
06759
06760
06761
06762
06763 # define main \
06764 ace_main_i (int, char *[]); \
06765 ACE_MAIN () \
06766 { \
06767 int argc = 1; \
06768 char *argv[] = {"psosim"}; \
06769 ACE_MAIN_OBJECT_MANAGER \
06770 int ret_val = -1; \
06771 if (ACE_PSOS_Time_t::init_simulator_time ()) \
06772 { \
06773 ACE_ERROR((LM_ERROR, "init_simulator_time failed\n")); \
06774 } \
06775 else \
06776 { \
06777 ret_val = ace_main_i (argc, argv); \
06778 } \
06779 ACE_OS::exit (ret_val); \
06780 } \
06781 int \
06782 ace_main_i
06783 # elif defined (ACE_PSOS) && defined (ACE_PSOS_LACKS_ARGC_ARGV)
06784
06785
06786
06787
06788 # define main \
06789 ace_main_i (int, char *[]); \
06790 ACE_MAIN () \
06791 { \
06792 int argc = 1; \
06793 char *argv[] = {"root"}; \
06794 ACE_MAIN_OBJECT_MANAGER \
06795 ace_main_i (argc, argv); \
06796 } \
06797 int \
06798 ace_main_i
06799 # elif defined (ACE_HAS_WINCE)
06800
06801
06802
06803
06804
06805
06806
06807
06808
06809
06810
06811
06812
06813
06814
06815
06816
06817 class ACE_OS_Export ACE_CE_ARGV
06818 {
06819 public:
06820
06821
06822
06823 ACE_CE_ARGV(ACE_TCHAR* cmdLine);
06824
06825
06826
06827
06828 ~ACE_CE_ARGV(void);
06829
06830
06831
06832
06833 int argc(void);
06834
06835
06836
06837
06838 ACE_TCHAR** const argv(void);
06839
06840 private:
06841
06842
06843
06844 ACE_CE_ARGV(void);
06845
06846
06847
06848
06849 ACE_CE_ARGV(ACE_CE_ARGV&);
06850
06851
06852
06853
06854 ACE_TCHAR** ce_argv_;
06855
06856
06857
06858
06859 int ce_argc_;
06860 };
06861 # if defined (ACE_TMAIN) // Use WinMain on CE; others give warning/error.
06862 # undef ACE_TMAIN
06863 # endif // ACE_TMAIN
06864
06865
06866 # define ACE_TMAIN \
06867 ace_main_i (int, ACE_TCHAR *[]); \
06868 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
06869 { \
06870 ACE_CE_ARGV ce_argv(lpCmdLine); \
06871 ACE::init(); \
06872 ACE_MAIN_OBJECT_MANAGER \
06873 int i = ace_main_i (ce_argv.argc(), ce_argv.argv()); \
06874 ACE::fini(); \
06875 return i; \
06876 } \
06877 int ace_main_i
06878
06879
06880 # define wmain \
06881 ace_main_i (int, ACE_TCHAR *[]); \
06882 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
06883 { \
06884 ACE_CE_ARGV ce_argv(lpCmdLine); \
06885 ACE::init(); \
06886 ACE_MAIN_OBJECT_MANAGER \
06887 int i = ace_main_i (ce_argv.argc(), ce_argv.argv()); \
06888 ACE::fini(); \
06889 return i; \
06890 } \
06891 int ace_main_i
06892
06893
06894
06895
06896 # include "ace/Argv_Type_Converter.h"
06897 # define main \
06898 ace_main_i (int, char *[]); \
06899 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
06900 { \
06901 ACE_CE_ARGV ce_argv (lpCmdLine); \
06902 ACE::init (); \
06903 ACE_MAIN_OBJECT_MANAGER \
06904 ACE_Argv_Type_Converter command_line (ce_argv.argc (), ce_argv.argv ()); \
06905 int i = ace_main_i (command_line.get_argc(), command_line.get_ASCII_argv());\
06906 ACE::fini (); \
06907 return i; \
06908 } \
06909 int ace_main_i
06910
06911 # else
06912 # define main \
06913 ace_main_i (int, char *[]); \
06914 int \
06915 ACE_MAIN (int argc, char *argv[]) \
06916 { \
06917 ACE_MAIN_OBJECT_MANAGER \
06918 return ace_main_i (argc, argv); \
06919 } \
06920 int \
06921 ace_main_i
06922 # if defined (ACE_WIN32)
06923 # define wmain \
06924 ace_main_i (int, ACE_TCHAR *[]); \
06925 int \
06926 ACE_WMAIN (int argc, ACE_TCHAR *argv[]) \
06927 { \
06928 ACE_MAIN_OBJECT_MANAGER \
06929 return ace_main_i (argc, argv); \
06930 } \
06931 int \
06932 ace_main_i
06933 # endif
06934 # endif
06935 # endif
06936
06937 # if defined (ACE_WIN32) && ! defined (ACE_HAS_WINCE) \
06938 && ! defined (ACE_HAS_PHARLAP)
06939 typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS;
06940 typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS;
06941 typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS;
06942
06943 # define ACE_INFINITE INFINITE
06944 # define ACE_STATUS_TIMEOUT STATUS_TIMEOUT
06945 # define ACE_WAIT_FAILED WAIT_FAILED
06946 # define ACE_WAIT_TIMEOUT WAIT_TIMEOUT
06947 # else
06948 struct ACE_TRANSMIT_FILE_BUFFERS
06949 {
06950 void *Head;
06951 size_t HeadLength;
06952 void *Tail;
06953 size_t TailLength;
06954 };
06955 typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS;
06956 typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS;
06957
06958 # if !defined (ACE_INFINITE)
06959 # define ACE_INFINITE LONG_MAX
06960 # endif
06961 # define ACE_STATUS_TIMEOUT LONG_MAX
06962 # define ACE_WAIT_FAILED LONG_MAX
06963 # define ACE_WAIT_TIMEOUT LONG_MAX
06964 # endif
06965
06966 # if !defined (ACE_HAS_MINIMAL_ACE_OS)
06967 # include "ace/Trace.h"
06968 # endif
06969
06970 # if defined (ACE_HAS_INLINED_OSCALLS)
06971 # if defined (ACE_INLINE)
06972 # undef ACE_INLINE
06973 # endif
06974 # define ACE_INLINE inline
06975 # include "ace/OS.i"
06976 # endif
06977
06978
06979
06980
06981 # define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
06982 | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
06983 # define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8))
06984
06985 # if defined (ACE_LITTLE_ENDIAN)
06986 # define ACE_HTONL(X) ACE_SWAP_LONG (X)
06987 # define ACE_NTOHL(X) ACE_SWAP_LONG (X)
06988 # define ACE_IDL_NCTOHL(X) (X)
06989 # define ACE_IDL_NSTOHL(X) (X)
06990 # else
06991 # define ACE_HTONL(X) X
06992 # define ACE_NTOHL(X) X
06993 # define ACE_IDL_NCTOHL(X) (X << 24)
06994 # define ACE_IDL_NSTOHL(X) ((X) << 16)
06995 # endif
06996
06997 # if defined (ACE_LITTLE_ENDIAN)
06998 # define ACE_HTONS(x) ACE_SWAP_WORD(x)
06999 # define ACE_NTOHS(x) ACE_SWAP_WORD(x)
07000 # else
07001 # define ACE_HTONS(x) x
07002 # define ACE_NTOHS(x) x
07003 # endif
07004
07005 # if defined (ACE_HAS_POSIX_REALTIME_SIGNALS)
07006
07007
07008
07009
07010
07011
07012
07013 # if defined (_POSIX_RTSIG_MAX)
07014 # define ACE_RTSIG_MAX _POSIX_RTSIG_MAX
07015 # else
07016
07017
07018
07019 # define ACE_RTSIG_MAX 8
07020 # endif
07021 # endif
07022
07023
07024
07025
07026
07027
07028
07029 #if !defined (WIFEXITED)
07030 # define WIFEXITED(stat) 1
07031 #endif
07032
07033
07034
07035
07036
07037 #if !defined (WEXITSTATUS)
07038 # define WEXITSTATUS(stat) stat
07039 #endif
07040
07041
07042
07043
07044 #if !defined (WIFSIGNALED)
07045 # define WIFSIGNALED(stat) 0
07046 #endif
07047
07048
07049
07050
07051 #if !defined (WTERMSIG)
07052 # define WTERMSIG(stat) 0
07053 #endif
07054
07055 #if !defined (WIFSTOPPED)
07056 # define WIFSTOPPED(stat) 0
07057 #endif
07058
07059 #if !defined (WSTOPSIG)
07060 # define WSTOPSIG(stat) 0
07061 #endif
07062
07063 #if !defined (WIFCONTINUED)
07064 # define WIFCONTINUED(stat) 0
07065 #endif
07066
07067 #if !defined (WCOREDUMP)
07068 # define WCOREDUMP(stat) 0
07069 #endif
07070
07071
07072
07073
07074
07075
07076
07077
07078
07079
07080
07081
07082
07083
07084
07085
07086
07087
07088
07089
07090
07091
07092
07093
07094
07095
07096
07097
07098
07099
07100
07101
07102
07103
07104
07105
07106
07107
07108
07109
07110
07111
07112
07113
07114
07115
07116
07117
07118
07119
07120
07121
07122
07123
07124
07125
07126
07127
07128
07129
07130
07131
07132
07133 #define ACE_align_binary(ptr, alignment) \
07134 ((ptr + ((ptr_arith_t)((alignment)-1))) & (~((ptrdiff_t)((alignment)-1))))
07135
07136
07137 #define ACE_ptr_align_binary(ptr, alignment) \
07138 ((char *) ACE_align_binary (((ptrdiff_t) (ptr)), (alignment)))
07139
07140
07141
07142 #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
07143 #define ACE_SIGRTMIN SIGRTMIN
07144 #define ACE_SIGRTMAX SIGRTMAX
07145
07146 #else
07147
07148 #ifndef ACE_SIGRTMIN
07149 #define ACE_SIGRTMIN 0
07150 #endif
07151
07152 #ifndef ACE_SIGRTMAX
07153 #define ACE_SIGRTMAX 0
07154 #endif
07155
07156 #endif
07157
07158 # if defined (ACE_LACKS_SYS_NERR)
07159 extern ACE_OS_Export int sys_nerr;
07160 # endif
07161
07162 #if defined (ACE_LEGACY_MODE)
07163 # include "ace/Log_Msg.h"
07164 # include "ace/Thread_Hook.h"
07165 # include "ace/Thread_Adapter.h"
07166 # include "ace/Thread_Exit.h"
07167 # include "ace/Thread_Control.h"
07168 #endif
07169
07170 #include "ace/post.h"
07171 #endif