diff options
author | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-11 14:04:59 +0000 |
---|---|---|
committer | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-11 14:04:59 +0000 |
commit | fb6b60e963d347d9e5a01708aac31261c55fe1de (patch) | |
tree | 445fdd238071090722e4f67ef9fa703f6f012fa1 /ace | |
parent | 44e551b29092aa887afa218431f810d9e65a424e (diff) | |
download | ATCD-fb6b60e963d347d9e5a01708aac31261c55fe1de.tar.gz |
fixes for templates as args to templates on pSOS
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Containers.cpp | 4 | ||||
-rw-r--r-- | ace/Containers.h | 4 | ||||
-rw-r--r-- | ace/OS.h | 6 | ||||
-rw-r--r-- | ace/OS.i | 167 | ||||
-rw-r--r-- | ace/config-psos-diab.h | 9 |
5 files changed, 156 insertions, 34 deletions
diff --git a/ace/Containers.cpp b/ace/Containers.cpp index 8d2c94301d8..64e34206e98 100644 --- a/ace/Containers.cpp +++ b/ace/Containers.cpp @@ -2127,6 +2127,8 @@ ACE_Ordered_MultiSet_Iterator<T>::next (T *&item) const return 0; } +#if ! defined (ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER) + ACE_ALLOC_HOOK_DEFINE (ACE_DLList_Node) ACE_ALLOC_HOOK_DEFINE (ACE_DLList) @@ -2182,6 +2184,8 @@ ACE_DLList<T>::delete_tail (void) ACE_ALLOC_HOOK_DEFINE (ACE_DLList_Iterator) +#endif /* ! defined (ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER) */ + // Dynamically initialize an array. template <class T> diff --git a/ace/Containers.h b/ace/Containers.h index bb11029f369..794c22db114 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -677,6 +677,9 @@ protected: // Allocation Strategy of the queue. }; + +#if ! defined (ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER) + // // I found ACE_Double_Linked_List really difficult to use. So, I create // another layer of abstraction on top of it to make it easier to use. @@ -820,6 +823,7 @@ public: }; +#endif /* ! defined (ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER) */ template <class T> class ACE_Unbounded_Set_Iterator @@ -587,6 +587,7 @@ typedef int key_t; #define ENOMEM 12 /* Not enough core */ # endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ #define EACCES 13 /* Permission denied */ + #define EFAULT 14 /* Bad access */ # if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) #define EEXIST 17 /* File exists */ # endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ @@ -696,11 +697,16 @@ typedef int key_t; // 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 +typedef XDIR DIR; + // Use pSOS semaphores, wrapped . . . typedef struct { @@ -9960,9 +9960,7 @@ ACE_INLINE int ACE_OS::sigaddset (sigset_t *s, int signum) { // ACE_TRACE ("ACE_OS::sigaddset"); -#if !defined (ACE_LACKS_SIGSET) - ACE_OSCALL_RETURN (::sigaddset (s, signum), int, -1); -#else +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) if (s == NULL) { errno = EFAULT ; return -1 ; @@ -9971,17 +9969,30 @@ ACE_OS::sigaddset (sigset_t *s, int signum) errno = EINVAL ; return -1 ; // Invalid signum, return error } +# if defined (ACE_PSOS) && defined (__DIAB) + // treat 0th u_long of sigset_t as high bits, + // and 1st u_long of sigset_t as low bits. + if (signum <= ACE_BITS_PER_ULONG) + { + s->s[1] |= (1 << (signum - 1)) ; + } + else + { + s->s[0] |= (1 << (signum - ACE_BITS_PER_ULONG - 1)) ; + } +# else *s |= (1 << (signum - 1)) ; +# endif /* defined (ACE_PSOS) && defined (__DIAB) */ return 0 ; -#endif /* !ACE_LACKS_SIGSET */ +#else + ACE_OSCALL_RETURN (::sigaddset (s, signum), int, -1); +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE int ACE_OS::sigdelset (sigset_t *s, int signum) { -#if !defined (ACE_LACKS_SIGSET) - ACE_OSCALL_RETURN (::sigdelset (s, signum), int, -1); -#else +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) if (s == NULL) { errno = EFAULT ; return -1 ; @@ -9990,54 +10001,70 @@ ACE_OS::sigdelset (sigset_t *s, int signum) errno = EINVAL ; return -1 ; // Invalid signum, return error } +# if defined (ACE_PSOS) && defined (__DIAB) + // treat 0th u_long of sigset_t as high bits, + // and 1st u_long of sigset_t as low bits. + if (signum <= ACE_BITS_PER_ULONG) + { + s->s[1] &= ~(1 << (signum - 1)) ; + } + else + { + s->s[0] &= ~(1 << (signum - ACE_BITS_PER_ULONG - 1)) ; + } +# else *s &= ~(1 << (signum - 1)) ; +# endif /* defined (ACE_PSOS) && defined (__DIAB) */ return 0 ; -#endif /* !ACE_LACKS_SIGSET */ +#else + ACE_OSCALL_RETURN (::sigdelset (s, signum), int, -1); +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE int ACE_OS::sigemptyset (sigset_t *s) { -#if !defined (ACE_LACKS_SIGSET) - ACE_OSCALL_RETURN (::sigemptyset (s), int, -1); -#else +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) if (s == NULL) { errno = EFAULT ; return -1 ; } +# if defined (ACE_PSOS) && defined (__DIAB) + s->s[0] = 0 ; + s->s[1] = 0 ; +# else *s = 0 ; +# endif /* defined (ACE_PSOS) && defined (__DIAB) */ return 0 ; -#endif /* !ACE_LACKS_SIGSET */ +#else + ACE_OSCALL_RETURN (::sigemptyset (s), int, -1); +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE int ACE_OS::sigfillset (sigset_t *s) { -#if !defined (ACE_LACKS_SIGSET) - ACE_OSCALL_RETURN (::sigfillset (s), int, -1); -#else +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) if (s == NULL) { errno = EFAULT ; return -1 ; } +# if defined (ACE_PSOS) && defined (__DIAB) + s->s[0] = ~(u_long) 0 ; + s->s[1] = ~(u_long) 0 ; +# else *s = ~(sigset_t) 0 ; +# endif /* defined (ACE_PSOS) && defined (__DIAB) */ return 0 ; -#endif /* !ACE_LACKS_SIGSET */ +#else + ACE_OSCALL_RETURN (::sigfillset (s), int, -1); +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE int ACE_OS::sigismember (sigset_t *s, int signum) { -#if !defined (ACE_LACKS_SIGSET) -#if defined (ACE_HAS_SIGISMEMBER_BUG) - if (signum < 1 || signum >= ACE_NSIG) - { - errno = EINVAL ; - return -1 ; // Invalid signum, return error - } -#endif /* ACE_HAS_SIGISMEMBER_BUG */ - ACE_OSCALL_RETURN (::sigismember (s, signum), int, -1); -#else +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) if (s == NULL) { errno = EFAULT ; return -1 ; @@ -10046,25 +10073,47 @@ ACE_OS::sigismember (sigset_t *s, int signum) errno = EINVAL ; return -1 ; // Invalid signum, return error } +# if defined (ACE_PSOS) && defined (__DIAB) + // treat 0th u_long of sigset_t as high bits, + // and 1st u_long of sigset_t as low bits. + if (signum <= ACE_BITS_PER_ULONG) + { + return ((s->s[1] & (1 << (signum - 1))) != 0) ; + } + else + { + return ((s->s[0] & (1 << (signum - ACE_BITS_PER_ULONG - 1))) != 0) ; + } +# else return ((*s & (1 << (signum - 1))) != 0) ; -#endif /* !ACE_LACKS_SIGSET */ +# endif /* defined (ACE_PSOS) && defined (__DIAB) */ +#else +# if defined (ACE_HAS_SIGISMEMBER_BUG) + if (signum < 1 || signum >= ACE_NSIG) + { + errno = EINVAL ; + return -1 ; // Invalid signum, return error + } +# endif /* ACE_HAS_SIGISMEMBER_BUG */ + ACE_OSCALL_RETURN (::sigismember (s, signum), int, -1); +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE int ACE_OS::sigprocmask (int how, const sigset_t *nsp, sigset_t *osp) { -#if !defined (ACE_LACKS_SIGSET) +#if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) + ACE_UNUSED_ARG (how); + ACE_UNUSED_ARG (nsp); + ACE_UNUSED_ARG (osp); + ACE_NOTSUP_RETURN (-1); +#else # if defined (ACE_LACKS_POSIX_PROTOTYPES) ACE_OSCALL_RETURN (::sigprocmask (how, (int*) nsp, osp), int, -1); # else ACE_OSCALL_RETURN (::sigprocmask (how, nsp, osp), int, -1); # endif /* ACE_LACKS_POSIX_PROTOTYPES */ -#else - ACE_UNUSED_ARG (how); - ACE_UNUSED_ARG (nsp); - ACE_UNUSED_ARG (osp); - ACE_NOTSUP_RETURN (-1); -#endif /* !ACE_LACKS_SIGSET */ +#endif /* ACE_LACKS_SIGSET || ACE_LACKS_SIGSET_DEFINITIONS */ } ACE_INLINE void * @@ -10216,8 +10265,26 @@ ACE_INLINE DIR * ACE_OS::opendir (const char *filename) { #if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + // The pointer to the DIR buffer must be passed to ACE_OS::closedir + // in order to free it and avoid a memory leak. + DIR *dir; + u_long result; + ACE_NEW_RETURN (dir, DIR, 0); + result = ::open_dir (ACE_const_cast (char *, filename), dir); + if (0 == result) + { + return dir; + } + else + { + errno = result; + return 0; + } +# else /* ! defined (ACE_PSOS) */ // VxWorks' ::opendir () is declared with a non-const argument. return ::opendir (ACE_const_cast (char *, filename)); +# endif /* ! defined (ACE_PSOS) */ #else ACE_UNUSED_ARG (filename); ACE_NOTSUP_RETURN (0); @@ -10228,7 +10295,17 @@ ACE_INLINE void ACE_OS::closedir (DIR *d) { #if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + u_long result; + result = ::close_dir (d); + delete d; + if (result != 0) + { + errno = result; + } +# else /* ! defined (ACE_PSOS) */ ::closedir (d); +# endif /* ! defined (ACE_PSOS) */ #else ACE_UNUSED_ARG (d); #endif /* ACE_HAS_DIRENT */ @@ -10238,7 +10315,25 @@ ACE_INLINE struct dirent * ACE_OS::readdir (DIR *d) { #if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + // The returned pointer to the dirent struct must be + // deleted by the caller to avoid a memory leak. + struct dirent *dir_ent; + u_long result; + ACE_NEW_RETURN (dir_ent, dirent, 0); + result = ::read_dir (d, dir_ent); + if (0 == result) + { + return dir_ent; + } + else + { + errno = result; + return 0; + } +# else /* ! defined (ACE_PSOS) */ return ::readdir (d); +# endif /* ! defined (ACE_PSOS) */ #else ACE_UNUSED_ARG (d); ACE_NOTSUP_RETURN (0); @@ -10294,7 +10389,11 @@ ACE_OS::rewinddir (DIR *d) { #if defined (ACE_HAS_DIRENT) # if defined (ACE_LACKS_SEEKDIR) +# if defined (ACE_LACKS_REWINDDIR) + ACE_UNUSED_ARG (d); +# else /* ! defined (ACE_LACKS_REWINDDIR) */ ::rewinddir (d); +# endif /* ! defined (ACE_LACKS_REWINDDIR) */ # else /* ! ACE_LACKS_SEEKDIR */ // We need to implement <rewinddir> using <seekdir> since it's often // defined as a macro... diff --git a/ace/config-psos-diab.h b/ace/config-psos-diab.h index 0d732d8a918..dd82e210204 100644 --- a/ace/config-psos-diab.h +++ b/ace/config-psos-diab.h @@ -16,6 +16,8 @@ #define ACE_LACKS_INLINE_FUNCTIONS +#define ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER + #if defined (__GNUG__) # include "ace/config-g++-common.h" #endif /* __GNUG__ */ @@ -34,6 +36,12 @@ # define ACE_HAS_BROKEN_NOOP_DTORS +# define ACE_HAS_DIRENT +# define ACE_LACKS_READDIR_R +# define ACE_LACKS_TELLDIR +# define ACE_LACKS_SEEKDIR +# define ACE_LACKS_REWINDDIR + // Template instantiation definitions // #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_FILE #define ACE_TEMPLATES_REQUIRE_SOURCE @@ -107,6 +115,7 @@ #define ACE_HAS_SIGINFO_T #define ACE_LACKS_SIGINFO_H #define ACE_SIGINFO_IS_SIGINFO_T +#define ACE_LACKS_SIGSET_DEFINITIONS #define ACE_HAS_SIGWAIT |