diff options
author | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-19 14:57:30 +0000 |
---|---|---|
committer | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-19 14:57:30 +0000 |
commit | d9e44f3caceb73e3d1cdf55b76a771e1d9477d9b (patch) | |
tree | 93ed06f95d9f1861909c9d0563acb99668b1dd90 | |
parent | 8c238479323e095ada6dca2d189b1ba07235a8ec (diff) | |
download | ATCD-d9e44f3caceb73e3d1cdf55b76a771e1d9477d9b.tar.gz |
ChangeLogTag:Fri Apr 19 13:42:28 UTC 2002 Don Hinton <dhinton@ieee.org>
-rw-r--r-- | ace/ace_assert.h | 30 | ||||
-rw-r--r-- | ace/ace_dirent.h | 36 | ||||
-rw-r--r-- | ace/ace_errno.h | 120 | ||||
-rw-r--r-- | ace/ace_limits.h | 38 | ||||
-rw-r--r-- | ace/ace_psos.h | 434 | ||||
-rw-r--r-- | ace/ace_semaphore.h | 64 | ||||
-rw-r--r-- | ace/ace_stdio.h | 79 | ||||
-rw-r--r-- | ace/ace_stropts.h | 30 | ||||
-rw-r--r-- | ace/ace_sys_mman.h | 69 | ||||
-rw-r--r-- | ace/ace_sys_msg.h | 31 | ||||
-rw-r--r-- | ace/ace_sys_param.h | 40 | ||||
-rw-r--r-- | ace/ace_sys_resource.h | 33 | ||||
-rw-r--r-- | ace/ace_sys_sem.h | 35 | ||||
-rw-r--r-- | ace/ace_sys_signal.h | 39 | ||||
-rw-r--r-- | ace/ace_sys_socket.h | 92 | ||||
-rw-r--r-- | ace/ace_sys_stat.h | 52 | ||||
-rw-r--r-- | ace/ace_sys_types.h | 136 | ||||
-rw-r--r-- | ace/ace_sys_uio.h | 45 | ||||
-rw-r--r-- | ace/ace_threads.h | 988 | ||||
-rw-r--r-- | ace/ace_time.h | 52 | ||||
-rw-r--r-- | ace/ace_vxworks.h | 117 |
21 files changed, 2560 insertions, 0 deletions
diff --git a/ace/ace_assert.h b/ace/ace_assert.h new file mode 100644 index 00000000000..b2045142325 --- /dev/null +++ b/ace/ace_assert.h @@ -0,0 +1,30 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_assert.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ASSERT_H +#define ACE_ASSERT_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <assert.h> + +# if defined (ACE_LACKS_ASSERT_MACRO) +# define assert(expr) +# endif + +#endif /* ACE_ASSERT_H */ diff --git a/ace/ace_dirent.h b/ace/ace_dirent.h new file mode 100644 index 00000000000..3233ef9e264 --- /dev/null +++ b/ace/ace_dirent.h @@ -0,0 +1,36 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_dirent.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_DIRENT_H +# define ACE_ACE_DIRENT_H +# include "ace/pre.h" + +# include "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include /**/ <dirent.h> + +# if !defined (MAXNAMLEN) +# if defined (ACE_PSOS) || defined (VXWORKS) +# define MAXNAMLEN 255 +# elif defined (ACE_WIN32) +# define MAXNAMLEN _MAX_FNAME +# endif /* ACE_WIN32 */ +// This is probably wrong, but... +# define MAXNAMLEN 255 +# endif /* !MAXNAMLEN */ + +#endif /* ACE_ACE_DIRENT_H */ diff --git a/ace/ace_errno.h b/ace/ace_errno.h new file mode 100644 index 00000000000..fa7aad496f4 --- /dev/null +++ b/ace/ace_errno.h @@ -0,0 +1,120 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_errno.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_ERRNO_H +#define ACE_ACE_ERRNO_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_H_ERRNO) +void herror (const char *str); +#endif /* ACE_HAS_H_ERRNO */ + +#if !defined (ACE_HAS_WINCE) +# include /**/ <errno.h> +#endif /* ACE_HAS_WINCE */ + +#if !defined (ACE_WIN32) && !defined (ACE_PSOS) && defined (ACE_LACKS_T_ERRNO) +extern int t_errno; +#endif /* ACE_WIN32 && !ACE_PSOS && ACE_LACKS_T_ERRNO */ + +#if !defined (ENOSYS) +# define ENOSYS EFAULT /* Operation not supported or unknown error. */ +#endif /* !ENOSYS */ + +#if !defined (ENOTSUP) +# define ENOTSUP ENOSYS /* Operation not supported. */ +#endif /* !ENOTSUP */ + + +#if defined (ACE_PSOS) +// Some versions of pSOS do not define error numbers, but newer +// versions do. So, include errno.h and then see which ones are not +// yet defined. +# if !defined (EPERM) +# define EPERM 1 /* Not super-user */ +# endif /* EPERM */ +# if !defined (ENOENT) +# define ENOENT 2 /* No such file or directory */ +# endif /* ENOENT */ +# if !defined (ESRCH) +# define ESRCH 3 /* No such process */ +# endif /* ESRCH */ +# if ! defined (EINTR) +# define EINTR 4 /* interrupted system call */ +# endif /* EINTR */ +# if !defined (EBADF) +# define EBADF 9 /* Bad file number */ +# endif /* EBADF */ +# if !defined (EAGAIN) +# define EAGAIN 11 /* Resource temporarily unavailable */ +# endif /* EAGAIN */ +# if !defined (EWOULDBLOCK) +# define EWOULDBLOCK EAGAIN /* Blocking resource request would block */ +# endif /* EWOULDBLOCK */ +# if !defined (ENOMEM) +# define ENOMEM 12 /* Not enough core */ +# endif /* ENOMEM */ +# if !defined (EACCESS) +# define EACCESS 13 /* Permission denied */ +# endif /* EACCESS */ +# if !defined (EFAULT) +# define EFAULT 14 /* Bad access */ +# endif /* EFAULT */ +# if !defined (EEXIST) +# define EEXIST 17 /* File exists */ +# endif /* EEXIST */ +# if !defined (ENOSPC) +# define ENOSPC 28 /* No space left on device */ +# endif /* ENOSPC */ +# if !defined (EPIPE) +# define EPIPE 32 /* Broken pipe */ +# endif /* EPIPE */ +# if !defined (ETIME) +# define ETIME 62 /* timer expired */ +# endif /* ETIME */ +# if !defined (ENAMETOOLONG) +# define ENAMETOOLONG 78 /* path name is too long */ +# endif /* ENAMETOOLONG */ +# if !defined (ENOSYS) +# define ENOSYS 89 /* Unsupported file system operation */ +# endif /* ENOSYS */ +# if !defined (EADDRINUSE) +# define EADDRINUSE 125 /* Address already in use */ +# endif /* EADDRINUSE */ +# if !defined (ENETUNREACH) +# define ENETUNREACH 128 /* Network is unreachable */ +# endif /* ENETUNREACH */ +# if !defined (EISCONN) +# define EISCONN 133 /* Socket is already connected */ +# endif /* EISCONN */ +# if !defined (ESHUTDOWN) +# define ESHUTDOWN 143 /* Can't send after socket shutdown */ +# endif /* ESHUTDOWN */ +# if !defined (ECONNREFUSED) +# define ECONNREFUSED 146 /* Connection refused */ +# endif /* ECONNREFUSED */ +# if !defined (EINPROGRESS) +# define EINPROGRESS 150 /* operation now in progress */ +# endif /* EINPROGRESS */ +# if !defined (ERRMAX) +# define ERRMAX 151 /* Last error number */ +# endif /* ERRMAX */ +#endif /* ACE_PSOS */ + +#endif /* ACE_ERRNO_H */ diff --git a/ace/ace_limits.h b/ace/ace_limits.h new file mode 100644 index 00000000000..2ab567d5449 --- /dev/null +++ b/ace/ace_limits.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_limits.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_LIMITS_H +# define ACE_ACE_LIMITS_H +# include "ace/pre.h" + +# include "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include /**/ <limits.h> + +# if !defined (ACE_WIN32) +# define ACE_MAX_USERID L_cuserid +# endif /*!ACE_WIN32*/ + +# if !defined (MAXNAMELEN) +# if defined (FILENAME_MAX) +# define MAXNAMELEN FILENAME_MAX +# else +# define MAXNAMELEN 256 +# endif /* FILENAME_MAX */ +# endif /* MAXNAMELEN */ + +#endif /* ACE_ACE_LIMITS_H */ diff --git a/ace/ace_psos.h b/ace/ace_psos.h new file mode 100644 index 00000000000..7e0f0b7f18e --- /dev/null +++ b/ace/ace_psos.h @@ -0,0 +1,434 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_psos.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_PSOS_H +#define ACE_ACE_PSOS_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# if defined (ACE_PSOS) + +# if defined (ACE_PSOSIM) + +# include /**/ "ace/sys_conf.h" /* system configuration file */ +# include /**/ <psos.h> /* pSOS+ system calls */ +# include /**/ <pna.h> /* pNA+ TCP/IP Network Manager calls */ + + /* In the *simulator* environment, use unsigned int for size_t */ +# define size_t unsigned int + + + /* include <rpc.h> pRPC+ Remote Procedure Call Library calls */ + /* are not supported by pSOSim */ + /* */ + /* include <phile.h> pHILE+ file system calls are not supported */ + /* by pSOSim *so*, for the time being, we make */ + /* use of UNIX file system headers and then */ + /* when we have time, we wrap UNIX file system */ + /* calls w/ pHILE+ wrappers, and modify ACE to */ + /* use the wrappers under pSOSim */ + + /* put includes for necessary UNIX file system calls here */ +# include /**/ <sys/stat.h> +# include /**/ <sys/ioctl.h> +# include /**/ <sys/sockio.h> +# include /**/ <netinet/tcp.h> + +# define TCP_ +# if ! defined (BUFSIZ) +# define BUFSIZ 1024 +# endif /* ! defined (BUFSIZ) */ + + +# else + +# if defined (ACE_PSOS_CANT_USE_SYS_TYPES) + // these are missing from the pSOS types.h file, and the compiler + // supplied types.h file collides with the pSOS version. +# if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES) + typedef unsigned char u_char; + typedef unsigned short u_short; +# endif /* ACE_SHOULD_NOT_DEFINE_SYS_TYPES */ + typedef unsigned int u_int; +# if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES) + typedef unsigned long u_long; +# endif /* ACE_SHOULD_NOT_DEFINE_SYS_TYPES */ + + // These are defined in types.h included by (among others) pna.h +# if 0 + typedef unsigned char uchar_t; + typedef unsigned short ushort_t; + typedef unsigned int uint_t; + typedef unsigned long ulong_t; +# endif /* 0 */ + typedef char * caddr_t; + +# if defined (ACE_PSOS_DIAB_PPC) + // pid_t is defined in sys/types.h +# if 0 + typedef unsigned long pid_t; +# endif /* 0 */ +# define ACE_INVALID_PID ((pid_t) ~0) +# else /* !defined (ACE_PSOS_DIAB_PPC) */ + typedef long pid_t; +# define ACE_INVALID_PID ((pid_t) -1) +# endif /* defined (ACE_PSOS_DIAB_PPC) */ + +// typedef unsigned char wchar_t; +# endif /* ACE_PSOS_CANT_USE_SYS_TYPES */ + +# include /**/ "ace/sys_conf.h" /* system configuration file */ +# include /**/ <configs.h> /* includes all pSOS headers */ +// #include /**/ <psos.h> /* pSOS system calls */ +# include /**/ <pna.h> /* pNA+ TCP/IP Network Manager calls */ +# include /**/ <phile.h> /* pHILE+ file system calls */ +// #include /**/ <prepccfg.h> /* pREPC+ file system calls */ +# if defined (ACE_PSOS_DIAB_MIPS) +# if defined (ACE_PSOS_USES_DIAB_SYS_CALLS) +# include /**/ <unistd.h> /* Diab Data supplied file system calls */ +# else +# include /**/ <prepc.h> +# endif /* ACE_PSOS_USES_DIAB_SYS_CALLS */ +# include /**/ <sys/wait.h> /* Diab Data supplied header file */ +# endif /* ACE_PSOS_DIAB_MIPS */ + +// This collides with phile.h +// #include /**/ <sys/stat.h> /* Diab Data supplied header file */ + +// Some versions have missing preprocessor definitions +# if !defined (AF_UNIX) +# define AF_UNIX 0x1 +# endif /* AF_UNIX */ +# define PF_UNIX AF_UNIX +# define PF_INET AF_INET +# if !defined (AF_MAX) +# define AF_MAX AF_INET +# endif /* AF_MAX */ +# if !defined (IFF_LOOPBACK) +# define IFF_LOOPBACK IFF_EXTLOOPBACK +# endif /* IFF_LOOPBACK */ + + typedef long fd_mask; +# define IPPORT_RESERVED 1024 +# define IPPORT_USERRESERVED 5000 + +# if !defined (howmany) +# define howmany(x, y) (((x)+((y)-1))/(y)) +# endif /* howmany */ + + extern "C" + { + typedef void (* ACE_SignalHandler) (void); + typedef void (* ACE_SignalHandlerV) (void); + } + +# if !defined(SIG_DFL) +# define SIG_DFL (ACE_SignalHandler) 0 +# endif /* philabs */ + +# endif /* defined (ACE_PSOSIM) */ + + +# if ! defined (NSIG) +# define NSIG 32 +# endif /* NSIG */ + +# if ! defined (TCP_NODELAY) +# define TCP_NODELAY 1 +# endif /* TCP_NODELAY */ + +// For general purpose portability + +# define ACE_BITS_PER_ULONG (8 * sizeof (u_long)) + +typedef u_long ACE_idtype_t; +typedef u_long ACE_id_t; +# define ACE_SELF (0) +typedef u_long ACE_pri_t; + +// pHILE+ calls the DIR struct XDIR instead +# if !defined (ACE_PSOS_DIAB_PPC) +typedef XDIR ACE_DIR; +# endif /* !defined (ACE_PSOS_DIAB_PPC) */ + +// Use pSOS semaphores, wrapped . . . +typedef struct +{ + u_long sema_; + // Semaphore handle. This is allocated by pSOS. + + char name_[4]; + // Name of the semaphore: really a 32 bit number to pSOS +} ACE_sema_t; + +// Used for dynamic linking. +# if !defined (ACE_DEFAULT_SVC_CONF) +# define ACE_DEFAULT_SVC_CONF "./svc.conf" +# endif /* ACE_DEFAULT_SVC_CONF */ + +# if !defined (ACE_DEFAULT_SEM_KEY) +# define ACE_DEFAULT_SEM_KEY 1234 +# endif /* ACE_DEFAULT_SEM_KEY */ + +# define ACE_STDIN 0 +# define ACE_STDOUT 1 +# define ACE_STDERR 2 + +# define ACE_DIRECTORY_SEPARATOR_STR_A "/" +# define ACE_DIRECTORY_SEPARATOR_CHAR_A '/' +# define ACE_PLATFORM_A "pSOS" +# define ACE_PLATFORM_EXE_SUFFIX_A "" + +# define ACE_DLL_SUFFIX ACE_LIB_TEXT (".so") +# define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib") +# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("LD_LIBRARY_PATH") +# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (":") +# define ACE_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon") + +# define ACE_MAX_DEFAULT_PORT 65535 + +# if ! defined(MAXPATHLEN) +# define MAXPATHLEN 1024 +# endif /* MAXPATHLEN */ + +# if ! defined(MAXNAMLEN) +# define MAXNAMLEN 255 +# endif /* MAXNAMLEN */ + +# if defined (ACE_LACKS_MMAP) +# define PROT_READ 0 +# define PROT_WRITE 0 +# define PROT_EXEC 0 +# define PROT_NONE 0 +# define PROT_RDWR 0 +# define MAP_PRIVATE 0 +# define MAP_SHARED 0 +# define MAP_FIXED 0 +# endif /* ACE_LACKS_MMAP */ + + +typedef int ACE_exitcode; + +typedef ACE_HANDLE ACE_SHLIB_HANDLE; +# define ACE_SHLIB_INVALID_HANDLE ACE_INVALID_HANDLE +# define ACE_DEFAULT_SHLIB_MODE 0 + +# define ACE_INVALID_SEM_KEY -1 + +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* address length */ + char **h_addr_list; /* (first, only) address from name server */ +# define h_addr h_addr_list[0] /* the first address */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +# define ACE_SEH_TRY if (1) +# define ACE_SEH_EXCEPT(X) while (0) +# define ACE_SEH_FINALLY if (1) + +# if !defined (LPSECURITY_ATTRIBUTES) +# define LPSECURITY_ATTRIBUTES int +# endif /* !defined LPSECURITY_ATTRIBUTES */ +# if !defined (GENERIC_READ) +# define GENERIC_READ 0 +# endif /* !defined GENERIC_READ */ +# if !defined (FILE_SHARE_READ) +# define FILE_SHARE_READ 0 +# endif /* !defined FILE_SHARE_READ */ +# if !defined (OPEN_EXISTING) +# define OPEN_EXISTING 0 +# endif /* !defined OPEN_EXISTING */ +# if !defined (FILE_ATTRIBUTE_NORMAL) +# define FILE_ATTRIBUTE_NORMAL 0 +# endif /* !defined FILE_ATTRIBUTE_NORMAL */ +# if !defined (MAXIMUM_WAIT_OBJECTS) +# define MAXIMUM_WAIT_OBJECTS 0 +# endif /* !defined MAXIMUM_WAIT_OBJECTS */ +# if !defined (FILE_FLAG_OVERLAPPED) +# define FILE_FLAG_OVERLAPPED 0 +# endif /* !defined FILE_FLAG_OVERLAPPED */ +# if !defined (FILE_FLAG_SEQUENTIAL_SCAN) +# define FILE_FLAG_SEQUENTIAL_SCAN 0 +# endif /* !defined FILE_FLAG_SEQUENTIAL_SCAN */ + +struct ACE_OVERLAPPED +{ + u_long Internal; + u_long InternalHigh; + u_long Offset; + u_long OffsetHigh; + ACE_HANDLE hEvent; +}; + +# if !defined (USER_INCLUDE_SYS_TIME_TM) +# if defined (ACE_PSOS_DIAB_PPC) +typedef struct timespec timespec_t; +# else /* ! defined (ACE_PSOS_DIAB_PPC) */ +typedef struct timespec +{ + time_t tv_sec; // Seconds + long tv_nsec; // Nanoseconds +} timespec_t; +# endif /* defined (ACE_PSOS_DIAB_PPC) */ +# endif /* !defined (USER_INCLUDE_SYS_TIME_TM) */ + +# if defined (ACE_PSOS_HAS_TIME) + +// Use pSOS time, wrapped . . . +class ACE_OS_Export ACE_PSOS_Time_t +{ +public: + /// default ctor: date, time, and ticks all zeroed. + ACE_PSOS_Time_t (void); + + /// ctor from a timespec_t + ACE_PSOS_Time_t (const timespec_t& t); + + /// type cast operator (to a timespec_t) + operator timespec_t (); + + /// static member function to get current system time + static u_long get_system_time (ACE_PSOS_Time_t& t); + + /// static member function to set current system time + static u_long set_system_time (const ACE_PSOS_Time_t& t); + +# if defined (ACE_PSOSIM) + /// static member function to initialize system time, using UNIX calls + static u_long init_simulator_time (void); +# endif /* ACE_PSOSIM */ + + /// max number of ticks supported in a single system call + static const u_long max_ticks; +private: + // = Constants for prying info out of the pSOS time encoding. + static const u_long year_mask; + static const u_long month_mask; + static const u_long day_mask; + static const u_long hour_mask; + static const u_long minute_mask; + static const u_long second_mask; + static const int year_shift; + static const int month_shift; + static const int hour_shift; + static const int minute_shift; + static const int year_origin; + static const int month_origin; + + // error codes + static const u_long err_notime; // system time not set + static const u_long err_illdate; // date out of range + static const u_long err_illtime; // time out of range + static const u_long err_illticks; // ticks out of range + + /// date : year in bits 31-16, month in bits 15-8, day in bits 7-0 + u_long date_; + + /// time : hour in bits 31-16, minutes in bits 15-8, seconds in bits 7-0 + u_long time_; + + /// ticks: number of system clock ticks (KC_TICKS2SEC-1 max) + u_long ticks_; +} ; +# endif /* ACE_PSOS_HAS_TIME */ + +# endif /* defined (ACE_PSOS) */ + +# if defined (ACE_HAS_THREADS) + +// Some versions of pSOS provide native mutex support. For others, +// implement ACE_thread_mutex_t and ACE_mutex_t using pSOS semaphores. +// Either way, the types are all u_longs. +typedef u_long ACE_mutex_t; +typedef u_long ACE_thread_mutex_t; +typedef u_long ACE_thread_t; +typedef u_long ACE_hthread_t; + +# if defined (ACE_PSOS_HAS_COND_T) +typedef u_long ACE_cond_t; +typedef u_long ACE_condattr_t; +struct ACE_OS_Export ACE_mutexattr_t +{ + int type; +}; +# endif /* ACE_PSOS_HAS_COND_T */ + + +// TCB registers 0-7 are for application use +# define PSOS_TASK_REG_TSS 0 +# define PSOS_TASK_REG_MAX 7 + +# define PSOS_TASK_MIN_PRIORITY 1 +# define PSOS_TASK_MAX_PRIORITY 239 + +// Key type: the ACE TSS emulation requires the key type be unsigned, +// for efficiency. Current POSIX and Solaris TSS implementations also +// use unsigned int, so the ACE TSS emulation is compatible with them. +// Native pSOS TSD, where available, uses unsigned long as the key type. +# if defined (ACE_PSOS_HAS_TSS) +typedef u_long ACE_thread_key_t; +# else +typedef u_int ACE_thread_key_t; +# endif /* ACE_PSOS_HAS_TSS */ + +# define THR_CANCEL_DISABLE 0 /* thread can never be cancelled */ +# define THR_CANCEL_ENABLE 0 /* thread can be cancelled */ +# define THR_CANCEL_DEFERRED 0 /* cancellation deferred to cancellation point */ +# define THR_CANCEL_ASYNCHRONOUS 0 /* cancellation occurs immediately */ + +# define THR_BOUND 0 +# define THR_NEW_LWP 0 +# define THR_DETACHED 0 +# define THR_SUSPENDED 0 +# define THR_DAEMON 0 +# define THR_JOINABLE 0 + +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 +# define USYNC_THREAD T_LOCAL +# define USYNC_PROCESS T_GLOBAL + +/* from psos.h */ +/* #define T_NOPREEMPT 0x00000001 Not preemptible bit */ +/* #define T_PREEMPT 0x00000000 Preemptible */ +/* #define T_TSLICE 0x00000002 Time-slicing enabled bit */ +/* #define T_NOTSLICE 0x00000000 No Time-slicing */ +/* #define T_NOASR 0x00000004 ASRs disabled bit */ +/* #define T_ASR 0x00000000 ASRs enabled */ + +/* #define SM_GLOBAL 0x00000001 1 = Global */ +/* #define SM_LOCAL 0x00000000 0 = Local */ +/* #define SM_PRIOR 0x00000002 Queue by priority */ +/* #define SM_FIFO 0x00000000 Queue by FIFO order */ + +/* #define T_NOFPU 0x00000000 Not using FPU */ +/* #define T_FPU 0x00000002 Using FPU bit */ +# endif /* ACE_HAS_THREADS */ + + +#endif /* ACE_ACE_PSOS_H */ diff --git a/ace/ace_semaphore.h b/ace/ace_semaphore.h new file mode 100644 index 00000000000..df6c9c4c6e0 --- /dev/null +++ b/ace/ace_semaphore.h @@ -0,0 +1,64 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_semaphore.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SEMAPHORE_H +#define ACE_ACE_SEMAPHORE_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// These hooks enable ACE to have all dynamic memory management +// automatically handled on a per-object basis. + +# if defined (ACE_LACKS_KEY_T) +# if defined (ACE_WIN32) + // Win32 doesn't use numeric values to name its semaphores, it uses + // strings! +typedef char *key_t; +# else +typedef int key_t; +# endif /* ACE_WIN32 */ +# endif /* ACE_LACKS_KEY_T */ + +# if defined (ACE_HAS_POSIX_SEM) +# include /**/ <semaphore.h> +# if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM) +# define SEM_FAILED ((sem_t *) -1) +# endif /* !SEM_FAILED */ + +typedef struct +{ + sem_t *sema_; + // Pointer to semaphore handle. This is allocated by ACE if we are + // working with an unnamed POSIX semaphore or by the OS if we are + // working with a named POSIX semaphore. + + char *name_; + // Name of the semaphore (if this is non-NULL then this is a named + // POSIX semaphore, else its an unnamed POSIX semaphore). + +# if defined (ACE_LACKS_NAMED_POSIX_SEM) + int new_sema_; + // this->sema_ doesn't always get created dynamically if a platform + // doesn't support named posix semaphores. We use this flag to + // remember if we need to delete <sema_> or not. +# endif /* ACE_LACKS_NAMED_POSIX_SEM */ +} ACE_sema_t; +# endif /* !ACE_WIN32 */ + +#endif /* ACE_ACE_SEMAPHORE_H */ + diff --git a/ace/ace_stdio.h b/ace/ace_stdio.h new file mode 100644 index 00000000000..a14a8913a5f --- /dev/null +++ b/ace/ace_stdio.h @@ -0,0 +1,79 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_stdio.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_STDIO_H +# define ACE_ACE_STDIO_H +# include "ace/pre.h" + +# include "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include /**/ <stdarg.h> // LynxOS requires this before stdio.h + +# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) +# include /**/ <cstdio> +# else +# include /**/ <stdio.h> +# endif + +# if defined (ACE_HAS_CHARPTR_SPRINTF) +# define ACE_SPRINTF_ADAPTER(X) ::strlen (X) +# else +# define ACE_SPRINTF_ADAPTER(X) X +# endif /* ACE_HAS_CHARPTR_SPRINTF */ + +// This is defined by XOPEN to be a minimum of 16. POSIX.1g +// also defines this value. platform-specific config.h can +// override this if need be. +# if !defined (IOV_MAX) +# define IOV_MAX 16 +# endif /* IOV_MAX */ + +# if !defined (ACE_IOV_MAX) +# define ACE_IOV_MAX IOV_MAX +# endif /* ACE_IOV_MAX */ + + + +// Honestly don't know where these should go. +// Add some typedefs and macros to enhance Win32 conformance... +# if !defined (LPSECURITY_ATTRIBUTES) +# define LPSECURITY_ATTRIBUTES int +# endif /* !defined LPSECURITY_ATTRIBUTES */ +# if !defined (GENERIC_READ) +# define GENERIC_READ 0 +# endif /* !defined GENERIC_READ */ +# if !defined (FILE_SHARE_READ) +# define FILE_SHARE_READ 0 +# endif /* !defined FILE_SHARE_READ */ +# if !defined (OPEN_EXISTING) +# define OPEN_EXISTING 0 +# endif /* !defined OPEN_EXISTING */ +# if !defined (FILE_ATTRIBUTE_NORMAL) +# define FILE_ATTRIBUTE_NORMAL 0 +# endif /* !defined FILE_ATTRIBUTE_NORMAL */ +# if !defined (MAXIMUM_WAIT_OBJECTS) +# define MAXIMUM_WAIT_OBJECTS 0 +# endif /* !defined MAXIMUM_WAIT_OBJECTS */ +# if !defined (FILE_FLAG_OVERLAPPED) +# define FILE_FLAG_OVERLAPPED 0 +# endif /* !defined FILE_FLAG_OVERLAPPED */ +# if !defined (FILE_FLAG_SEQUENTIAL_SCAN) +# define FILE_FLAG_SEQUENTIAL_SCAN 0 +# endif /* FILE_FLAG_SEQUENTIAL_SCAN */ + +#endif /* ACE_ACE_STDIO_H */ + diff --git a/ace/ace_stropts.h b/ace/ace_stropts.h new file mode 100644 index 00000000000..21ac44e2660 --- /dev/null +++ b/ace/ace_stropts.h @@ -0,0 +1,30 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_stropts.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_STROPTS_H +#define ACE_ACE_STROPTS_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <stropts.h> + +# if defined (ACE_LACKS_STRRECVFD) +struct strrecvfd {}; +# endif /* ACE_LACKS_STRRECVFD */ + +#endif /* ACE_ACE_STROPTS_H */ diff --git a/ace/ace_sys_mman.h b/ace/ace_sys_mman.h new file mode 100644 index 00000000000..55828801d9f --- /dev/null +++ b/ace/ace_sys_mman.h @@ -0,0 +1,69 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_mman.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_MMAN_H +#define ACE_ACE_SYS_MMAN_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_WIN32) +// MMAP flags +# define PROT_READ PAGE_READONLY +# define PROT_WRITE PAGE_READWRITE +# define PROT_RDWR PAGE_READWRITE +/* If we can find suitable use for these flags, here they are: +PAGE_WRITECOPY +PAGE_EXECUTE +PAGE_EXECUTE_READ +PAGE_EXECUTE_READWRITE +PAGE_EXECUTE_WRITECOPY +PAGE_GUARD +PAGE_NOACCESS +PAGE_NOCACHE */ +#endif + + +# if defined (ACE_LACKS_MMAP) +# define PROT_READ 0 +# define PROT_WRITE 0 +# define PROT_EXEC 0 +# define PROT_NONE 0 +# define PROT_RDWR 0 +# define MAP_PRIVATE 0 +# define MAP_SHARED 0 +# define MAP_FIXED 0 +# endif /* ACE_LACKS_MMAP */ + +// Fixes a problem with HP/UX. +# if defined (ACE_HAS_BROKEN_MMAP_H) +extern "C" +{ +# include /**/ <sys/mman.h> +} +# elif !defined (ACE_LACKS_MMAP) +# include /**/ <sys/mman.h> +# endif /* ACE_HAS_BROKEN_MMAP_H */ + + +# if !defined (PROT_RDWR) +# define PROT_RDWR (PROT_READ|PROT_WRITE) +# endif /* PROT_RDWR */ + + + +#endif /* ACE_ACE_SYS_MMAN_H */ diff --git a/ace/ace_sys_msg.h b/ace/ace_sys_msg.h new file mode 100644 index 00000000000..1f86dfeec6e --- /dev/null +++ b/ace/ace_sys_msg.h @@ -0,0 +1,31 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_msg.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_MSG_H +#define ACE_ACE_SYS_MSG_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <sys/msg.h> + +# if defined (ACE_LACKS_MSGBUF_T) +struct msgbuf {}; +# endif /* ACE_LACKS_MSGBUF_T */ + + +#endif /* ACE_ACE_SYS_MSG_H */ diff --git a/ace/ace_sys_param.h b/ace/ace_sys_param.h new file mode 100644 index 00000000000..30362566136 --- /dev/null +++ b/ace/ace_sys_param.h @@ -0,0 +1,40 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_param.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_PARAM_H +# define ACE_ACE_SYS_PARAM_H +# include "ace/pre.h" + +# include "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +# if !defined (ACE_LACKS_PARAM_H) +# include /**/ <sys/param.h> +# endif /* ACE_LACKS_PARAM_H */ + +# include "ace/ace_limits.h" + +# if !defined (MAXPATHLEN) +# if defined (ACE_WIN32) +# define MAXPATHLEN _MAX_PATH +# elif defined (_POSIX_PATH_MAX) +# define MAXPATHLEN _POSIX_PATH_MAX +# else +# define MAXPATHLEN 1024 +# endif /* ACE_WIN32 */ +# endif /* MAXPATHLEN */ + +#endif /* ACE_ACE_SYS_PARAM_H */ diff --git a/ace/ace_sys_resource.h b/ace/ace_sys_resource.h new file mode 100644 index 00000000000..09aff428310 --- /dev/null +++ b/ace/ace_sys_resource.h @@ -0,0 +1,33 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_resource.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_RESOURCE_H +#define ACE_ACE_SYS_RESOURCE_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <sys/resource.h> + +# if defined (ACE_HAS_BROKEN_SETRLIMIT) +typedef struct rlimit ACE_SETRLIMIT_TYPE; +# else +typedef const struct rlimit ACE_SETRLIMIT_TYPE; +# endif /* ACE_HAS_BROKEN_SETRLIMIT */ + + +#endif /* ACE_ACE_SYS_RESOURCE_H */ diff --git a/ace/ace_sys_sem.h b/ace/ace_sys_sem.h new file mode 100644 index 00000000000..b4b43417762 --- /dev/null +++ b/ace/ace_sys_sem.h @@ -0,0 +1,35 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_sem.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_SEM_H +#define ACE_ACE_SYS_SEM_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <sys/sem.h> + +# if defined (ACE_LACKS_SEMBUF_T) +struct sembuf +{ + unsigned short sem_num; // semaphore # + short sem_op; // semaphore operation + short sem_flg; // operation flags +}; +# endif /* ACE_LACKS_SEMBUF_T */ + +#endif /* ACE_ACE_SYS_SEM_H */ diff --git a/ace/ace_sys_signal.h b/ace/ace_sys_signal.h new file mode 100644 index 00000000000..a01fa2854e5 --- /dev/null +++ b/ace/ace_sys_signal.h @@ -0,0 +1,39 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_signal.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_SIGNAL_H +#define ACE_ACE_SYS_SIGNAL_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include /**/ <sys/signal.h> + +// this doesn't belong here, but until I get an ace_aio.h file, here will be fine. +// Defining POSIX4 real-time signal range. +# if defined ACE_HAS_AIO_CALLS +# define ACE_SIGRTMIN SIGRTMIN +# define ACE_SIGRTMAX SIGRTMAX +# else /* !ACE_HAS_AIO_CALLS */ +# define ACE_SIGRTMIN 0 +# define ACE_SIGRTMAX 0 +# endif /* ACE_HAS_AIO_CALLS */ + + + +#endif /* ACE_ACE_SYS_SIGNAL_H */ diff --git a/ace/ace_sys_socket.h b/ace/ace_sys_socket.h new file mode 100644 index 00000000000..a88df8df403 --- /dev/null +++ b/ace/ace_sys_socket.h @@ -0,0 +1,92 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_socket.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_SOCKET_H +#define ACE_ACE_SYS_SOCKET_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/ace_stdio.h" + +#include /**/ <sys/socket.h> + +typedef u_long ACE_SOCK_GROUP; + +// For Win32 compatibility... +# if !defined (ACE_WSOCK_VERSION) +# define ACE_WSOCK_VERSION 0, 0 +# endif /* ACE_WSOCK_VERSION */ + + +// Increase the range of "address families". Please note that this +// must appear _after_ the include of sys/socket.h, for the AF_FILE +// definition on Linux/glibc2. +# if !defined (AF_ANY) +# define AF_ANY (-1) +# endif /* AF_ANY */ + +# define AF_SPIPE (AF_MAX + 1) +# if !defined (AF_FILE) +# define AF_FILE (AF_MAX + 2) +# endif /* ! AF_FILE */ +# define AF_DEV (AF_MAX + 3) +# define AF_UPIPE (AF_SPIPE) + +# if !defined(MAXHOSTNAMELEN) +# define MAXHOSTNAMELEN 256 +# endif /* MAXHOSTNAMELEN */ + +// Define INET loopback address constant if it hasn't been defined +// Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001 +# if !defined (INADDR_LOOPBACK) +# define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001) +# endif /* INADDR_LOOPBACK */ + +// The INADDR_NONE address is generally 255.255.255.255. +# if !defined (INADDR_NONE) +# define INADDR_NONE ((ACE_UINT32) 0xffffffff) +# endif /* INADDR_NONE */ + +// Define INET string length constants if they haven't been defined +// +// for IPv4 dotted-decimal +# if !defined (INET_ADDRSTRLEN) +# define INET_ADDRSTRLEN 16 +# endif /* INET_ADDRSTRLEN */ +// +// for IPv6 hex string +# if !defined (INET6_ADDRSTRLEN) +# define INET6_ADDRSTRLEN 46 +# endif /* INET6_ADDRSTRLEN */ + +# if defined (ACE_HAS_IPV6) + +# if defined (ACE_USES_IPV4_IPV6_MIGRATION) +# define ACE_ADDRESS_FAMILY_INET AF_UNSPEC +# define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC +# else +# define ACE_ADDRESS_FAMILY_INET AF_INET6 +# define ACE_PROTOCOL_FAMILY_INET PF_INET6 +# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ + +# else +# define ACE_ADDRESS_FAMILY_INET AF_INET +# define ACE_PROTOCOL_FAMILY_INET PF_INET +# endif + +#endif /* ACE_ACE_SYS_SOCKET_H */ diff --git a/ace/ace_sys_stat.h b/ace/ace_sys_stat.h new file mode 100644 index 00000000000..331648f3ae3 --- /dev/null +++ b/ace/ace_sys_stat.h @@ -0,0 +1,52 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_stat.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_STAT_H +#define ACE_ACE_SYS_STAT_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <sys/stat.h> + + +# if defined (ACE_LACKS_MODE_MASKS) +// MODE MASKS + +// the following macros are for POSIX conformance. + +# if !defined (ACE_HAS_USER_MODE_MASKS) +# define S_IRWXU 00700 /* read, write, execute: owner. */ +# define S_IRUSR 00400 /* read permission: owner. */ +# define S_IWUSR 00200 /* write permission: owner. */ +# define S_IXUSR 00100 /* execute permission: owner. */ +# endif /* ACE_HAS_USER_MODE_MASKS */ +# define S_IRWXG 00070 /* read, write, execute: group. */ +# define S_IRGRP 00040 /* read permission: group. */ +# define S_IWGRP 00020 /* write permission: group. */ +# define S_IXGRP 00010 /* execute permission: group. */ +# define S_IRWXO 00007 /* read, write, execute: other. */ +# define S_IROTH 00004 /* read permission: other. */ +# define S_IWOTH 00002 /* write permission: other. */ +# define S_IXOTH 00001 /* execute permission: other. */ + +# endif /* ACE_LACKS_MODE_MASKS */ + + + + +#endif /* ACE_ACE_SYS_STAT_H */ diff --git a/ace/ace_sys_types.h b/ace/ace_sys_types.h new file mode 100644 index 00000000000..4475442bc8d --- /dev/null +++ b/ace/ace_sys_types.h @@ -0,0 +1,136 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_types.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_TYPES_H +#define ACE_ACE_SYS_TYPES_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# if defined (ACE_HAS_WINCE) +# include /**/ <types.h> + +//typedef DWORD nlink_t; + +// CE's add-on for c-style fstat/stat functionalities. This struct is +// by no mean complete compared to what you usually find in UNIX +// platforms. Only members that have direct conversion using Win32's +// BY_HANDLE_FILE_INFORMATION are defined so that users can discover +// non-supported members at compile time. Time values are of type +// ACE_Time_Value for easy comparison. + +// Since CE does not have _stat by default as NT/2000 does, the 'stat' +// struct defined here will be used. Also note that CE file system +// struct is only for the CE 3.0 or later. +// Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0. + +typedef unsigned int dev_t; + +struct stat +{ + dev_t st_dev; // always 0 on Windows platforms + dev_t st_rdev; // always 0 on Windows platforms + unsigned short st_mode; // file attribute + short st_nlink; // number of hard links + ACE_Time_Value st_atime; // time of last access + ACE_Time_Value st_mtime; // time of last data modification + ACE_Time_Value st_ctime; // time of creation + off_t st_size; // file size, in bytes + + // Following members do not have direct conversion in Window platforms. +// u_long st_blksize; // optimal blocksize for I/O +// u_long st_flags; // user defined flags for file +}; + +# else /* ! ACE_HAS_WINCE */ +# if defined (ACE_LACKS_SYS_TYPES_H) +# if ! defined (ACE_PSOS) + typedef unsigned char u_char; + typedef unsigned short u_short; + typedef unsigned int u_int; + typedef unsigned long u_long; + + typedef unsigned char uchar_t; + typedef unsigned short ushort_t; + typedef unsigned int uint_t; + typedef unsigned long ulong_t; +# endif /* ! defined (ACE_PSOS) */ +# else +# include /**/ <sys/types.h> +# endif /* ACE_LACKS_SYS_TYPES_H */ + +# if ! defined (ACE_PSOS) +# include /**/ <sys/stat.h> +# endif +# endif /* ACE_HAS_WINCE */ + +// this is normally defined in sys/select.h, but since it is included +// in sys/types, this will work for now. +# if defined (ACE_SELECT_USES_INT) +typedef int ACE_FD_SET_TYPE; +# else +typedef fd_set ACE_FD_SET_TYPE; +# endif /* ACE_SELECT_USES_INT */ + +// this doesn't belong here, but until I get an ace_aio.h file, here will be fine. +// Defining POSIX4 real-time signal range. +# if defined ACE_HAS_AIO_CALLS +# define ACE_SIGRTMIN SIGRTMIN +# define ACE_SIGRTMAX SIGRTMAX +# else /* !ACE_HAS_AIO_CALLS */ +# define ACE_SIGRTMIN 0 +# define ACE_SIGRTMAX 0 +# endif /* ACE_HAS_AIO_CALLS */ + +# if defined (ACE_WIN32) && ! defined (ACE_HAS_WINCE) \ + && ! defined (ACE_HAS_PHARLAP) +typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; +typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS; +typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS; + +# define ACE_INFINITE INFINITE +# define ACE_STATUS_TIMEOUT STATUS_TIMEOUT +# define ACE_WAIT_FAILED WAIT_FAILED +# define ACE_WAIT_TIMEOUT WAIT_TIMEOUT +# else /* ACE_WIN32 */ +struct ACE_TRANSMIT_FILE_BUFFERS +{ + void *Head; + size_t HeadLength; + void *Tail; + size_t TailLength; +}; +typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS; +typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS; + +# if !defined (ACE_INFINITE) +# define ACE_INFINITE LONG_MAX +# endif /* ACE_INFINITE */ +# define ACE_STATUS_TIMEOUT LONG_MAX +# define ACE_WAIT_FAILED LONG_MAX +# define ACE_WAIT_TIMEOUT LONG_MAX +# endif /* ACE_WIN32 */ + +// Default size of the ACE Reactor. +# if defined (FD_SETSIZE) +int const ACE_FD_SETSIZE = FD_SETSIZE; +# else +# define ACE_FD_SETSIZE FD_SETSIZE +# endif /* ACE_FD_SETSIZE */ + + +#endif /* ACE_ACE_SYS_TYPES_H */ diff --git a/ace/ace_sys_uio.h b/ace/ace_sys_uio.h new file mode 100644 index 00000000000..d9c6c878bd4 --- /dev/null +++ b/ace/ace_sys_uio.h @@ -0,0 +1,45 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_sys_uio.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_SYS_UIO_H +#define ACE_ACE_SYS_UIO_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <sys/uio.h> + +# if defined(__rtems__) +struct iovec { + char *iov_base; // Base address. + size_t iov_len; // Length. +}; +# endif + +# if defined (ACE_HAS_BROKEN_WRITEV) +typedef struct iovec ACE_WRITEV_TYPE; +# else +typedef const struct iovec ACE_WRITEV_TYPE; +# endif /* ACE_HAS_BROKEN_WRITEV */ + +# if defined (ACE_HAS_BROKEN_READV) +typedef const struct iovec ACE_READV_TYPE; +# else +typedef struct iovec ACE_READV_TYPE; +# endif /* ACE_HAS_BROKEN_READV */ + +#endif /* ACE_ACE_SYS_UIO_H */ diff --git a/ace/ace_threads.h b/ace/ace_threads.h new file mode 100644 index 00000000000..73180a838d3 --- /dev/null +++ b/ace/ace_threads.h @@ -0,0 +1,988 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_threads.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_THREADS_H +#define ACE_ACE_THREADS_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include "ace/ace_sys_types.h" +# include "ace/OS_Export.h" +// moved to ace_thread.h +# if defined (ACE_HAS_PRIOCNTL) + // Need to #include thread.h before #defining THR_BOUND, etc., + // when building without threads on SunOS 5.x. +# if defined (sun) +# include /**/ <thread.h> +# endif /* sun */ + + // Need to #include these before #defining USYNC_PROCESS on SunOS 5.x. +# include /**/ <sys/rtpriocntl.h> +# include /**/ <sys/tspriocntl.h> +# endif /* ACE_HAS_PRIOCNTL */ + +// This needs to go here *first* to avoid problems with AIX. +# if defined (ACE_HAS_PTHREADS) +extern "C" { +# define ACE_DONT_INCLUDE_ACE_SIGNAL_H +# include /**/ <signal.h> +# undef ACE_DONT_INCLUDE_ACE_SIGNAL_H +# include /**/ <pthread.h> +# if defined (DIGITAL_UNIX) +# define pthread_self __pthread_self +extern "C" pthread_t pthread_self (void); +# endif /* DIGITAL_UNIX */ +} +# if defined (HPUX_10) +// HP-UX 10 needs to see cma_sigwait, and since _CMA_NOWRAPPERS_ is defined, +// this header does not get included from pthreads.h. +# include /**/ <dce/cma_sigwait.h> +# endif /* HPUX_10 */ +# endif /* ACE_HAS_PTHREADS */ + +// There are a lot of threads-related macro definitions in the config files. +// They came in at different times and from different places and platform +// requirements as threads evolved. They are probably not all needed - some +// overlap or are otherwise confused. This is an attempt to start +// straightening them out. +# if defined (ACE_HAS_PTHREADS_STD) /* POSIX.1c threads (pthreads) */ + // ... and 2-parameter asctime_r and ctime_r +# if !defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R) && \ + !defined (ACE_HAS_STHREADS) +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +# endif +# endif /* ACE_HAS_PTHREADS_STD */ + + +# if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) +# define ACE_TSS_TYPE(T) ACE_TSS< T > +# if defined (ACE_HAS_BROKEN_CONVERSIONS) +# define ACE_TSS_GET(I, T) (*(I)) +# else +# define ACE_TSS_GET(I, T) ((I)->operator T * ()) +# endif /* ACE_HAS_BROKEN_CONVERSIONS */ +# else +# define ACE_TSS_TYPE(T) T +# define ACE_TSS_GET(I, T) (I) +# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATIOND) */ + + + +# if defined (ACE_HAS_THREADS) + +# if defined (ACE_HAS_STHREADS) +# include /**/ <synch.h> +# include /**/ <thread.h> +# define ACE_SCOPE_PROCESS P_PID +# define ACE_SCOPE_LWP P_LWPID +# define ACE_SCOPE_THREAD (ACE_SCOPE_LWP + 1) +# else +# define ACE_SCOPE_PROCESS 0 +# define ACE_SCOPE_LWP 1 +# define ACE_SCOPE_THREAD 2 +# endif /* ACE_HAS_STHREADS */ + +# if !defined (ACE_HAS_PTHREADS) +# define ACE_SCHED_OTHER 0 +# define ACE_SCHED_FIFO 1 +# define ACE_SCHED_RR 2 +# endif /* ! ACE_HAS_PTHREADS */ + +# if defined (ACE_HAS_PTHREADS) +# define ACE_SCHED_OTHER SCHED_OTHER +# define ACE_SCHED_FIFO SCHED_FIFO +# define ACE_SCHED_RR SCHED_RR + + +# if defined(__GLIBC__) +# if !defined (_XOPEN_SOURCE) \ + || (defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600) +// pthread_mutex_timedlock() prototype is not visible if _XOPEN_SOURCE +// is not >= 600 (i.e. for XPG6). +extern "C" int pthread_mutex_timedlock (pthread_mutex_t *mutex, + const struct timespec * abstime); +# endif /* _XOPEN_SOURCE && _XOPEN_SOURCE < 600 */ +# endif /* __GLIBC__ */ + + +// Definitions for mapping POSIX pthreads draft 6 into 1003.1c names + +# if defined (ACE_HAS_PTHREADS_DRAFT6) +# define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL +# define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL +# define PTHREAD_CREATE_UNDETACHED 0 +# define PTHREAD_CREATE_DETACHED 1 +# define PTHREAD_CREATE_JOINABLE 0 +# define PTHREAD_EXPLICIT_SCHED 0 +# define PTHREAD_MIN_PRIORITY 0 +# define PTHREAD_MAX_PRIORITY 126 +# endif /* ACE_HAS_PTHREADS_DRAFT6 */ + +// Definitions for THREAD- and PROCESS-LEVEL priorities...some +// implementations define these while others don't. In order to +// further complicate matters, we don't redefine the default (*_DEF) +// values if they've already been defined, which allows individual +// programs to have their own ACE-wide "default". + +// PROCESS-level values +# if defined (_POSIX_PRIORITY_SCHEDULING) && \ + !defined(_UNICOS) && !defined(UNIXWARE_7_1) +# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO)) +# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR)) +# if defined (HPUX) + // HP-UX's other is the SCHED_HPUX class, which uses historical + // values that have reverse semantics from POSIX (low value is + // more important priority). To use these in pthreads calls, + // the values need to be converted. The other scheduling classes + // don't need this special treatment. +# define ACE_PROC_PRI_OTHER_MIN \ + (sched_get_priority_min(SCHED_OTHER)) +# else +# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER)) +# endif /* HPUX */ +# else /* UNICOS is missing a sched_get_priority_min() implementation, + SCO too */ +# define ACE_PROC_PRI_FIFO_MIN 0 +# define ACE_PROC_PRI_RR_MIN 0 +# define ACE_PROC_PRI_OTHER_MIN 0 +# endif + +# if defined (_POSIX_PRIORITY_SCHEDULING) && !defined(UNIXWARE_7_1) +# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO)) +# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR)) +# if defined (HPUX) +# define ACE_PROC_PRI_OTHER_MAX \ + (sched_get_priority_max(SCHED_OTHER)) +# else +# define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER)) +# endif /* HPUX */ +# else /* SCO missing sched_get_priority_max() implementation */ +# define ACE_PROC_PRI_FIFO_MAX 59 +# define ACE_PROC_PRI_RR_MAX 59 +# define ACE_PROC_PRI_OTHER_MAX 59 +# endif + +# if !defined(ACE_PROC_PRI_FIFO_DEF) +# define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2) +# endif +# if !defined(ACE_PROC_PRI_RR_DEF) +# define ACE_PROC_PRI_RR_DEF (ACE_PROC_PRI_RR_MIN + (ACE_PROC_PRI_RR_MAX - ACE_PROC_PRI_RR_MIN)/2) +# endif +# if !defined(ACE_PROC_PRI_OTHER_DEF) +# define ACE_PROC_PRI_OTHER_DEF (ACE_PROC_PRI_OTHER_MIN + (ACE_PROC_PRI_OTHER_MAX - ACE_PROC_PRI_OTHER_MIN)/2) +# endif + +// THREAD-level values +# 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) +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# elif defined (AIX) + // AIX's priority range is 1 (low) to 127 (high). There aren't + // any preprocessor macros I can find. PRIORITY_MIN is for + // process priorities, as far as I can see, and does not apply + // to thread priority. The 1 to 127 range is from the + // pthread_attr_setschedparam man page (Steve Huston, 18-May-2001). +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) 1 +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) 127 +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) 1 +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) 127 +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) 1 +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) 127 +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# elif defined (sun) +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) 0 +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) 59 +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) 0 +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) 59 +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) 0 +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) 127 +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# else +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# endif +# if !defined(ACE_THR_PRI_FIFO_DEF) +# define ACE_THR_PRI_FIFO_DEF ((ACE_THR_PRI_FIFO_MIN + ACE_THR_PRI_FIFO_MAX)/2) +# endif +# if !defined(ACE_THR_PRI_RR_DEF) +# define ACE_THR_PRI_RR_DEF ((ACE_THR_PRI_RR_MIN + ACE_THR_PRI_RR_MAX)/2) +# endif +# if !defined(ACE_THR_PRI_OTHER_DEF) +# define ACE_THR_PRI_OTHER_DEF ((ACE_THR_PRI_OTHER_MIN + ACE_THR_PRI_OTHER_MAX)/2) +# endif + +// Typedefs to help compatibility with Windows NT and Pthreads. +typedef pthread_t ACE_hthread_t; +typedef pthread_t ACE_thread_t; + +# if defined (ACE_HAS_TSS_EMULATION) + typedef pthread_key_t ACE_OS_thread_key_t; + typedef u_long ACE_thread_key_t; +# else /* ! ACE_HAS_TSS_EMULATION */ + typedef pthread_key_t ACE_thread_key_t; +# endif /* ! ACE_HAS_TSS_EMULATION */ + +# if !defined (ACE_LACKS_COND_T) +typedef pthread_mutex_t ACE_mutex_t; +typedef pthread_cond_t ACE_cond_t; +typedef pthread_condattr_t ACE_condattr_t; +typedef pthread_mutexattr_t ACE_mutexattr_t; +# endif /* ! ACE_LACKS_COND_T */ +typedef pthread_mutex_t ACE_thread_mutex_t; + +# if !defined (PTHREAD_CANCEL_DISABLE) +# define PTHREAD_CANCEL_DISABLE 0 +# endif /* PTHREAD_CANCEL_DISABLE */ + +# if !defined (PTHREAD_CANCEL_ENABLE) +# define PTHREAD_CANCEL_ENABLE 0 +# endif /* PTHREAD_CANCEL_ENABLE */ + +# if !defined (PTHREAD_CANCEL_DEFERRED) +# define PTHREAD_CANCEL_DEFERRED 0 +# endif /* PTHREAD_CANCEL_DEFERRED */ + +# if !defined (PTHREAD_CANCEL_ASYNCHRONOUS) +# define PTHREAD_CANCEL_ASYNCHRONOUS 0 +# endif /* PTHREAD_CANCEL_ASYNCHRONOUS */ + +# define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE +# define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE +# define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED +# define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS + +# if !defined (PTHREAD_CREATE_JOINABLE) +# if defined (PTHREAD_CREATE_UNDETACHED) +# define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED +# else +# define PTHREAD_CREATE_JOINABLE 0 +# endif /* PTHREAD_CREATE_UNDETACHED */ +# endif /* PTHREAD_CREATE_JOINABLE */ + +# if !defined (PTHREAD_CREATE_DETACHED) +# define PTHREAD_CREATE_DETACHED 1 +# endif /* PTHREAD_CREATE_DETACHED */ + +# if !defined (PTHREAD_PROCESS_PRIVATE) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) +# if defined (PTHREAD_MUTEXTYPE_FAST) +# define PTHREAD_PROCESS_PRIVATE PTHREAD_MUTEXTYPE_FAST +# else +# define PTHREAD_PROCESS_PRIVATE 0 +# endif /* PTHREAD_MUTEXTYPE_FAST */ +# endif /* PTHREAD_PROCESS_PRIVATE */ + +# if !defined (PTHREAD_PROCESS_SHARED) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) +# if defined (PTHREAD_MUTEXTYPE_FAST) +# define PTHREAD_PROCESS_SHARED PTHREAD_MUTEXTYPE_FAST +# else +# define PTHREAD_PROCESS_SHARED 1 +# endif /* PTHREAD_MUTEXTYPE_FAST */ +# endif /* PTHREAD_PROCESS_SHARED */ + +# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (PTHREAD_PROCESS_PRIVATE) +# if !defined (USYNC_THREAD) +# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE +# endif /* ! USYNC_THREAD */ +# else +# if !defined (USYNC_THREAD) +# define USYNC_THREAD MUTEX_NONRECURSIVE_NP +# endif /* ! USYNC_THREAD */ +# endif /* PTHREAD_PROCESS_PRIVATE */ + +# if defined (PTHREAD_PROCESS_SHARED) +# if !defined (USYNC_PROCESS) +# define USYNC_PROCESS PTHREAD_PROCESS_SHARED +# endif /* ! USYNC_PROCESS */ +# else +# if !defined (USYNC_PROCESS) +# define USYNC_PROCESS MUTEX_NONRECURSIVE_NP +# endif /* ! USYNC_PROCESS */ +# endif /* PTHREAD_PROCESS_SHARED */ +# elif !defined (ACE_HAS_STHREADS) +# if !defined (USYNC_THREAD) +# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE +# endif /* ! USYNC_THREAD */ +# if !defined (USYNC_PROCESS) +# define USYNC_PROCESS PTHREAD_PROCESS_SHARED +# endif /* ! USYNC_PROCESS */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ + +/* MM-Graz: prevent warnings */ +# undef THR_BOUND +# undef THR_NEW_LWP +# undef THR_DETACHED +# undef THR_SUSPENDED +# undef THR_DAEMON + +# define THR_BOUND 0x00000001 +# if defined (CHORUS) +# define THR_NEW_LWP 0x00000000 +# else +# define THR_NEW_LWP 0x00000002 +# endif /* CHORUS */ +# define THR_DETACHED 0x00000040 +# define THR_SUSPENDED 0x00000080 +# define THR_DAEMON 0x00000100 +# define THR_JOINABLE 0x00010000 +# define THR_SCHED_FIFO 0x00020000 +# define THR_SCHED_RR 0x00040000 +# define THR_SCHED_DEFAULT 0x00080000 + +# if defined (ACE_HAS_IRIX62_THREADS) +# define THR_SCOPE_SYSTEM 0x00100000 +# else +# define THR_SCOPE_SYSTEM THR_BOUND +# endif /*ACE_HAS_IRIX62_THREADS*/ + +# define THR_SCOPE_PROCESS 0x00200000 +# define THR_INHERIT_SCHED 0x00400000 +# define THR_EXPLICIT_SCHED 0x00800000 +# define THR_SCHED_IO 0x01000000 + +# if !defined (ACE_HAS_STHREADS) +# if !defined (ACE_HAS_POSIX_SEM) +class ACE_OS; +/** + * @class ACE_sema_t + * + * @brief This is used to implement semaphores for platforms that support + * POSIX pthreads, but do *not* support POSIX semaphores, i.e., + * it's a different type than the POSIX <sem_t>. + */ +class ACE_OS_Export ACE_sema_t +{ +friend class ACE_OS; +protected: + /// Serialize access to internal state. + ACE_mutex_t lock_; + + /// Block until there are no waiters. + ACE_cond_t count_nonzero_; + + /// Count of the semaphore. + u_long count_; + + /// Number of threads that have called <ACE_OS::sema_wait>. + u_long waiters_; +}; +# endif /* !ACE_HAS_POSIX_SEM */ + +# if defined (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) + // If we are on Solaris we can just reuse the existing + // implementations of these synchronization types. +# if !defined (ACE_LACKS_RWLOCK_T) +# include /**/ <synch.h> +typedef rwlock_t ACE_rwlock_t; +# endif /* !ACE_LACKS_RWLOCK_T */ +# include /**/ <thread.h> +# endif /* (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) */ + +# else +# if !defined (ACE_HAS_POSIX_SEM) +typedef sema_t ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM */ +# endif /* !ACE_HAS_STHREADS */ +# elif defined (ACE_HAS_STHREADS) +// Solaris threads, without PTHREADS. +// Typedefs to help compatibility with Windows NT and Pthreads. +typedef thread_t ACE_thread_t; +typedef thread_key_t ACE_thread_key_t; +typedef mutex_t ACE_mutex_t; +# if !defined (ACE_LACKS_RWLOCK_T) +typedef rwlock_t ACE_rwlock_t; +# endif /* !ACE_LACKS_RWLOCK_T */ +# if !defined (ACE_HAS_POSIX_SEM) +typedef sema_t ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM */ + +typedef cond_t ACE_cond_t; +struct ACE_OS_Export ACE_condattr_t +{ + int type; +}; +struct ACE_OS_Export ACE_mutexattr_t +{ + int type; +}; +typedef ACE_thread_t ACE_hthread_t; +typedef ACE_mutex_t ACE_thread_mutex_t; + +# define THR_CANCEL_DISABLE 0 +# define THR_CANCEL_ENABLE 0 +# define THR_CANCEL_DEFERRED 0 +# define THR_CANCEL_ASYNCHRONOUS 0 +# define THR_JOINABLE 0 +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 + +# elif defined (ACE_PSOS) + +// Some versions of pSOS provide native mutex support. For others, +// implement ACE_thread_mutex_t and ACE_mutex_t using pSOS semaphores. +// Either way, the types are all u_longs. +typedef u_long ACE_mutex_t; +typedef u_long ACE_thread_mutex_t; +typedef u_long ACE_thread_t; +typedef u_long ACE_hthread_t; + +# if defined (ACE_PSOS_HAS_COND_T) +typedef u_long ACE_cond_t; +typedef u_long ACE_condattr_t; +struct ACE_OS_Export ACE_mutexattr_t +{ + int type; +}; +# endif /* ACE_PSOS_HAS_COND_T */ + + +// TCB registers 0-7 are for application use +# define PSOS_TASK_REG_TSS 0 +# define PSOS_TASK_REG_MAX 7 + +# define PSOS_TASK_MIN_PRIORITY 1 +# define PSOS_TASK_MAX_PRIORITY 239 + +// Key type: the ACE TSS emulation requires the key type be unsigned, +// for efficiency. Current POSIX and Solaris TSS implementations also +// use unsigned int, so the ACE TSS emulation is compatible with them. +// Native pSOS TSD, where available, uses unsigned long as the key type. +# if defined (ACE_PSOS_HAS_TSS) +typedef u_long ACE_thread_key_t; +# else +typedef u_int ACE_thread_key_t; +# endif /* ACE_PSOS_HAS_TSS */ + +# define THR_CANCEL_DISABLE 0 /* thread can never be cancelled */ +# define THR_CANCEL_ENABLE 0 /* thread can be cancelled */ +# define THR_CANCEL_DEFERRED 0 /* cancellation deferred to cancellation point */ +# define THR_CANCEL_ASYNCHRONOUS 0 /* cancellation occurs immediately */ + +# define THR_BOUND 0 +# define THR_NEW_LWP 0 +# define THR_DETACHED 0 +# define THR_SUSPENDED 0 +# define THR_DAEMON 0 +# define THR_JOINABLE 0 + +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 +# define USYNC_THREAD T_LOCAL +# define USYNC_PROCESS T_GLOBAL + +/* from psos.h */ +/* #define T_NOPREEMPT 0x00000001 Not preemptible bit */ +/* #define T_PREEMPT 0x00000000 Preemptible */ +/* #define T_TSLICE 0x00000002 Time-slicing enabled bit */ +/* #define T_NOTSLICE 0x00000000 No Time-slicing */ +/* #define T_NOASR 0x00000004 ASRs disabled bit */ +/* #define T_ASR 0x00000000 ASRs enabled */ + +/* #define SM_GLOBAL 0x00000001 1 = Global */ +/* #define SM_LOCAL 0x00000000 0 = Local */ +/* #define SM_PRIOR 0x00000002 Queue by priority */ +/* #define SM_FIFO 0x00000000 Queue by FIFO order */ + +/* #define T_NOFPU 0x00000000 Not using FPU */ +/* #define T_FPU 0x00000002 Using FPU bit */ + +# elif defined (VXWORKS) +// For mutex implementation using mutual-exclusion semaphores (which +// can be taken recursively). +# include /**/ <semLib.h> + +# include /**/ <envLib.h> +# include /**/ <hostLib.h> +# include /**/ <ioLib.h> +# include /**/ <remLib.h> +# include /**/ <selectLib.h> +# include /**/ <sigLib.h> +# include /**/ <sockLib.h> +# include /**/ <sysLib.h> +# include /**/ <taskLib.h> +# include /**/ <taskHookLib.h> + +extern "C" +struct sockaddr_un { + short sun_family; // AF_UNIX. + char sun_path[108]; // path name. +}; + +# define MAXPATHLEN 1024 +# define MAXNAMLEN 255 +# define NSIG (_NSIGS + 1) + +// task options: the other options are either obsolete, internal, or for +// Fortran or Ada support +# define VX_UNBREAKABLE 0x0002 /* breakpoints ignored */ +# define VX_FP_TASK 0x0008 /* floating point coprocessor */ +# define VX_PRIVATE_ENV 0x0080 /* private environment support */ +# define VX_NO_STACK_FILL 0x0100 /* do not stack fill for + checkstack () */ + +# define THR_CANCEL_DISABLE 0 +# define THR_CANCEL_ENABLE 0 +# define THR_CANCEL_DEFERRED 0 +# define THR_CANCEL_ASYNCHRONOUS 0 +# define THR_BOUND 0 +# define THR_NEW_LWP 0 +# define THR_DETACHED 0 +# define THR_SUSPENDED 0 +# define THR_DAEMON 0 +# define THR_JOINABLE 0 +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 +# define THR_INHERIT_SCHED 0 +# define THR_EXPLICIT_SCHED 0 +# define THR_SCHED_IO 0 +# define THR_SCOPE_SYSTEM 0 +# define THR_SCOPE_PROCESS 0 +# define USYNC_THREAD 0 +# define USYNC_PROCESS 1 /* It's all global on VxWorks + (without MMU option). */ + +# if !defined (ACE_DEFAULT_SYNCH_TYPE) + // Types include these options: SEM_Q_PRIORITY, SEM_Q_FIFO, + // SEM_DELETE_SAFE, and SEM_INVERSION_SAFE. SEM_Q_FIFO is + // used as the default because that is VxWorks' default. +# define ACE_DEFAULT_SYNCH_TYPE SEM_Q_FIFO +# endif /* ! ACE_DEFAULT_SYNCH_TYPE */ + +typedef SEM_ID ACE_mutex_t; +// Implement ACE_thread_mutex_t with ACE_mutex_t because there's just +// one process . . . +typedef ACE_mutex_t ACE_thread_mutex_t; +# if !defined (ACE_HAS_POSIX_SEM) +// Use VxWorks semaphores, wrapped ... +typedef struct +{ + SEM_ID sema_; + // Semaphore handle. This is allocated by VxWorks. + + char *name_; + // Name of the semaphore: always NULL with VxWorks. +} ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM */ +typedef char * ACE_thread_t; +typedef int ACE_hthread_t; +// Key type: the ACE TSS emulation requires the key type be unsigned, +// for efficiency. (Current POSIX and Solaris TSS implementations also +// use u_int, so the ACE TSS emulation is compatible with them.) +typedef u_int ACE_thread_key_t; + + // Marker for ACE_Thread_Manager to indicate that it allocated + // an ACE_thread_t. It is placed at the beginning of the ID. +# define ACE_THR_ID_ALLOCATED '\022' + +# elif defined (ACE_HAS_WTHREADS) + +typedef CRITICAL_SECTION ACE_thread_mutex_t; + +typedef struct +{ + int type_; // Either USYNC_THREAD or USYNC_PROCESS + union + { + HANDLE proc_mutex_; + CRITICAL_SECTION thr_mutex_; + }; +} ACE_mutex_t; + +// Wrapper for NT Events. +typedef HANDLE ACE_event_t; + +# if defined (ACE_WIN32) +// This can probably get _wider_ as more types are defined in PACE. +// ie: see above ACE_mutex_t + +//@@ ACE_USES_WINCE_SEMA_SIMULATION is used to debug +// semaphore simulation on WinNT. It should be +// changed to ACE_USES_HAS_WINCE at some later point. +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +typedef HANDLE ACE_sema_t; +# else +/** + * @class ACE_sema_t + * + * @brief Semaphore simulation for Windows CE. + */ +class ACE_OS_Export ACE_sema_t +{ +public: + /// Serializes access to <count_>. + ACE_thread_mutex_t lock_; + + /// This event is signaled whenever the count becomes non-zero. + ACE_event_t count_nonzero_; + + /// Current count of the semaphore. + u_int count_; +}; + +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# endif /* defined (ACE_WIN32) */ + +// These need to be different values, neither of which can be 0... +# define USYNC_THREAD 1 +# define USYNC_PROCESS 2 + +# define THR_CANCEL_DISABLE 0 +# define THR_CANCEL_ENABLE 0 +# define THR_CANCEL_DEFERRED 0 +# define THR_CANCEL_ASYNCHRONOUS 0 +# define THR_DETACHED 0x02000000 /* ignore in most places */ +# define THR_BOUND 0 /* ignore in most places */ +# define THR_NEW_LWP 0 /* ignore in most places */ +# define THR_DAEMON 0 /* ignore in most places */ +# define THR_JOINABLE 0 /* ignore in most places */ +# define THR_SUSPENDED CREATE_SUSPENDED +# define THR_USE_AFX 0x01000000 +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 +# define THR_SCOPE_PROCESS 0 +# define THR_SCOPE_SYSTEM 0 +# endif /* ACE_HAS_PTHREADS / STHREADS / PSOS / VXWORKS / WTHREADS */ + +# if defined (ACE_LACKS_COND_T) && defined (ACE_WIN32) +/** + * @class ACE_cond_t + * + * @brief This structure is used to implement condition variables on + * platforms that lack it natively, such as VxWorks, pSoS, and + * Win32. + * + * At the current time, this stuff only works for threads + * within the same process. + */ +class ACE_OS_Export ACE_cond_t +{ +public: + friend class ACE_OS; + + /// Returns the number of waiters. + long waiters (void) const; + +protected: + /// Number of waiting threads. + long waiters_; + + /// Serialize access to the waiters count. + ACE_thread_mutex_t waiters_lock_; + + /// Queue up threads waiting for the condition to become signaled. + ACE_sema_t sema_; + +# if defined (VXWORKS) || defined (ACE_PSOS) + /** + * A semaphore used by the broadcast/signal thread to wait for all + * the waiting thread(s) to wake up and be released from the + * semaphore. + */ + ACE_sema_t waiters_done_; +# elif defined (ACE_WIN32) + /** + * An auto reset event used by the broadcast/signal thread to wait + * for the waiting thread(s) to wake up and get a chance at the + * semaphore. + */ + HANDLE waiters_done_; +# else +# error "Please implement this feature or check your config.h file!" +# endif /* VXWORKS || ACE_PSOS */ + + /// Keeps track of whether we were broadcasting or just signaling. + size_t was_broadcast_; +}; + +struct ACE_OS_Export ACE_condattr_t +{ + int type; +}; + +struct ACE_OS_Export ACE_mutexattr_t +{ + int type; +}; +# endif /* ACE_LACKS_COND_T */ + +# if defined (ACE_LACKS_RWLOCK_T) && !defined (ACE_HAS_PTHREADS_UNIX98_EXT) + +/** + * @class ACE_rwlock_t + * + * @brief This is used to implement readers/writer locks on NT, + * VxWorks, and POSIX pthreads. + * + * At the current time, this stuff only works for threads + * within the same process. + */ +struct ACE_OS_Export ACE_rwlock_t +{ +protected: + friend class ACE_OS; + + ACE_mutex_t lock_; + // Serialize access to internal state. + + ACE_cond_t waiting_readers_; + // Reader threads waiting to acquire the lock. + + int num_waiting_readers_; + // Number of waiting readers. + + ACE_cond_t waiting_writers_; + // Writer threads waiting to acquire the lock. + + int num_waiting_writers_; + // Number of waiting writers. + + int ref_count_; + // Value is -1 if writer has the lock, else this keeps track of the + // number of readers holding the lock. + + int important_writer_; + // indicate that a reader is trying to upgrade + + ACE_cond_t waiting_important_writer_; + // condition for the upgrading reader +}; +# elif defined (ACE_HAS_PTHREADS_UNIX98_EXT) +typedef pthread_rwlock_t ACE_rwlock_t; +# elif defined (ACE_HAS_STHREADS) +# include /**/ <synch.h> +typedef rwlock_t ACE_rwlock_t; +# endif /* ACE_LACKS_RWLOCK_T */ + +// Define some default thread priorities on all threaded platforms, if +// not defined above or in the individual platform config file. +// ACE_THR_PRI_FIFO_DEF should be used by applications for default +// real-time thread priority. ACE_THR_PRI_OTHER_DEF should be used +// for non-real-time priority. +# if !defined(ACE_THR_PRI_FIFO_DEF) +# if defined (ACE_WTHREADS) + // It would be more in spirit to use THREAD_PRIORITY_NORMAL. But, + // using THREAD_PRIORITY_ABOVE_NORMAL should give preference to the + // threads in this process, even if the process is not in the + // REALTIME_PRIORITY_CLASS. +# define ACE_THR_PRI_FIFO_DEF THREAD_PRIORITY_ABOVE_NORMAL +# else /* ! ACE_WTHREADS */ +# define ACE_THR_PRI_FIFO_DEF 0 +# endif /* ! ACE_WTHREADS */ +# endif /* ! ACE_THR_PRI_FIFO_DEF */ + +# if !defined(ACE_THR_PRI_OTHER_DEF) +# if defined (ACE_WTHREADS) + // It would be more in spirit to use THREAD_PRIORITY_NORMAL. But, + // using THREAD_PRIORITY_ABOVE_NORMAL should give preference to the + // threads in this process, even if the process is not in the + // REALTIME_PRIORITY_CLASS. +# define ACE_THR_PRI_OTHER_DEF THREAD_PRIORITY_NORMAL +# else /* ! ACE_WTHREADS */ +# define ACE_THR_PRI_OTHER_DEF 0 +# endif /* ! ACE_WTHREADS */ +# endif /* ! ACE_THR_PRI_OTHER_DEF */ + +# if defined (ACE_HAS_RECURSIVE_MUTEXES) +typedef ACE_thread_mutex_t ACE_recursive_thread_mutex_t; +# else +/** + * @class ACE_recursive_thread_mutex_t + * + * @brief Implement a thin C++ wrapper that allows nested acquisition + * and release of a mutex that occurs in the same thread. + * + * This implementation is based on an algorithm sketched by Dave + * Butenhof <butenhof@zko.dec.com>. Naturally, I take the + * credit for any mistakes ;-) + */ +class ACE_recursive_thread_mutex_t +{ +public: + /// Guards the state of the nesting level and thread id. + ACE_thread_mutex_t nesting_mutex_; + + /// This condition variable suspends other waiting threads until the + /// mutex is available. + ACE_cond_t lock_available_; + + /// Current nesting level of the recursion. + int nesting_level_; + + /// Current owner of the lock. + ACE_thread_t owner_id_; +}; +# endif /* ACE_WIN32 */ + +# else /* !ACE_HAS_THREADS, i.e., the OS/platform doesn't support threading. */ + +// Give these things some reasonable value... +# define ACE_SCOPE_PROCESS 0 +# define ACE_SCOPE_LWP 1 +# define ACE_SCOPE_THREAD 2 +# define ACE_SCHED_OTHER 0 +# define ACE_SCHED_FIFO 1 +# define ACE_SCHED_RR 2 +# if !defined (THR_CANCEL_DISABLE) +# define THR_CANCEL_DISABLE 0 +# endif /* ! THR_CANCEL_DISABLE */ +# if !defined (THR_CANCEL_ENABLE) +# define THR_CANCEL_ENABLE 0 +# endif /* ! THR_CANCEL_ENABLE */ +# if !defined (THR_CANCEL_DEFERRED) +# define THR_CANCEL_DEFERRED 0 +# endif /* ! THR_CANCEL_DEFERRED */ +# if !defined (THR_CANCEL_ASYNCHRONOUS) +# define THR_CANCEL_ASYNCHRONOUS 0 +# endif /* ! THR_CANCEL_ASYNCHRONOUS */ +# if !defined (THR_JOINABLE) +# define THR_JOINABLE 0 /* ignore in most places */ +# endif /* ! THR_JOINABLE */ +# if !defined (THR_DETACHED) +# define THR_DETACHED 0 /* ignore in most places */ +# endif /* ! THR_DETACHED */ +# if !defined (THR_DAEMON) +# define THR_DAEMON 0 /* ignore in most places */ +# endif /* ! THR_DAEMON */ +# if !defined (THR_BOUND) +# define THR_BOUND 0 /* ignore in most places */ +# endif /* ! THR_BOUND */ +# if !defined (THR_NEW_LWP) +# define THR_NEW_LWP 0 /* ignore in most places */ +# endif /* ! THR_NEW_LWP */ +# if !defined (THR_SUSPENDED) +# define THR_SUSPENDED 0 /* ignore in most places */ +# endif /* ! THR_SUSPENDED */ +# if !defined (THR_SCHED_FIFO) +# define THR_SCHED_FIFO 0 +# endif /* ! THR_SCHED_FIFO */ +# if !defined (THR_SCHED_RR) +# define THR_SCHED_RR 0 +# endif /* ! THR_SCHED_RR */ +# if !defined (THR_SCHED_DEFAULT) +# define THR_SCHED_DEFAULT 0 +# endif /* ! THR_SCHED_DEFAULT */ +# if !defined (USYNC_THREAD) +# define USYNC_THREAD 0 +# endif /* ! USYNC_THREAD */ +# if !defined (USYNC_PROCESS) +# define USYNC_PROCESS 0 +# endif /* ! USYNC_PROCESS */ +# if !defined (THR_SCOPE_PROCESS) +# define THR_SCOPE_PROCESS 0 +# endif /* ! THR_SCOPE_PROCESS */ +# if !defined (THR_SCOPE_SYSTEM) +# define THR_SCOPE_SYSTEM 0 +# endif /* ! THR_SCOPE_SYSTEM */ + +// These are dummies needed for class OS.h +typedef int ACE_cond_t; +struct ACE_OS_Export ACE_condattr_t +{ + int type; +}; +struct ACE_OS_Export ACE_mutexattr_t +{ + int type; +}; +typedef int ACE_mutex_t; +typedef int ACE_thread_mutex_t; +typedef int ACE_recursive_thread_mutex_t; +# if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) +typedef int ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM && !ACE_PSOS */ +typedef int ACE_rwlock_t; +typedef int ACE_thread_t; +typedef int ACE_hthread_t; +typedef u_int ACE_thread_key_t; + +// Ensure that ACE_THR_PRI_FIFO_DEF and ACE_THR_PRI_OTHER_DEF are +// defined on non-threaded platforms, to support application source +// code compatibility. ACE_THR_PRI_FIFO_DEF should be used by +// applications for default real-time thread priority. +// ACE_THR_PRI_OTHER_DEF should be used for non-real-time priority. +# if !defined(ACE_THR_PRI_FIFO_DEF) +# define ACE_THR_PRI_FIFO_DEF 0 +# endif /* ! ACE_THR_PRI_FIFO_DEF */ +# if !defined(ACE_THR_PRI_OTHER_DEF) +# define ACE_THR_PRI_OTHER_DEF 0 +# endif /* ! ACE_THR_PRI_OTHER_DEF */ + +# endif /* ACE_HAS_THREADS */ + + + + +#endif /* ACE_ACE_THREADS_H */ diff --git a/ace/ace_time.h b/ace/ace_time.h new file mode 100644 index 00000000000..da4448cccf3 --- /dev/null +++ b/ace/ace_time.h @@ -0,0 +1,52 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_time.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_TIME_H +#define ACE_ACE_TIME_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ <time.h> + +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) +using std::time_t; +using std::tm; +# if defined (ACE_WIN32) +using std::_timezone; +# else +using std::timezone; +# endif +using std::difftime; +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ + +# if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T)) +typedef int clockid_t; +# if !defined (CLOCK_REALTIME) +# define CLOCK_REALTIME 0 +# endif /* CLOCK_REALTIME */ +# endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ + +// does this belong here? +# if defined (ACE_HAS_BROKEN_CTIME) +# undef ctime +# endif /* ACE_HAS_BROKEN_CTIME */ + + +#endif /* ACE_ACE_TIME_H */ + diff --git a/ace/ace_vxworks.h b/ace/ace_vxworks.h new file mode 100644 index 00000000000..62a8bbd18ab --- /dev/null +++ b/ace/ace_vxworks.h @@ -0,0 +1,117 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_vxworks.h + * + * $Id$ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author etc + */ +//============================================================================= + +#ifndef ACE_ACE_VXWORKS_H +#define ACE_ACE_VXWORKS_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// this one is still broken! ;-( + + + +# if defined (VXWORKS) +// For mutex implementation using mutual-exclusion semaphores (which +// can be taken recursively). +# include /**/ <semLib.h> + +# include /**/ <envLib.h> +# include /**/ <hostLib.h> +# include /**/ <ioLib.h> +# include /**/ <remLib.h> +# include /**/ <selectLib.h> +# include /**/ <sigLib.h> +# include /**/ <sockLib.h> +# include /**/ <sysLib.h> +# include /**/ <taskLib.h> +# include /**/ <taskHookLib.h> + +extern "C" +struct sockaddr_un { + short sun_family; // AF_UNIX. + char sun_path[108]; // path name. +}; + +# define MAXPATHLEN 1024 +# define MAXNAMLEN 255 +# define NSIG (_NSIGS + 1) + +// task options: the other options are either obsolete, internal, or for +// Fortran or Ada support +# define VX_UNBREAKABLE 0x0002 /* breakpoints ignored */ +# define VX_FP_TASK 0x0008 /* floating point coprocessor */ +# define VX_PRIVATE_ENV 0x0080 /* private environment support */ +# define VX_NO_STACK_FILL 0x0100 /* do not stack fill for + checkstack () */ + +# define THR_CANCEL_DISABLE 0 +# define THR_CANCEL_ENABLE 0 +# define THR_CANCEL_DEFERRED 0 +# define THR_CANCEL_ASYNCHRONOUS 0 +# define THR_BOUND 0 +# define THR_NEW_LWP 0 +# define THR_DETACHED 0 +# define THR_SUSPENDED 0 +# define THR_DAEMON 0 +# define THR_JOINABLE 0 +# define THR_SCHED_FIFO 0 +# define THR_SCHED_RR 0 +# define THR_SCHED_DEFAULT 0 +# define THR_INHERIT_SCHED 0 +# define THR_EXPLICIT_SCHED 0 +# define THR_SCHED_IO 0 +# define THR_SCOPE_SYSTEM 0 +# define THR_SCOPE_PROCESS 0 +# define USYNC_THREAD 0 +# define USYNC_PROCESS 1 /* It's all global on VxWorks + (without MMU option). */ +# if !defined (ACE_DEFAULT_SYNCH_TYPE) + // Types include these options: SEM_Q_PRIORITY, SEM_Q_FIFO, + // SEM_DELETE_SAFE, and SEM_INVERSION_SAFE. SEM_Q_FIFO is + // used as the default because that is VxWorks' default. +# define ACE_DEFAULT_SYNCH_TYPE SEM_Q_FIFO +# endif /* ! ACE_DEFAULT_SYNCH_TYPE */ + +typedef SEM_ID ACE_mutex_t; +// Implement ACE_thread_mutex_t with ACE_mutex_t because there's just +// one process . . . +typedef ACE_mutex_t ACE_thread_mutex_t; +# if !defined (ACE_HAS_POSIX_SEM) +// Use VxWorks semaphores, wrapped ... +typedef struct +{ + SEM_ID sema_; + // Semaphore handle. This is allocated by VxWorks. + + char *name_; + // Name of the semaphore: always NULL with VxWorks. +} ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM */ +typedef char * ACE_thread_t; +typedef int ACE_hthread_t; +// Key type: the ACE TSS emulation requires the key type be unsigned, +// for efficiency. (Current POSIX and Solaris TSS implementations also +// use u_int, so the ACE TSS emulation is compatible with them.) +typedef u_int ACE_thread_key_t; + + // Marker for ACE_Thread_Manager to indicate that it allocated + // an ACE_thread_t. It is placed at the beginning of the ID. +# define ACE_THR_ID_ALLOCATED '\022' + + +#endif /* ACE_ACE_VXWORKS_H */ |