diff options
author | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-01 17:57:41 +0000 |
---|---|---|
committer | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-09-01 17:57:41 +0000 |
commit | 52d506a41bb7645c30ab37b3d77da33e186fa584 (patch) | |
tree | b16229cb09483756ed9c560111b40ebceaa7fa69 | |
parent | 078a293b513620b912af488def022fe20c790f24 (diff) | |
download | ATCD-52d506a41bb7645c30ab37b3d77da33e186fa584.tar.gz |
pSOS Diab and Trimedia compiler port checkin
34 files changed, 2111 insertions, 869 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 5cc4b3178af..06c3d39af3f 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -666,21 +666,44 @@ ACE::ldfind (const ASYS_TCHAR filename[], #endif /* ACE_DIRECTORY_SEPARATOR_CHAR */ // First, try matching the filename *without* adding a // prefix. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_OS::sprintf (pathname, + ASYS_TEXT ("%s%s%s"), + searchpathname, + searchfilename, + got_suffix ? ACE_static_cast (char *, + ASYS_TEXT ("")) + : ACE_static_cast (char *, + dll_suffix)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_OS::sprintf (pathname, ASYS_TEXT ("%s%s%s"), searchpathname, searchfilename, got_suffix ? ASYS_TEXT ("") : dll_suffix); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ if (ACE_OS::access (pathname, F_OK) == 0) return 0; // Second, try matching the filename *with* adding a prefix. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_OS::sprintf (pathname, + ASYS_TEXT ("%s%s%s%s"), + searchpathname, + ACE_DLL_PREFIX, + searchfilename, + got_suffix ? ACE_static_cast (char *, + ASYS_TEXT ("")) + : ACE_static_cast (char *, + dll_suffix)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_OS::sprintf (pathname, ASYS_TEXT ("%s%s%s%s"), searchpathname, ACE_DLL_PREFIX, searchfilename, got_suffix ? ASYS_TEXT ("") : dll_suffix); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ if (ACE_OS::access (pathname, F_OK) == 0) return 0; } @@ -743,17 +766,41 @@ ACE::ldfind (const ASYS_TCHAR filename[], // First, try matching the filename *without* adding a // prefix. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_OS::sprintf (pathname, + ASYS_TEXT ("%s%c%s%s"), + path_entry, + ACE_DIRECTORY_SEPARATOR_CHAR, + searchfilename, + got_suffix ? ACE_static_cast (char *, + ASYS_TEXT ("")) + : ACE_static_cast (char *, + dll_suffix)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_OS::sprintf (pathname, ASYS_TEXT ("%s%c%s%s"), path_entry, ACE_DIRECTORY_SEPARATOR_CHAR, searchfilename, got_suffix ? ASYS_TEXT ("") : dll_suffix); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ if (ACE_OS::access (pathname, F_OK) == 0) break; // Second, try matching the filename *with* adding a // prefix. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_OS::sprintf (pathname, + ASYS_TEXT ("%s%c%s%s%s"), + path_entry, + ACE_DIRECTORY_SEPARATOR_CHAR, + ACE_DLL_PREFIX, + searchfilename, + got_suffix ? ACE_static_cast (char *, + ASYS_TEXT ("")) + : ACE_static_cast (char *, + dll_suffix)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_OS::sprintf (pathname, ASYS_TEXT ("%s%c%s%s%s"), path_entry, @@ -761,6 +808,7 @@ ACE::ldfind (const ASYS_TCHAR filename[], ACE_DLL_PREFIX, searchfilename, got_suffix ? ASYS_TEXT ("") : dll_suffix); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ if (ACE_OS::access (pathname, F_OK) == 0) break; @@ -2870,7 +2918,7 @@ ACE::get_ip_interfaces (size_t &count, ACE_UNUSED_ARG (count); ACE_UNUSED_ARG (addrs); ACE_NOTSUP_RETURN (-1);; // no implementation -#endif /* ACE_WIN32 */ +#endif /* ACE_WIN32 */} } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) && (defined (__unix) || defined (__Lynx__)) diff --git a/ace/Basic_Types.cpp b/ace/Basic_Types.cpp index d382e2fe03d..999ae341a54 100644 --- a/ace/Basic_Types.cpp +++ b/ace/Basic_Types.cpp @@ -22,3 +22,6 @@ ACE_U_LongLong::output (FILE *file) const #endif /* ACE_LACKS_LONGLONG_T */ +// Explicit template instantiation file +#include "ace/Template_Instantiations.cpp" + diff --git a/ace/Containers.cpp b/ace/Containers.cpp index def6739e9d1..9a0cdb29e8c 100644 --- a/ace/Containers.cpp +++ b/ace/Containers.cpp @@ -746,8 +746,10 @@ template <class T> ACE_Double_Linked_List<T>::~ACE_Double_Linked_List (void) { this->delete_nodes (); + ACE_DES_FREE (head_, this->allocator_->free, - T); + T); + this->head_ = 0; } @@ -1357,10 +1359,12 @@ ACE_Bounded_Set_Iterator<T>::next (T *&item) ACE_ALLOC_HOOK_DEFINE(ACE_Node) +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) template <class T> ACE_Node<T>::~ACE_Node (void) { } +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ template <class T> ACE_Node<T>::ACE_Node (const T &i, ACE_Node<T> *n) diff --git a/ace/Containers.h b/ace/Containers.h index 96844f6fd0f..64485b5a49b 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -185,8 +185,10 @@ public: friend class ACE_Unbounded_Stack<T>; friend class ACE_Unbounded_Stack_Iterator<T>; +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) ~ACE_Node (void); - // This isn't necessary, but it keeps the compiler happy. + // This isn't necessary, but it keeps some compilers happy. +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ private: // = Initialization methods diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp index 73e3fa09265..1cd41f4d4ce 100644 --- a/ace/Filecache.cpp +++ b/ace/Filecache.cpp @@ -205,7 +205,7 @@ ACE_Filecache::instance (void) } ACE_Filecache::ACE_Filecache (void) - : size_ (DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), + : size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), hash_ (this->size_) { } @@ -355,7 +355,7 @@ ACE_Filecache::finish (ACE_Filecache_Object *&file) if (file != 0) switch (file->action_) { - case ACE_Filecache_Object::WRITING: + case ACE_Filecache_Object::ACE_WRITING: { ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> m (hashlock); @@ -435,20 +435,20 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, // ASSERT strlen(filename) < sizeof (this->filename_) ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::READING; + this->action_ = ACE_Filecache_Object::ACE_READING; // place ourselves into the READING state // Can we access the file? if (ACE_OS::access (this->filename_, R_OK) == -1) { - this->error_i (ACE_Filecache_Object::ACCESS_FAILED); + this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); return; } // Can we stat the file? if (ACE_OS::stat (this->filename_, &this->stat_) == -1) { - this->error_i (ACE_Filecache_Object::STAT_FAILED); + this->error_i (ACE_Filecache_Object::ACE_STAT_FAILED); return; } @@ -460,7 +460,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, READ_FLAGS, R_MASK, this->sa_); if (this->handle_ == ACE_INVALID_HANDLE) { - this->error_i (ACE_Filecache_Object::OPEN_FAILED, + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, "ACE_Filecache_Object::ctor: open"); return; } @@ -471,7 +471,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, if (this->mmap_.map (this->handle_, -1, PROT_READ, ACE_MAP_PRIVATE, 0, 0, this->sa_) != 0) { - this->error_i (ACE_Filecache_Object::MEMMAP_FAILED, + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, "ACE_Filecache_Object::ctor: map"); ACE_OS::close (this->handle_); this->handle_ = ACE_INVALID_HANDLE; @@ -480,7 +480,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, } // Ok, finished! - this->action_ = ACE_Filecache_Object::READING; + this->action_ = ACE_Filecache_Object::ACE_READING; } ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, @@ -495,7 +495,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, this->size_ = size; ACE_OS::strcpy (this->filename_, filename); - this->action_ = ACE_Filecache_Object::WRITING; + this->action_ = ACE_Filecache_Object::ACE_WRITING; // Can we access the file? if (ACE_OS::access (this->filename_, R_OK|W_OK) == -1 @@ -503,7 +503,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, && ACE_OS::access (this->filename_, F_OK) != -1) { // File exists, but we cannot access it. - this->error_i (ACE_Filecache_Object::ACCESS_FAILED); + this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); return; } @@ -513,7 +513,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_); if (this->handle_ == ACE_INVALID_HANDLE) { - this->error_i (ACE_Filecache_Object::OPEN_FAILED, + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, "ACE_Filecache_Object::acquire: open"); return; } @@ -521,7 +521,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, // Can we seek? if (ACE_OS::lseek (this->handle_, this->size_ - 1, SEEK_SET) == -1) { - this->error_i (ACE_Filecache_Object::OPEN_FAILED, + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, "ACE_Filecache_Object::acquire: lseek"); ACE_OS::close (this->handle_); return; @@ -530,7 +530,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, // Can we write? if (ACE_OS::write (this->handle_, "", 1) != 1) { - this->error_i (ACE_Filecache_Object::WRITE_FAILED, + this->error_i (ACE_Filecache_Object::ACE_WRITE_FAILED, "ACE_Filecache_Object::acquire: write"); ACE_OS::close (this->handle_); return; @@ -540,7 +540,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename, if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED, 0, 0, this->sa_) != 0) { - this->error_i (ACE_Filecache_Object::MEMMAP_FAILED, + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, "ACE_Filecache_Object::acquire: map"); ACE_OS::close (this->handle_); } @@ -567,7 +567,7 @@ ACE_Filecache_Object::acquire (void) int ACE_Filecache_Object::release (void) { - if (this->action_ == WRITING) + if (this->action_ == ACE_WRITING) { // We are safe since only one thread has a writable Filecache_Object @@ -575,16 +575,16 @@ ACE_Filecache_Object::release (void) ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK, this->sa_); if (original == ACE_INVALID_HANDLE) - this->error_ = ACE_Filecache_Object::OPEN_FAILED; + this->error_ = ACE_Filecache_Object::ACE_OPEN_FAILED; else if (ACE_OS::write (original, this->mmap_.addr (), this->size_) == -1) { - this->error_ = ACE_Filecache_Object::WRITE_FAILED; + this->error_ = ACE_Filecache_Object::ACE_WRITE_FAILED; ACE_OS::close (original); ACE_OS::unlink (this->filename_); } else if (ACE_OS::stat (this->filename_, &this->stat_) == -1) - this->error_ = ACE_Filecache_Object::STAT_FAILED; + this->error_ = ACE_Filecache_Object::ACE_STAT_FAILED; #endif this->mmap_.unmap (); @@ -596,7 +596,7 @@ ACE_Filecache_Object::release (void) this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK); if (this->handle_ == ACE_INVALID_HANDLE) { - this->error_i (ACE_Filecache_Object::OPEN_FAILED, + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, "ACE_Filecache_Object::acquire: open"); } else if (this->mmap_.map (this->handle_, -1, @@ -606,13 +606,13 @@ ACE_Filecache_Object::release (void) 0, this->sa_) != 0) { - this->error_i (ACE_Filecache_Object::MEMMAP_FAILED, + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, "ACE_Filecache_Object::acquire: map"); ACE_OS::close (this->handle_); this->handle_ = ACE_INVALID_HANDLE; } - this->action_ = ACE_Filecache_Object::READING; + this->action_ = ACE_Filecache_Object::ACE_READING; #endif } @@ -680,6 +680,8 @@ ACE_Filecache_Object::update (void) const } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Managed_Object<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; #if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) template class ACE_Hash_Map_Entry<const char *, ACE_Filecache_Object *>; template class ACE_Hash_Map_Manager<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; @@ -694,6 +696,7 @@ template class ACE_Hash_Map_Iterator_Base<ACE_CString, ACE_Filecache_Object *, A template class ACE_Hash_Map_Reverse_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; #endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Managed_Object<ACE_SYNCH_RW_MUTEX>; #if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) #pragma instantiate ACE_Hash_Map_Entry<const char *, ACE_Filecache_Object *> #pragma instantiate ACE_Hash_Map_Manager<const char *, ACE_Filecache_Object *, ACE_Null_Mutex> diff --git a/ace/Filecache.h b/ace/Filecache.h index 468b5254157..8306ffc6e00 100644 --- a/ace/Filecache.h +++ b/ace/Filecache.h @@ -25,8 +25,8 @@ enum ACE_Filecache_Flag { - NOMAP = 0, - MAPIT = 1 + ACE_NOMAP = 0, + ACE_MAPIT = 1 }; class ACE_Filecache_Object; @@ -88,13 +88,13 @@ class ACE_Export ACE_Filecache_Handle public: ACE_Filecache_Handle (const char *filename, - ACE_Filecache_Flag mapit = MAPIT); + ACE_Filecache_Flag mapit = ACE_MAPIT); // Query cache for file, and acquire it. Assumes the file is being // opened for reading. ACE_Filecache_Handle (const char *filename, int size, - ACE_Filecache_Flag mapit = MAPIT); + ACE_Filecache_Flag mapit = ACE_MAPIT); // Create new entry, and acquire it. Presence of SIZE assumes the // file is being opened for writing. @@ -126,13 +126,13 @@ public: // These come from ACE_Filecache_Object, which is an internal class. enum { - SUCCESS = 0, - ACCESS_FAILED, - OPEN_FAILED, - COPY_FAILED, - STAT_FAILED, - MEMMAP_FAILED, - WRITE_FAILED + ACE_SUCCESS = 0, + ACE_ACCESS_FAILED, + ACE_OPEN_FAILED, + ACE_COPY_FAILED, + ACE_STAT_FAILED, + ACE_MEMMAP_FAILED, + ACE_WRITE_FAILED }; private: @@ -203,11 +203,11 @@ public: enum { - DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512, + ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512, // For this stupid implementation, use an array. Someday, use a // balanced search tree, or real hash table. - DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20 + ACE_DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20 // This determines the highwater mark in megabytes for the cache. // This will be ignored for now. }; @@ -226,8 +226,8 @@ private: // The reference to the instance // = Synchronization variables. - ACE_SYNCH_RW_MUTEX hash_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; - ACE_SYNCH_RW_MUTEX file_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; + ACE_SYNCH_RW_MUTEX hash_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; + ACE_SYNCH_RW_MUTEX file_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; }; class ACE_Export ACE_Filecache_Object @@ -297,19 +297,19 @@ public: enum Creation_States { - READING = 1, - WRITING = 2 + ACE_READING = 1, + ACE_WRITING = 2 }; enum Error_Conditions { - SUCCESS = 0, - ACCESS_FAILED, - OPEN_FAILED, - COPY_FAILED, - STAT_FAILED, - MEMMAP_FAILED, - WRITE_FAILED + ACE_SUCCESS = 0, + ACE_ACCESS_FAILED, + ACE_OPEN_FAILED, + ACE_COPY_FAILED, + ACE_STAT_FAILED, + ACE_MEMMAP_FAILED, + ACE_WRITE_FAILED }; private: diff --git a/ace/Hash_Map_Manager.cpp b/ace/Hash_Map_Manager.cpp index 2a07732afb2..f2a7375fda5 100644 --- a/ace/Hash_Map_Manager.cpp +++ b/ace/Hash_Map_Manager.cpp @@ -42,10 +42,12 @@ ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (const EXT_ID &ext_id, { } +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) template <class EXT_ID, class INT_ID> ACE_Hash_Map_Entry<EXT_ID, INT_ID>::~ACE_Hash_Map_Entry (void) { } +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ template <class EXT_ID, class INT_ID> void ACE_Hash_Map_Entry<EXT_ID, INT_ID>::dump (void) const diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index 9ec2e20b536..b043d2fa9c5 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -5,13 +5,13 @@ // // = LIBRARY // ace -// +// // = FILENAME // Hash_Map_Manager.h // // = AUTHOR -// Doug Schmidt -// +// Doug Schmidt +// // ============================================================================ #if !defined (ACE_HASH_MAP_MANAGER_H) @@ -38,8 +38,10 @@ public: ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev); // Constructor. +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) ~ACE_Hash_Map_Entry (void); // Destructor. +#endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ EXT_ID ext_id_; // Key used to look up an entry. @@ -70,12 +72,12 @@ template <class EXT_ID, class INT_ID, class ACE_LOCK> class ACE_Hash_Map_Reverse_Iterator; template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Manager +class ACE_Hash_Map_Manager { // = TITLE // Define a map abstraction that efficiently associates // <EXT_ID>s with <INT_ID>s. - // + // // = DESCRIPTION // This implementation of a map uses a hash table. Therefore, // this class expects that the <EXT_ID> contains a method called @@ -94,16 +96,16 @@ public: typedef EXT_ID KEY; typedef INT_ID VALUE; - typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> + typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ENTRY; - typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> + typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> ITERATOR; - typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> + typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> REVERSE_ITERATOR; // = STL-style iterator typedefs. - typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> + typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> iterator; - typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> + typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> reverse_iterator; // = Initialization and termination methods. @@ -111,11 +113,11 @@ public: ACE_Hash_Map_Manager (ACE_Allocator *alloc = 0); // Initialize a <Hash_Map_Manager> with default size. - ACE_Hash_Map_Manager (size_t size, + ACE_Hash_Map_Manager (size_t size, ACE_Allocator *alloc = 0); // Initialize a <Hash_Map_Manager> with size <length>. - int open (size_t size = ACE_DEFAULT_MAP_SIZE, + int open (size_t size = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = 0); // Initialize a <Hash_Map_Manager> with <size> elements. @@ -155,9 +157,9 @@ public: // back to the caller. The entry in this case will either be the // newly created entry, or the existing one. - int rebind (const EXT_ID &ext_id, + int rebind (const EXT_ID &ext_id, const INT_ID &int_id, - EXT_ID &old_ext_id, + EXT_ID &old_ext_id, INT_ID &old_int_id); // Associate <ext_id> with <int_id>. If <ext_id> is not in the map // then behaves just like <bind>. Otherwise, store the old values @@ -168,9 +170,9 @@ public: // bound successfully, returns 1 if an existing entry was rebound, // and returns -1 if failures occur. - int rebind (const EXT_ID &ext_id, + int rebind (const EXT_ID &ext_id, const INT_ID &int_id, - EXT_ID &old_ext_id, + EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); // Same as a normal rebind, except the map entry is also passed back @@ -234,8 +236,8 @@ protected: // separate method to facilitate template specialization. // = These methods assume locks are held by private methods. - - int bind_i (const EXT_ID &ext_id, + + int bind_i (const EXT_ID &ext_id, const INT_ID &int_id); // Performs bind. Must be called with locks held. @@ -244,7 +246,7 @@ protected: ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); // Performs bind. Must be called with locks held. - int trybind_i (const EXT_ID &ext_id, + int trybind_i (const EXT_ID &ext_id, INT_ID &int_id); // Performs trybind. Must be called with locks held. @@ -252,21 +254,21 @@ protected: INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); // Performs trybind. Must be called with locks held. - - int rebind_i (const EXT_ID &ext_id, + + int rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, - EXT_ID &old_ext_id, + EXT_ID &old_ext_id, INT_ID &old_int_id); // Performs rebind. Must be called with locks held. - int rebind_i (const EXT_ID &ext_id, + int rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, - EXT_ID &old_ext_id, + EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); // Performs rebind. Must be called with locks held. - int find_i (const EXT_ID &ext_id, + int find_i (const EXT_ID &ext_id, INT_ID &int_id); // Performs a find of <int_id> using <ext_id> as the key. Must be // called with locks held. @@ -280,7 +282,7 @@ protected: // Performs a find using <ext_id> as the key. Must be called with // locks held. - int unbind_i (const EXT_ID &ext_id, + int unbind_i (const EXT_ID &ext_id, INT_ID &int_id); // Performs unbind. Must be called with locks held. @@ -302,7 +304,7 @@ protected: ACE_Allocator *allocator_; // Pointer to a memory allocator. - ACE_LOCK lock_; + ACE_LOCK lock_; // Synchronization variable for the MT_SAFE <ACE_Hash_Map_Manager>. private: @@ -347,11 +349,11 @@ public: ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void); // Returns a reference to the interal element <this> is pointing - // to. - + // to. + ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void); // Returns reference the Hash_Map_Manager that is being iterated - // over. + // over. int operator== (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; int operator!= (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; @@ -364,20 +366,20 @@ protected: int forward_i (void); // Move forward by one element in the set. Returns 0 when there's // no more item in the set after the current items, else 1. - + int reverse_i (void); // Move backward by one element in the set. Returns 0 when there's // no more item in the set before the current item, else 1. - + void dump_i (void) const; // Dump the state of an object. - + ACE_Hash_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> *map_man_; // Map we are iterating over. - + ssize_t index_; // Keeps track of how far we've advanced in the table. - + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_; // Keeps track of how far we've advanced in a linked list in each // table slot. @@ -401,7 +403,7 @@ public: int advance (void); // Move forward by one element in the set. Returns 0 when all the // items in the set have been seen, else 1. - + void dump (void) const; // Dump the state of an object. @@ -441,7 +443,7 @@ public: int advance (void); // Move forward by one element in the set. Returns 0 when all the // items in the set have been seen, else 1. - + void dump (void) const; // Dump the state of an object. @@ -472,4 +474,3 @@ public: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #endif /* ACE_HASH_MAP_MANAGER_H */ - diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 222ecc33c07..cc5643dc6e9 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -294,10 +294,19 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); if (this->set (port_number, host_name) == -1) +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_ERROR ((LM_ERROR, + (char *) "ACE_INET_Addr::ACE_INET_Addr: %p\n", + (((char *) host_name == 0) ? + ((char *) "<unknown>") : + ((char *) (host_name))))); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - host_name == 0 ? ASYS_TEXT ("<unknown>") : - ASYS_WIDE_STRING (host_name))); + ((host_name == 0) ? + (ASYS_TEXT ("<unknown>")) : + (ASYS_WIDE_STRING (host_name))))); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ } // Creates a ACE_INET_Addr from a sockaddr_in structure. diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp index 85d1d7fcaa6..a6e359ef34b 100644 --- a/ace/Local_Tokens.cpp +++ b/ace/Local_Tokens.cpp @@ -167,9 +167,15 @@ ACE_TSS_TPQ_Entry::dump (void) const { ACE_TRACE ("ACE_TSS_TPQ_Entry::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_DEBUG ((LM_DEBUG, (char *) "ACE_TSS_TPQ_Entry::dump:\n", + (char *) " client_id_ = %s\n", + (char *) client_id_ == 0 ? (char *) "0" : (char *) client_id_)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("ACE_TSS_TPQ_Entry::dump:\n") ASYS_TEXT (" client_id_ = %s\n"), client_id_ == 0 ? ASYS_TEXT ("0") : client_id_)); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("base:\n"))); ACE_TPQ_ENTRY::dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); @@ -1412,9 +1418,15 @@ ACE_Token_Name::dump (void) const { ACE_TRACE ("ACE_Token_Name::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + ACE_DEBUG ((LM_DEBUG, (char *) "ACE_Token_Name::dump:\n", + (char *) " token_name_ = %s\n", + (char *) token_name_ == 0 ? (char *) "no name" : (char *) token_name_)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("ACE_Token_Name::dump:\n") ASYS_TEXT (" token_name_ = %s\n"), token_name_ == 0 ? ASYS_TEXT ("no name") : token_name_)); +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index 2136cccc7bf..eaa6e9bdc55 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -6,7 +6,7 @@ #include "ace/streams.h" #if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "ace/LOG_Record.i" +#include "ace/Log_Record.i" #endif ACE_RCSID(ace, Log_Record, "$Id$") @@ -142,8 +142,13 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name, ctp[19] = '\0'; // NUL-terminate after the time. ctp[24] = '\0'; // NUL-terminate after the date. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + const ASYS_TCHAR *lhost_name = (const ASYS_TCHAR *) ((host_name == 0) + ? ((char *) "<local_host>") : ((char *) host_name)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ const ASYS_TCHAR *lhost_name = host_name == 0 ? ASYS_TEXT ("<local_host>") : host_name; +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ret = ACE_OS::fprintf (fp, ASYS_TEXT ("%s.%d %s@%s@%d@%s@%s"), @@ -191,8 +196,14 @@ ACE_Log_Record::print (const ASYS_TCHAR host_name[], ctp[19] = '\0'; // NUL-terminate after the time. ctp[24] = '\0'; // NUL-terminate after the date. +#if defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) + const ASYS_TCHAR *lhost_name = + (const ASYS_TCHAR *) ((host_name == 0) + ? ((char *) "<local_host>") : ((char *) host_name)); +#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ const ASYS_TCHAR *lhost_name = host_name == 0 ? ASYS_TEXT ("<local_host>") : host_name; +#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ s << (ctp + 4) << '.' // The following line isn't portable, so I've commented it out... diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 0959622998b..7235973e928 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -17,11 +17,13 @@ ACE_RCSID(ace, Map_Manager, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_Map_Entry) +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) template <class EXT_ID, class INT_ID> ACE_Map_Entry<EXT_ID, INT_ID>::~ACE_Map_Entry (void) { // No-op just to keep some compilers happy... } +#endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ template <class EXT_ID, class INT_ID> void ACE_Map_Entry<EXT_ID, INT_ID>::dump (void) const diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index aedccc0d0c0..a6f90cb023c 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -37,9 +37,11 @@ public: int is_free_; // Keeps track whether entry is free or not. +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) ~ACE_Map_Entry (void); // We need this destructor to keep some compilers from complaining. // It's just a no-op, however. +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ void dump (void) const; // Dump the state of an object. @@ -294,11 +296,11 @@ public: ACE_Map_Entry<EXT_ID, INT_ID>& operator* (void); // Returns a reference to the interal element <this> is pointing to. - + ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void); // Returns reference the Map_Manager that is being iterated // over. - + int operator== (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; int operator!= (const ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; // Check if two iterators point to the same position diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 8154a3d2462..1b97ed4b922 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -970,12 +970,10 @@ ACE_Laxity_Message_Strategy::dump (void) const // // template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>; // template class ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >; -template class ACE_Guard<ACE_Lock>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) // These specializations aren't needed for the ACE library because // Service_Config.cpp has them: // // #pragma instantiate ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> // #pragma instantiate ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> > -#pragma instantiate ACE_Guard<ACE_Lock> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/Name_Request_Reply.cpp b/ace/Name_Request_Reply.cpp index 84de11d560a..af96698cd9d 100644 --- a/ace/Name_Request_Reply.cpp +++ b/ace/Name_Request_Reply.cpp @@ -413,14 +413,14 @@ ACE_UINT32 ACE_Name_Reply::status (void) const { ACE_TRACE ("ACE_Name_Reply::status"); - return this->transfer_.type_ == ACE_Name_Reply::SUCCESS ? 0 : -1; + return this->transfer_.type_ == ACE_Name_Reply::ACE_SUCCESS ? 0 : -1; } void ACE_Name_Reply::status (ACE_UINT32 s) { ACE_TRACE ("ACE_Name_Reply::status"); - this->transfer_.type_ = s == (ACE_UINT32) -1 ? ACE_Name_Reply::FAILURE : ACE_Name_Reply::SUCCESS; + this->transfer_.type_ = s == (ACE_UINT32) -1 ? ACE_Name_Reply::ACE_FAILURE : ACE_Name_Reply::ACE_SUCCESS; } // = Set/get the errno of a failed reply. @@ -479,10 +479,10 @@ ACE_Name_Reply::dump (void) const switch (this->msg_type ()) { - case ACE_Name_Reply::SUCCESS: + case ACE_Name_Reply::ACE_SUCCESS: ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("SUCCESS\n"))); break; - case ACE_Name_Reply::FAILURE: + case ACE_Name_Reply::ACE_FAILURE: ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("FAILURE\n"))); break; default: diff --git a/ace/Name_Request_Reply.h b/ace/Name_Request_Reply.h index 2541ae721a2..7c680d2ed61 100644 --- a/ace/Name_Request_Reply.h +++ b/ace/Name_Request_Reply.h @@ -187,8 +187,8 @@ public: enum Constants { /* Reply message types. */ - SUCCESS = 1, // Reply for successful operation. - FAILURE = 2, // Reply for failed operation. + ACE_SUCCESS = 1, // Reply for successful operation. + ACE_FAILURE = 2, // Reply for failed operation. /* Class-specific constant values. */ MAX_NAME_LENGTH = MAXPATHLEN + 1 diff --git a/ace/OS.cpp b/ace/OS.cpp index f397f83f349..88945b96cd0 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -269,7 +269,7 @@ ACE_OS::readPPCTimeBase (u_long &most, u_long &least) } #endif /* ACE_HAS_POWERPC && ghs */ -#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) // Don't inline on those platforms because this function contains // string literals, and some compilers, e.g., g++, don't handle those // efficiently in unused inline functions. @@ -430,7 +430,10 @@ ACE_OS::uname (struct utsname *name) ACE_OS::strcpy (name->machine, "???"); return ACE_OS::hostname (name->nodename, maxnamelen); -# endif /* ACE_WIN32 */ +#elif defined (ACE_PSOS) + ACE_UNUSED_ARG (name); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_WIN32 */ } #endif /* ACE_WIN32 || VXWORKS */ @@ -991,7 +994,7 @@ ACE_OS::thr_setprio (const ACE_Sched_Priority prio) int status = ACE_OS::thr_setprio (my_thread_id, prio); -#if defined (ACE_NEEDS_LWP_PRIO_SET) +# if defined (ACE_NEEDS_LWP_PRIO_SET) // If the thread is in the RT class, then set the priority on its // LWP. (Instead of doing this if the thread is in the RT class, it // should be done for all bound threads. But, there doesn't appear @@ -1015,7 +1018,7 @@ ACE_OS::thr_setprio (const ACE_Sched_Priority prio) // else this is not an RT thread. Nothing more needs to be // done. } -#endif /* ACE_NEEDS_LWP_PRIO_SET */ +# endif /* ACE_NEEDS_LWP_PRIO_SET */ return status; } @@ -1025,7 +1028,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, ACE_id_t id) { // ACE_TRACE ("ACE_OS::sched_params"); -#if defined (CHORUS) +# if defined (CHORUS) ACE_UNUSED_ARG (id); int result; struct sched_param param; @@ -1038,9 +1041,9 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, ¶m), result), int, -1); -#elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) return ACE_OS::set_scheduling_params (sched_params, id); -#elif defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_SETSCHED) +# elif defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_SETSCHED) ACE_UNUSED_ARG (id); if (sched_params.quantum () != ACE_Time_Value::zero) { @@ -1062,25 +1065,25 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, int result = ::sched_setscheduler(0, // this process sched_params.policy (), ¶m) == -1 ? -1 : 0; -# if defined DIGITAL_UNIX +# if defined DIGITAL_UNIX return result == 0 ? // Use priocntl (2) to set the process in the RT class, // if using an RT policy. ACE_OS::set_scheduling_params (sched_params) : result; -# else /* ! DIGITAL_UNIX */ +# else /* ! DIGITAL_UNIX */ return result; -# endif /* ! DIGITAL_UNIX */ +# endif /* ! DIGITAL_UNIX */ } else if (sched_params.scope () == ACE_SCOPE_THREAD) { ACE_thread_t thr_id = ACE_OS::thr_self (); -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) return (::pthread_setscheduler(thr_id, sched_params.policy (), sched_params.priority()) == -1 ? -1 : 0); -# else +# else int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam ( thr_id, @@ -1088,7 +1091,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, ¶m), result), int, -1); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ } else // sched_params.scope () == ACE_SCOPE_LWP, which isn't POSIX @@ -1097,7 +1100,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, return -1; } -#elif defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) +# elif defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (id); if (sched_params.scope () != ACE_SCOPE_PROCESS || @@ -1123,7 +1126,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, // Set the thread priority on the current thread. return ACE_OS::thr_setprio (sched_params.priority ()); -#elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (id); // There is only one class of priorities on VxWorks, and no @@ -1170,32 +1173,9 @@ int ACE_OS::socket_initialized_; # include "ace/Array.h" -class ACE_TSS_Ref - // = TITLE - // "Reference count" for thread-specific storage keys. - // - // = DESCRIPTION - // Since the <ACE_Unbounded_Stack> doesn't allow duplicates, the - // "reference count" is the identify of the thread_id. -{ -public: - ACE_TSS_Ref (ACE_thread_t id); - // Constructor - - ACE_TSS_Ref (void); - // Default constructor - - int operator== (const ACE_TSS_Ref &); - // Check for equality. - - int operator!= (const ACE_TSS_Ref &); - // Check for inequality. - -// private: - - ACE_thread_t tid_; - // ID of thread using a specific key. -}; +// moved class ACE_TSS_Ref declaration +// to OS.h so it can be visible to the +// single file of template instantiations ACE_TSS_Ref::ACE_TSS_Ref (ACE_thread_t id) : tid_(id) @@ -1227,54 +1207,9 @@ ACE_TSS_Ref::operator!= (const ACE_TSS_Ref &tss_ref) return !(*this == tss_ref); } -class ACE_TSS_Info - // = TITLE - // Thread Specific Key management. - // - // = DESCRIPTION - // This class maps a key to a "destructor." -{ -public: - ACE_TSS_Info (ACE_thread_key_t key, - void (*dest)(void *) = 0, - void *tss_inst = 0); - // Constructor - - ACE_TSS_Info (void); - // Default constructor - - int key_in_use (void) const { return thread_count_ > 0; } - // Returns 1 if the key is in use, 0 if not. - - void key_in_use (int flag) { thread_count_ = flag == 0 ? -1 : 1; } - // Mark the key as being in use if the flag is non-zero, or - // not in use if the flag is 0. - - int operator== (const ACE_TSS_Info &); - // Check for equality. - - int operator!= (const ACE_TSS_Info &); - // Check for inequality. - - void dump (void); - // Dump the state. - -private: - ACE_thread_key_t key_; - // Key to the thread-specific storage item. - - void (*destructor_)(void *); - // "Destructor" that gets called when the item is finally released. - - void *tss_obj_; - // Pointer to ACE_TSS<xxx> instance that has/will allocate the key. - - int thread_count_; - // Count of threads that are using this key. Contains -1 when the - // key is not in use. - - friend class ACE_TSS_Cleanup; -}; +// moved class ACE_TSS_Info declaration +// to OS.h so it can be visible to the +// single file of template instantiations ACE_TSS_Info::ACE_TSS_Info (ACE_thread_key_t key, void (*dest)(void *), @@ -1316,7 +1251,6 @@ ACE_TSS_Info::operator== (const ACE_TSS_Info &info) } // Check for inequality. -inline int ACE_TSS_Info::operator!= (const ACE_TSS_Info &info) { @@ -1337,49 +1271,9 @@ ACE_TSS_Info::dump (void) ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -class ACE_TSS_Keys - // = TITLE - // Collection of in-use flags for a thread's TSS keys. - // For internal use only by ACE_TSS_Cleanup; it is public because - // some compilers can't use nested classes for template instantiation - // parameters. - // - // = DESCRIPTION - // Wrapper around array of whether each key is in use. A simple - // typedef doesn't work with Sun C++ 4.2. -{ - public: - ACE_TSS_Keys (void); - // Default constructor, to initialize all bits to zero (unused). - - int test_and_set (const ACE_thread_key_t key); - // Mark the specified key as being in use, if it was not already so marked. - // Returns 1 if the had already been marked, 0 if not. - - int test_and_clear (const ACE_thread_key_t key); - // Mark the specified key as not being in use, if it was not already so - // cleared. Returns 1 if the had already been cleared, 0 if not. - -private: - static void find (const u_int key, u_int &word, u_int &bit); - // For a given key, find the word and bit number that represent it. - - enum - { -# if ACE_SIZEOF_LONG == 8 - ACE_BITS_PER_WORD = 64, -# elif ACE_SIZEOF_LONG == 4 - ACE_BITS_PER_WORD = 32, -# else -# error ACE_TSS_Keys only supports 32 or 64 bit longs. -# endif /* ACE_SIZEOF_LONG == 8 */ - ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1 - }; - - u_long key_bit_words_[ACE_WORDS]; - // Bit flag collection. A bit value of 1 indicates that the key is in - // use by this thread. -}; +// moved class ACE_TSS_Keys declaration +// to OS.h so it can be visible to the +// single file of template instantiations ACE_TSS_Keys::ACE_TSS_Keys (void) { @@ -1871,21 +1765,37 @@ ACE_TSS_Emulation::tss_base (void* ts_storage[]) void * ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX]) { -# if ! defined (VXWORKS) +# if defined (ACE_PSOS) + u_long tss_base; + + // Use the supplied array for this thread's TSS. + tss_base = (u_long) ts_storage; + t_setreg (0, PSOS_TASK_REG_TSS, tss_base); + + // Zero the entire TSS array. + void **tss_base_p = ts_storage; + for (u_int i = 0; i < ACE_TSS_THREAD_KEYS_MAX; ++i, ++tss_base_p) + { + *tss_base_p = 0; + } + + return (void *) tss_base; +# else /* ! ACE_PSOS */ +# if ! defined (VXWORKS) // On VxWorks, don't check to see if the field is 0. It isn't always, // specifically, when a program is run directly by the shell (without // spawning a new task) after another program has been run. -#if defined(ACE_USE_NATIVE_KEYS) +# if defined(ACE_USE_NATIVE_KEYS) if (tss_base (ts_storage) == 0) -#else +# else if (tss_base () == 0) -#endif +# endif { -# endif /* VXWORKS */ -#if !defined(ACE_USE_NATIVE_KEYS) +# endif /* ! VXWORKS */ +# if !defined(ACE_USE_NATIVE_KEYS) tss_base() = ts_storage; -#endif +# endif // Zero the entire TSS array. Do it manually instead of using // memset, for optimum speed. void **tss_base_p = tss_base (); @@ -1895,13 +1805,14 @@ ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX]) } return tss_base (); -# if ! defined (VXWORKS) +# if ! defined (VXWORKS) } else { return 0; } -# endif /* VXWORKS */ +# endif /* ! VXWORKS */ +# endif /* ! ACE_PSOS */ } # if !defined (VXWORKS) && !defined(ACE_USE_NATIVE_KEYS) @@ -2060,8 +1971,14 @@ ACE_Thread_Adapter::invoke (void) { ACE_SEH_TRY { +#if defined (ACE_PSOS) + // pSOS thread functions do not return a value + status = 0; + (*func) (arg); // Call thread entry point. +#else /* ! ACE_PSOS */ // Call thread entry point. status = (void*) (*func) (arg); +#endif /* ! ACE_PSOS */ } ACE_SEH_FINALLY @@ -2243,15 +2160,30 @@ ACE_OS::thr_create (ACE_THR_FUNC func, { // ACE_TRACE ("ACE_OS::thr_create"); +# if defined (ACE_NO_THREAD_ADAPTER) +# define ACE_THREAD_FUNCTION func +# define ACE_THREAD_ARGUMENT args +# else /* ! defined (ACE_NO_THREAD_ADAPTER) */ +# if defined (ACE_PSOS) +# define ACE_THREAD_FUNCTION (PSOS_TASK_ENTRY_POINT) thread_args->entry_point () +# else +# define ACE_THREAD_FUNCTION thread_args->entry_point () +# endif /* defined (ACE_PSOS) */ +# define ACE_THREAD_ARGUMENT thread_args +# endif /* ! defined (ACE_NO_THREAD_ADAPTER) */ + ACE_Thread_Adapter *thread_args; if (thread_adapter == 0) - ACE_NEW_RETURN (thread_args, ACE_Thread_Adapter (func, args, (ACE_THR_C_FUNC) ace_thread_adapter), -1); + ACE_NEW_RETURN (thread_args, + ACE_Thread_Adapter (func, args, + (ACE_THR_C_FUNC) ace_thread_adapter), + -1); else thread_args = thread_adapter; -#if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_THREADS) -# if !defined (VXWORKS) +# if !defined (VXWORKS) // On VxWorks, the OS will provide a task name if the user doesn't. // So, we don't need to create a tmp_thr. If the caller of this // member function is the Thread_Manager, than thr_id will be non-zero @@ -2260,30 +2192,30 @@ ACE_OS::thr_create (ACE_THR_FUNC func, if (thr_id == 0) thr_id = &tmp_thr; -# endif /* ! VXWORKS */ +# endif /* ! VXWORKS */ ACE_hthread_t tmp_handle; if (thr_handle == 0) thr_handle = &tmp_handle; -# if defined (ACE_HAS_PTHREADS) +# if defined (ACE_HAS_PTHREADS) int result; pthread_attr_t attr; -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) if (::pthread_attr_create (&attr) != 0) -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ if (::pthread_attr_init (&attr) != 0) -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; // *** Set Stack Size -# if defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) +# if defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) if (stacksize < ACE_NEEDS_HUGE_THREAD_STACKSIZE) stacksize = ACE_NEEDS_HUGE_THREAD_STACKSIZE; -# endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ +# endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ -# if defined (CHORUS) +# if defined (CHORUS) // If it is a super actor, we can't set stacksize. But for the time // being we are all non-super actors. Should be fixed to take care // of super actors!!! @@ -2291,59 +2223,59 @@ ACE_OS::thr_create (ACE_THR_FUNC func, stacksize = ACE_CHORUS_DEFAULT_MIN_STACK_SIZE; else if (stacksize < ACE_CHORUS_DEFAULT_MIN_STACK_SIZE) stacksize = ACE_CHORUS_DEFAULT_MIN_STACK_SIZE; -# endif /*CHORUS */ +# endif /*CHORUS */ if (stacksize != 0) { size_t size = stacksize; -# if defined (PTHREAD_STACK_MIN) +# if defined (PTHREAD_STACK_MIN) if (size < PTHREAD_STACK_MIN) size = PTHREAD_STACK_MIN; -# endif /* PTHREAD_STACK_MIN */ +# endif /* PTHREAD_STACK_MIN */ -# if !defined (ACE_LACKS_THREAD_STACK_SIZE) // JCEJ 12/17/96 -# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) +# if !defined (ACE_LACKS_THREAD_STACK_SIZE) // JCEJ 12/17/96 +# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) if (::pthread_attr_setstacksize (&attr, size) != 0) -# else +# else if (ACE_ADAPT_RETVAL(pthread_attr_setstacksize (&attr, size), result) == -1) -# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } -# else +# else ACE_UNUSED_ARG (size); -# endif /* !ACE_LACKS_THREAD_STACK_SIZE */ +# endif /* !ACE_LACKS_THREAD_STACK_SIZE */ } // *** Set Stack Address -# if !defined (ACE_LACKS_THREAD_STACK_ADDR) +# if !defined (ACE_LACKS_THREAD_STACK_ADDR) if (stack != 0) { if (::pthread_attr_setstackaddr (&attr, stack) != 0) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } -# else +# else ACE_UNUSED_ARG (stack); -# endif /* !ACE_LACKS_THREAD_STACK_ADDR */ +# endif /* !ACE_LACKS_THREAD_STACK_ADDR */ // *** Deal with various attributes if (flags != 0) { // *** Set Detach state -# if !defined (ACE_LACKS_SETDETACH) +# if !defined (ACE_LACKS_SETDETACH) if (ACE_BIT_ENABLED (flags, THR_DETACHED) || ACE_BIT_ENABLED (flags, THR_JOINABLE)) { @@ -2352,22 +2284,22 @@ ACE_OS::thr_create (ACE_THR_FUNC func, if (ACE_BIT_ENABLED (flags, THR_DETACHED)) dstate = PTHREAD_CREATE_DETACHED; -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) if (::pthread_attr_setdetach_np (&attr, dstate) != 0) -# else /* ACE_HAS_PTHREADS_DRAFT4 */ -# if defined (ACE_HAS_PTHREADS_DRAFT6) +# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# if defined (ACE_HAS_PTHREADS_DRAFT6) if (::pthread_attr_setdetachstate (&attr, &dstate) != 0) -# else +# else if (ACE_ADAPT_RETVAL(::pthread_attr_setdetachstate (&attr, dstate), result) != 0) -# endif /* ACE_HAS_PTHREADS_DRAFT6 */ -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT6 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } @@ -2376,10 +2308,10 @@ ACE_OS::thr_create (ACE_THR_FUNC func, // call ::pthread_detach () below. If THR_DETACHED is not // enabled, we call ::pthread_detach () in the Thread_Manager, // after joining with the thread. -# endif /* ACE_LACKS_SETDETACH */ +# endif /* ACE_LACKS_SETDETACH */ // *** Set Policy -# if !defined (ACE_LACKS_SETSCHED) +# if !defined (ACE_LACKS_SETSCHED) // If we wish to set the priority explicitly, we have to enable // explicit scheduling, and a policy, too. if (priority != ACE_DEFAULT_THREAD_PRIORITY) @@ -2397,10 +2329,10 @@ ACE_OS::thr_create (ACE_THR_FUNC func, { int spolicy; -# if defined (ACE_HAS_ONLY_SCHED_OTHER) +# if defined (ACE_HAS_ONLY_SCHED_OTHER) // Solaris, thru version 2.6, only supports SCHED_OTHER. spolicy = SCHED_OTHER; -# else +# else // Make sure to enable explicit scheduling, in case we didn't // enable it above (for non-default priority). ACE_SET_BITS (flags, THR_EXPLICIT_SCHED); @@ -2409,20 +2341,20 @@ ACE_OS::thr_create (ACE_THR_FUNC func, spolicy = SCHED_OTHER; else if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)) spolicy = SCHED_FIFO; -# if defined (SCHED_IO) +# if defined (SCHED_IO) else if (ACE_BIT_ENABLED (flags, THR_SCHED_IO)) spolicy = SCHED_IO; -# else +# else else if (ACE_BIT_ENABLED (flags, THR_SCHED_IO)) { errno = ENOSYS; return -1; } -# endif /* SCHED_IO */ +# endif /* SCHED_IO */ else spolicy = SCHED_RR; -# if defined (ACE_HAS_FSU_PTHREADS) +# if defined (ACE_HAS_FSU_PTHREADS) int ret; switch (spolicy) { @@ -2439,31 +2371,31 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ::pthread_attr_destroy (&attr); return -1; } -# endif /* ACE_HAS_FSU_PTHREADS */ +# endif /* ACE_HAS_FSU_PTHREADS */ -# endif /* ACE_HAS_ONLY_SCHED_OTHER */ +# endif /* ACE_HAS_ONLY_SCHED_OTHER */ -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) result = ::pthread_attr_setsched (&attr, spolicy); -# elif defined (ACE_HAS_PTHREADS_DRAFT6) +# elif defined (ACE_HAS_PTHREADS_DRAFT6) result = ::pthread_attr_setschedpolicy (&attr, spolicy); -# else /* draft 7 or std */ +# else /* draft 7 or std */ ACE_ADAPT_RETVAL(::pthread_attr_setschedpolicy (&attr, spolicy), result); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ if (result != 0) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } // *** Set Priority (use reasonable default priorities) -# if defined(ACE_HAS_PTHREADS_STD) +# if defined(ACE_HAS_PTHREADS_STD) // If we wish to explicitly set a scheduling policy, we also // have to specify a priority. We choose a "middle" priority as // default. Maybe this is also necessary on other POSIX'ish @@ -2480,18 +2412,18 @@ ACE_OS::thr_create (ACE_THR_FUNC func, else // THR_SCHED_DEFAULT priority = ACE_THR_PRI_OTHER_DEF; } -# endif /* ACE_HAS_PTHREADS_STD */ +# endif /* ACE_HAS_PTHREADS_STD */ if (priority != ACE_DEFAULT_THREAD_PRIORITY) { struct sched_param sparam; ACE_OS::memset ((void *) &sparam, 0, sizeof sparam); -# if defined(ACE_HAS_IRIX62_THREADS) +# if defined (ACE_HAS_IRIX62_THREADS) sparam.sched_priority = ACE_MIN (priority, PTHREAD_MAX_PRIORITY); -# elif defined (PTHREAD_MAX_PRIORITY) && !defined(ACE_HAS_PTHREADS_STD) +# elif defined (PTHREAD_MAX_PRIORITY) && !defined(ACE_HAS_PTHREADS_STD) /* For MIT pthreads... */ sparam.prio = ACE_MIN (priority, PTHREAD_MAX_PRIORITY); -# elif defined(ACE_HAS_PTHREADS_STD) && !defined (ACE_HAS_STHREADS) +# elif defined(ACE_HAS_PTHREADS_STD) && !defined (ACE_HAS_STHREADS) // The following code forces priority into range. if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)) sparam.sched_priority = @@ -2502,13 +2434,13 @@ ACE_OS::thr_create (ACE_THR_FUNC func, else // Default policy, whether set or not sparam.sched_priority = ACE_MIN (ACE_THR_PRI_OTHER_MAX, ACE_MAX (ACE_THR_PRI_OTHER_MIN, priority)); -# elif defined (PRIORITY_MAX) +# elif defined (PRIORITY_MAX) sparam.sched_priority = ACE_MIN (priority, PRIORITY_MAX); -# else +# else sparam.sched_priority = priority; -# endif +# endif /* ACE_HAS_IRIX62_THREADS */ -# if defined (ACE_HAS_FSU_PTHREADS) +# if defined (ACE_HAS_FSU_PTHREADS) if (sparam.sched_priority >= PTHREAD_MIN_PRIORITY && sparam.sched_priority <= PTHREAD_MAX_PRIORITY) attr.prio = sparam.sched_priority; @@ -2518,64 +2450,63 @@ ACE_OS::thr_create (ACE_THR_FUNC func, errno = EINVAL; return -1; } -# else +# else { -# if defined (ACE_HAS_STHREADS) +# if defined (ACE_HAS_STHREADS) // Solaris POSIX only allows priorities > 0 to // ::pthread_attr_setschedparam. If a priority of 0 was // requested, set the thread priority after creating it, below. if (priority > 0) -# endif /* STHREADS */ +# endif /* STHREADS */ { -# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) +# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) result = ::pthread_attr_setprio (&attr, sparam.sched_priority); -# else /* this is draft 7 or std */ +# else /* this is draft 7 or std */ ACE_ADAPT_RETVAL(::pthread_attr_setschedparam (&attr, &sparam), result); -# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ if (result != 0) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } } -# endif /* ACE_HAS_FSU_PTHREADS */ +# endif /* ACE_HAS_FSU_PTHREADS */ } // *** Set scheduling explicit or inherited if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED) || ACE_BIT_ENABLED (flags, THR_EXPLICIT_SCHED)) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) int sched = PTHREAD_DEFAULT_SCHED; -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ int sched = PTHREAD_EXPLICIT_SCHED; -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED)) sched = PTHREAD_INHERIT_SCHED; if (::pthread_attr_setinheritsched (&attr, sched) != 0) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } -# else /* ACE_LACKS_SETSCHED */ +# else /* ACE_LACKS_SETSCHED */ ACE_UNUSED_ARG (priority); -# endif /* ACE_LACKS_SETSCHED */ - +# endif /* ACE_LACKS_SETSCHED */ // *** Set Scope -# if !defined (ACE_LACKS_THREAD_PROCESS_SCOPING) +# if !defined (ACE_LACKS_THREAD_PROCESS_SCOPING) if (ACE_BIT_ENABLED (flags, THR_SCOPE_SYSTEM) || ACE_BIT_ENABLED (flags, THR_SCOPE_PROCESS)) { @@ -2585,15 +2516,15 @@ ACE_OS::thr_create (ACE_THR_FUNC func, if (::pthread_attr_setscope (&attr, scope) != 0) { -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ::pthread_attr_delete (&attr); -# else /* ACE_HAS_PTHREADS_DRAFT4 */ +# else /* ACE_HAS_PTHREADS_DRAFT4 */ ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ return -1; } } -# endif /* !ACE_LACKS_THREAD_PROCESS_SCOPING */ +# endif /* !ACE_LACKS_THREAD_PROCESS_SCOPING */ if (ACE_BIT_ENABLED (flags, THR_NEW_LWP)) { @@ -2632,16 +2563,16 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } } -# if defined (ACE_HAS_PTHREADS_DRAFT4) +# if defined (ACE_HAS_PTHREADS_DRAFT4) ACE_OSCALL (::pthread_create (thr_id, attr, thread_args->entry_point (), thread_args), int, -1, result); -# if defined (ACE_LACKS_SETDETACH) +# if defined (ACE_LACKS_SETDETACH) if (ACE_BIT_ENABLED (flags, THR_DETACHED)) { -# if defined (HPUX_10) +# if defined (HPUX_10) // HP-UX DCE threads' pthread_detach will smash thr_id if it's just given // as an argument. This will cause ACE_Thread_Manager (if it's doing this // create) to lose track of the new thread since the ID will be passed back @@ -2649,22 +2580,22 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ACE_thread_t junker; cma_handle_assign(thr_id, &junker); ::pthread_detach (&junker); -# else +# else ::pthread_detach (thr_id); -# endif /* HPUX_10 */ -# endif /* ACE_LACKS_SETDETACH */ +# endif /* HPUX_10 */ +# endif /* ACE_LACKS_SETDETACH */ } ::pthread_attr_delete (&attr); -# elif defined (ACE_HAS_PTHREADS_DRAFT6) +# elif defined (ACE_HAS_PTHREADS_DRAFT6) ACE_OSCALL (::pthread_create (thr_id, &attr, thread_args->entry_point (), thread_args), int, -1, result); ::pthread_attr_destroy (&attr); -# else /* this is draft 7 or std */ +# else /* this is draft 7 or std */ ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_create (thr_id, &attr, thread_args->entry_point (), @@ -2672,7 +2603,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, result), int, -1, result); ::pthread_attr_destroy (&attr); -# endif /* ACE_HAS_PTHREADS_DRAFT4 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ // This is a Solaris or POSIX implementation of pthreads, // where we assume that ACE_thread_t and ACE_hthread_t are the same. @@ -2680,7 +2611,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, if (result != -1) *thr_handle = *thr_id; -# if defined (ACE_HAS_STHREADS) +# if defined (ACE_HAS_STHREADS) // If the priority is 0, then we might have to set it now because we // couldn't set it with ::pthread_attr_setschedparam, as noted // above. This doesn't provide strictly correct behavior, because @@ -2722,8 +2653,8 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } } -# if defined (ACE_NEEDS_LWP_PRIO_SET) -# if 0 +# if defined (ACE_NEEDS_LWP_PRIO_SET) +# if 0 // It would be useful if we could make this work. But, it requires // a mechanism for determining the ID of an LWP to which another // thread is bound. Is there a way to do that? Instead, just rely @@ -2741,12 +2672,12 @@ ACE_OS::thr_create (ACE_THR_FUNC func, /* ? How do we find the ID of the LWP to which *thr_id is bound? */); } -# endif /* 0 */ -# endif /* ACE_NEEDS_LWP_PRIO_SET */ +# endif /* 0 */ +# endif /* ACE_NEEDS_LWP_PRIO_SET */ -# endif /* ACE_HAS_STHREADS */ +# endif /* ACE_HAS_STHREADS */ return result; -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) int result; int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED); @@ -2788,9 +2719,9 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } } return result; -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) ACE_UNUSED_ARG (stack); -# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) if (ACE_BIT_ENABLED (flags, THR_USE_AFX)) { CWinThread *cwin_thread = @@ -2799,7 +2730,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, flags | THR_SUSPENDED); // Have to duplicate the handle because // CWinThread::~CWinThread() closes the original handle. -# if !defined (ACE_HAS_WINCE) +# if !defined (ACE_HAS_WINCE) (void) ::DuplicateHandle (::GetCurrentProcess (), cwin_thread->m_hThread, ::GetCurrentProcess (), @@ -2807,7 +2738,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, 0, TRUE, DUPLICATE_SAME_ACCESS); -# endif /* ! ACE_HAS_WINCE */ +# endif /* ! ACE_HAS_WINCE */ *thr_id = cwin_thread->m_nThreadID; if (ACE_BIT_ENABLED (flags, THR_SUSPENDED) == 0) @@ -2817,7 +2748,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, // thread, ACE_TSS_Cleanup->exit() never gets called ! } else -# endif /* ACE_HAS_MFC */ +# endif /* ACE_HAS_MFC */ { int start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED); @@ -2845,7 +2776,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ACE_OS::thr_continue (*thr_handle); } } -# if 0 +# if 0 *thr_handle = ::CreateThread (0, stacksize, @@ -2853,7 +2784,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, thread_args, flags, thr_id); -# endif /* 0 */ +# endif /* 0 */ // Close down the handle if no one wants to use it. if (thr_handle == &tmp_handle) @@ -2864,7 +2795,67 @@ ACE_OS::thr_create (ACE_THR_FUNC func, else ACE_FAIL_RETURN (-1); /* NOTREACHED */ -# elif defined (VXWORKS) + +# elif defined (ACE_PSOS) + + // stack is created in the task's memory region 0 + ACE_UNUSED_ARG (stack); + + // task creation and start flags are fixed + ACE_UNUSED_ARG (flags); + + // lowest priority is reserved for the IDLE pSOS+ system daemon, + // highest are reserved for high priority pSOS+ system daemons + if (priority < PSOS_TASK_MIN_PRIORITY) + { + priority = PSOS_TASK_MIN_PRIORITY; + } + else if (priority > PSOS_TASK_MAX_PRIORITY) + { + priority = PSOS_TASK_MAX_PRIORITY; + } + + ACE_hthread_t tid; + *thr_handle = 0; + + // create the thread + if (t_create ((char *) thr_id, // task name + priority, // (possibly adjusted) task priority + stacksize, // passed stack size is used for supervisor stack + 0, // no user stack: tasks run strictly in supervisor mode + T_LOCAL, // local to the pSOS+ node (does not support pSOS+m) + &tid) // receives task id + != 0) + { + return -1; + } + + // pSOS tasks are passed an array of 4 u_longs + u_long targs[4]; + targs[0] = (u_long) ACE_THREAD_ARGUMENT; + targs[1] = 0; + targs[2] = 0; + targs[3] = 0; + + // start the thread + if (t_start (tid, + T_PREEMPT | // Task can be preempted + T_NOTSLICE | // Task is not timesliced with other tasks at same priority + T_NOASR | // Task level signals disabled + T_SUPV | // Task runs strictly in supervisor mode + T_ISR, // Hardware interrupts are enabled + ACE_THREAD_FUNCTION, // Task entry point + targs) // Task argument(s) + != 0) + { + return -1; + } + + // store the task id in the handle and return success + *thr_handle = tid; + return 0; + +# elif defined (VXWORKS) // The hard-coded values below are what ::sp () would use. (::sp () // hardcodes priority to 100, flags to VX_FP_TASK, and stacksize to // 20,000.) stacksize should be an even integer. If a stack is not @@ -2883,12 +2874,12 @@ ACE_OS::thr_create (ACE_THR_FUNC func, thr_id && *thr_id && (*thr_id)[0] != ACE_THR_ID_ALLOCATED; ACE_hthread_t tid; -# if 0 /* Don't support setting of stack, because it doesn't seem to work. */ +# if 0 /* Don't support setting of stack, because it doesn't seem to work. */ if (stack == 0) { -# else +# else ACE_UNUSED_ARG (stack); -# endif /* 0 */ +# endif /* 0 */ // The call below to ::taskSpawn () causes VxWorks to assign a // unique task name of the form: "t" + an integer, because the // first argument is 0. @@ -2899,7 +2890,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, thread_args->entry_point (), (int) thread_args, 0, 0, 0, 0, 0, 0, 0, 0, 0); -# if 0 /* Don't support setting of stack, because it doesn't seem to work. */ +# if 0 /* Don't support setting of stack, because it doesn't seem to work. */ } else { @@ -2929,7 +2920,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, tid = status == OK ? (ACE_hthread_t) tcb : ERROR; } -# endif /* 0 */ +# endif /* 0 */ if (tid == ERROR) return -1; @@ -2961,8 +2952,8 @@ ACE_OS::thr_create (ACE_THR_FUNC func, return 0; } -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (func); ACE_UNUSED_ARG (args); ACE_UNUSED_ARG (flags); @@ -2972,29 +2963,29 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ACE_UNUSED_ARG (stack); ACE_UNUSED_ARG (stacksize); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } void ACE_OS::thr_exit (void *status) { // ACE_TRACE ("ACE_OS::thr_exit"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_PTHREADS) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_PTHREADS) ::pthread_exit (status); -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ::thr_exit (status); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) // Can't call it here because on NT, the thread is exited // directly by ACE_Thread_Adapter::invoke (). // ACE_TSS_Cleanup::instance ()->exit (status); -# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) int using_afx = -1; ACE_Thread_Descriptor *td = ACE_Log_Msg::instance ()->thr_desc (); if (td) using_afx = ACE_BIT_ENABLED (td->flags (), THR_USE_AFX); -# endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ +# endif /* ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ // Call TSS destructors. ACE_OS::cleanup_tss (0 /* not main thread */); @@ -3003,7 +2994,7 @@ ACE_OS::thr_exit (void *status) // Allow CWinThread-destructor to be invoked from AfxEndThread. // _endthreadex will be called from AfxEndThread so don't exit the // thread now if we are running an MFC thread. -# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) if (using_afx != -1) { if (using_afx) @@ -3022,25 +3013,28 @@ ACE_OS::thr_exit (void *status) else ::AfxEndThread ((DWORD)status); } -# else - ::_endthreadex ((DWORD) status); -# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ +# else + ::_endthreadex ((DWORD) status); +# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ -# elif defined (VXWORKS) +# elif defined (VXWORKS) ACE_hthread_t tid; ACE_OS::thr_self (tid); - *((int *) status) = ::taskDelete (tid); -# endif /* ACE_HAS_STHREADS */ -#else +# elif defined (ACE_PSOS) + ACE_hthread_t tid; + ACE_OS::thr_self (tid); + *((u_long *) status) = ::t_delete (tid); +# endif /* ACE_HAS_PTHREADS */ +# else ACE_UNUSED_ARG (status); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } int ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params) { -#if defined (ACE_HAS_STHREADS) +# if defined (ACE_HAS_STHREADS) // Get the class TS and RT class IDs. ACE_id_t rt_id; ACE_id_t ts_id; @@ -3097,33 +3091,33 @@ ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params) } return 0; -#else /* ! ACE_HAS_STHREADS */ +# else /* ! ACE_HAS_STHREADS */ ACE_UNUSED_ARG (sched_params); ACE_NOTSUP_RETURN (-1); -#endif /* ! ACE_HAS_STHREADS */ +# endif /* ! ACE_HAS_STHREADS */ } int ACE_OS::lwp_setparams (const ACE_Sched_Params &sched_params) { -#if defined (ACE_HAS_STHREADS) +# if defined (ACE_HAS_STHREADS) ACE_Sched_Params lwp_params (sched_params); lwp_params.scope (ACE_SCOPE_LWP); return ACE_OS::sched_params (lwp_params); -#else /* ! ACE_HAS_STHREADS */ +# else /* ! ACE_HAS_STHREADS */ ACE_UNUSED_ARG (sched_params); ACE_NOTSUP_RETURN (-1); -#endif /* ! ACE_HAS_STHREADS */ +# endif /* ! ACE_HAS_STHREADS */ } -#if defined(ACE_HAS_TSS_EMULATION) && defined(ACE_USE_NATIVE_KEYS) +# if defined(ACE_HAS_TSS_EMULATION) && defined(ACE_USE_NATIVE_KEYS) int ACE_OS::thr_setspecific (ACE_OS_thread_key_t key, void *data) { // ACE_TRACE ("ACE_OS::thr_setspecific"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_PTHREADS) -# if defined (ACE_HAS_FSU_PTHREADS) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_PTHREADS) +# if defined (ACE_HAS_FSU_PTHREADS) // Call pthread_init() here to initialize threads package. FSU // threads need an initialization before the first thread constructor. // This seems to be the one; however, a segmentation fault may @@ -3132,29 +3126,29 @@ ACE_OS::thr_setspecific (ACE_OS_thread_key_t key, void *data) // more than once, so another call to pthread_init will not adversely // affect existing threads. pthread_init (); -# endif /* ACE_HAS_FSU_PTHREADS */ +# endif /* ACE_HAS_FSU_PTHREADS */ ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setspecific (key, data), ace_result_), int, -1); -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_setspecific (key, data), ace_result_), int, -1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) ::TlsSetValue (key, data); ACE_TSS_Cleanup::instance ()->key_used (key); return 0; -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } -#endif /* ACE_HAS_TSS_EMULATION && ACE_USE_NATIVE_KEYS */ +# endif /* ACE_HAS_TSS_EMULATION && ACE_USE_NATIVE_KEYS */ int ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data) { // ACE_TRACE ("ACE_OS::thr_setspecific"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_TSS_EMULATION) ACE_KEY_INDEX (key_index, key); if (key_index >= ACE_TSS_Emulation::total_keys ()) { @@ -3169,8 +3163,8 @@ ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data) return 0; } -# elif defined (ACE_HAS_PTHREADS) -# if defined (ACE_HAS_FSU_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) +# if defined (ACE_HAS_FSU_PTHREADS) // Call pthread_init() here to initialize threads package. FSU // threads need an initialization before the first thread constructor. // This seems to be the one; however, a segmentation fault may @@ -3179,93 +3173,93 @@ ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data) // more than once, so another call to pthread_init will not adversely // affect existing threads. pthread_init (); -# endif /* ACE_HAS_FSU_PTHREADS */ +# endif /* ACE_HAS_FSU_PTHREADS */ -# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) +# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) ACE_OSCALL_RETURN (::pthread_setspecific (key, data), int, -1); -# else +# else ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setspecific (key, data), ace_result_), int, -1); -# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ +# endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_setspecific (key, data), ace_result_), int, -1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) ::TlsSetValue (key, data); ACE_TSS_Cleanup::instance ()->key_used (key); return 0; -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } int ACE_OS::thr_keyfree (ACE_thread_key_t key) { // ACE_TRACE ("ACE_OS::thr_keyfree"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_TSS_EMULATION) return ACE_TSS_Cleanup::instance ()->remove (key); -# elif defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) +# elif defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) return ::pthread_key_delete (key); -# elif defined (ACE_HAS_THR_KEYDELETE) +# elif defined (ACE_HAS_THR_KEYDELETE) return ::thr_keydelete (key); -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) // Extract out the thread-specific table instance and free up // the key and destructor. ACE_TSS_Cleanup::instance ()->remove (key); ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::TlsFree (key), ace_result_), int, -1); -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } -#if defined(ACE_HAS_TSS_EMULATION) && defined(ACE_USE_NATIVE_KEYS) +# if defined(ACE_HAS_TSS_EMULATION) && defined(ACE_USE_NATIVE_KEYS) int ACE_OS::thr_keycreate (ACE_OS_thread_key_t *key, -#if defined (ACE_HAS_THR_C_DEST) +# if defined (ACE_HAS_THR_C_DEST) ACE_THR_C_DEST dest, -#else +# else ACE_THR_DEST dest, -#endif /* ACE_HAS_THR_C_DEST */ +# endif /* ACE_HAS_THR_C_DEST */ void *inst) { // ACE_TRACE ("ACE_OS::thr_keycreate"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_PTHREADS) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_PTHREADS) ACE_UNUSED_ARG (inst); -# if defined (ACE_HAS_STDARG_THR_DEST) +# if defined (ACE_HAS_STDARG_THR_DEST) ACE_OSCALL_RETURN (::pthread_keycreate (key, (void (*)(...)) dest), int, -1); -# elif defined (ACE_HAS_PTHREADS_DRAFT4) +# elif defined (ACE_HAS_PTHREADS_DRAFT4) ACE_OSCALL_RETURN (::pthread_keycreate (key, dest), int, -1); -# elif defined (ACE_HAS_PTHREADS_DRAFT6) +# elif defined (ACE_HAS_PTHREADS_DRAFT6) ACE_OSCALL_RETURN (::pthread_key_create (key, dest), int, -1); -# else +# else ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_key_create (key, dest), ace_result_), int, -1); -# endif /* ACE_HAS_STDARG_THR_DEST */ +# endif /* ACE_HAS_STDARG_THR_DEST */ -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (inst); ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_keycreate (key, dest), ace_result_), int, -1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) *key = ::TlsAlloc (); if (*key != ACE_SYSCALL_FAILED) @@ -3277,28 +3271,28 @@ ACE_OS::thr_keycreate (ACE_OS_thread_key_t *key, else ACE_FAIL_RETURN (-1); /* NOTREACHED */ -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (dest); ACE_UNUSED_ARG (inst); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } -#endif /* ACE_HAS_TSS_EMULATION && ACE_USE_NATIVE_KEYS */ +# endif /* ACE_HAS_TSS_EMULATION && ACE_USE_NATIVE_KEYS */ int ACE_OS::thr_keycreate (ACE_thread_key_t *key, -#if defined (ACE_HAS_THR_C_DEST) +# if defined (ACE_HAS_THR_C_DEST) ACE_THR_C_DEST dest, -#else +# else ACE_THR_DEST dest, -#endif /* ACE_HAS_THR_C_DEST */ +# endif /* ACE_HAS_THR_C_DEST */ void *inst) { // ACE_TRACE ("ACE_OS::thr_keycreate"); -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_TSS_EMULATION) if (ACE_TSS_Emulation::next_key (*key) == 0) { ACE_TSS_Emulation::tss_destructor (*key, dest); @@ -3312,27 +3306,27 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key, errno = EAGAIN; return -1; } -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) ACE_UNUSED_ARG (inst); -# if defined (ACE_HAS_STDARG_THR_DEST) +# if defined (ACE_HAS_STDARG_THR_DEST) ACE_OSCALL_RETURN (::pthread_keycreate (key, (void (*)(...)) dest), int, -1); -# elif defined (ACE_HAS_PTHREADS_DRAFT4) +# elif defined (ACE_HAS_PTHREADS_DRAFT4) ACE_OSCALL_RETURN (::pthread_keycreate (key, dest), int, -1); -# elif defined (ACE_HAS_PTHREADS_DRAFT6) +# elif defined (ACE_HAS_PTHREADS_DRAFT6) ACE_OSCALL_RETURN (::pthread_key_create (key, dest), int, -1); -# else +# else ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_key_create (key, dest), ace_result_), int, -1); -# endif /* ACE_HAS_STDARG_THR_DEST */ +# endif /* ACE_HAS_STDARG_THR_DEST */ -# elif defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (inst); ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_keycreate (key, dest), ace_result_), int, -1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) *key = ::TlsAlloc (); if (*key != ACE_SYSCALL_FAILED) @@ -3344,31 +3338,31 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key, else ACE_FAIL_RETURN (-1); /* NOTREACHED */ -# endif /* ACE_HAS_STHREADS */ -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (dest); ACE_UNUSED_ARG (inst); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } int ACE_OS::thr_key_used (ACE_thread_key_t key) { -#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) ACE_TSS_Cleanup::instance ()->key_used (key); return 0; -#else +# else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ +# endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ } int ACE_OS::thr_key_detach (void *inst) { -#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) if (ACE_TSS_Cleanup::lockable ()) return ACE_TSS_Cleanup::instance()->detach (inst); else @@ -3377,10 +3371,10 @@ ACE_OS::thr_key_detach (void *inst) // might not have been constructed yet, or might have been // destroyed already. Just leak the key . . . return -1; -#else +# else ACE_UNUSED_ARG (inst); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ +# endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ } // Create a contiguous command-line argument buffer with each arg @@ -3389,13 +3383,13 @@ ACE_OS::thr_key_detach (void *inst) pid_t ACE_OS::fork_exec (ASYS_TCHAR *argv[]) { -#if defined (ACE_WIN32) +# if defined (ACE_WIN32) ACE_ARGV argv_buf (argv); if (argv_buf.buf () != 0) { PROCESS_INFORMATION process_info; -# if !defined (ACE_HAS_WINCE) +# if !defined (ACE_HAS_WINCE) STARTUPINFO startup_info; ACE_OS::memset ((void *) &startup_info, 0, sizeof startup_info); startup_info.cb = sizeof startup_info; @@ -3411,7 +3405,7 @@ ACE_OS::fork_exec (ASYS_TCHAR *argv[]) 0, // No current directory. &startup_info, &process_info)) -# else +# else if (::CreateProcess (0, (LPTSTR) ACE_WIDE_STRING (argv_buf.buf ()), 0, // No process attributes. @@ -3423,7 +3417,7 @@ ACE_OS::fork_exec (ASYS_TCHAR *argv[]) 0, // No current directory. 0, // Can't use startup info on CE &process_info)) -# endif /* ! ACE_HAS_WINCE */ +# endif /* ! ACE_HAS_WINCE */ { // Free resources allocated in kernel. ACE_OS::close (process_info.hThread); @@ -3435,9 +3429,9 @@ ACE_OS::fork_exec (ASYS_TCHAR *argv[]) // CreateProcess failed. return -1; -#elif defined (CHORUS) +# elif defined (CHORUS) return -1; // do it later!!! -#else +# else pid_t result = ACE_OS::fork (); switch (result) @@ -3458,10 +3452,10 @@ ACE_OS::fork_exec (ASYS_TCHAR *argv[]) // Server process. The fork succeeded. return result; } -#endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ } -#if defined (ACE_NEEDS_WRITEV) +# if defined (ACE_NEEDS_WRITEV) // "Fake" writev for operating systems without it. Note that this is // thread-safe. @@ -3483,11 +3477,11 @@ writev (ACE_HANDLE handle, ACE_WRITEV_TYPE iov[], int n) char *buf; -# if defined (ACE_HAS_ALLOCA) +# if defined (ACE_HAS_ALLOCA) buf = (char *) alloca (length); -# else +# else ACE_NEW_RETURN (buf, char[length], -1); -# endif /* !defined (ACE_HAS_ALLOCA) */ +# endif /* !defined (ACE_HAS_ALLOCA) */ char *ptr = buf; @@ -3498,14 +3492,14 @@ writev (ACE_HANDLE handle, ACE_WRITEV_TYPE iov[], int n) } ssize_t result = ACE::send_n (handle, buf, length); -# if !defined (ACE_HAS_ALLOCA) +# if !defined (ACE_HAS_ALLOCA) delete [] buf; -# endif /* !defined (ACE_HAS_ALLOCA) */ +# endif /* !defined (ACE_HAS_ALLOCA) */ return result; } -#endif /* ACE_NEEDS_WRITEV */ +# endif /* ACE_NEEDS_WRITEV */ -#if defined (ACE_NEEDS_READV) +# if defined (ACE_NEEDS_READV) // "Fake" readv for operating systems without it. Note that this is // thread-safe. @@ -3527,11 +3521,11 @@ readv (ACE_HANDLE handle, length += iov[i].iov_len; char *buf; -# if defined (ACE_HAS_ALLOCA) +# if defined (ACE_HAS_ALLOCA) buf = (char *) alloca (length); -# else +# else ACE_NEW_RETURN (buf, char[length], -1); -# endif /* !defined (ACE_HAS_ALLOCA) */ +# endif /* !defined (ACE_HAS_ALLOCA) */ length = ACE::recv_n (handle, buf, length); @@ -3554,14 +3548,14 @@ readv (ACE_HANDLE handle, } } -# if !defined (ACE_HAS_ALLOCA) +# if !defined (ACE_HAS_ALLOCA) delete [] buf; -# endif /* !defined (ACE_HAS_ALLOCA) */ +# endif /* !defined (ACE_HAS_ALLOCA) */ return length; } -#endif /* ACE_NEEDS_READV */ +# endif /* ACE_NEEDS_READV */ -#if defined (ACE_NEEDS_FTRUNCATE) +# if defined (ACE_NEEDS_FTRUNCATE) extern "C" int ftruncate (ACE_HANDLE handle, long len) { @@ -3573,9 +3567,9 @@ ftruncate (ACE_HANDLE handle, long len) return ::fcntl (handle, F_FREESP, &fl); } -#endif /* ACE_NEEDS_FTRUNCATE */ +# endif /* ACE_NEEDS_FTRUNCATE */ -#if defined (ACE_LACKS_MKTEMP) && !defined (ACE_HAS_MOSTLY_UNICODE_APIS) +# if defined (ACE_LACKS_MKTEMP) && !defined (ACE_HAS_MOSTLY_UNICODE_APIS) char * ACE_OS::mktemp (char *s) { @@ -3602,7 +3596,7 @@ ACE_OS::mktemp (char *s) // template). This appears to match the behavior of the // Solaris 2.5 mktemp(). ACE_OS::sprintf (xxxxxx, "%05d%c", getpid (), unique_letter); - while (::stat (s, &sb) >= 0) + while (ACE_OS::stat (s, &sb) >= 0) { if (++unique_letter <= 'z') ACE_OS::sprintf (xxxxxx, "%05d%c", getpid (), unique_letter); @@ -3617,12 +3611,12 @@ ACE_OS::mktemp (char *s) return s; } } -#endif /* ACE_LACKS_MKTEMP && !ACE_HAS_MOSTLY_UNICODE_APIS */ +# endif /* ACE_LACKS_MKTEMP && !ACE_HAS_MOSTLY_UNICODE_APIS */ int ACE_OS::socket_init (int version_high, int version_low) { -#if defined (ACE_WIN32) +# if defined (ACE_WIN32) if (ACE_OS::socket_initialized_ == 0) { // cout << "WSAStartup" << endl; @@ -3631,57 +3625,57 @@ ACE_OS::socket_init (int version_high, int version_low) int error = WSAStartup (version_requested, &wsa_data); if (error != 0) -# if defined (ACE_HAS_WINCE) +# if defined (ACE_HAS_WINCE) { wchar_t fmt[] = __TEXT ("%s failed, WSAGetLastError returned %d"); wchar_t buf[80]; // @@ Eliminate magic number. ACE_OS::sprintf (buf, fmt, __TEXT ("WSAStartup"), error); ::MessageBox (NULL, buf, __TEXT ("WSAStartup failed!"), MB_OK); } -# else +# else cerr << "WSAStartup failed, WSAGetLastError returned " << error << endl; -# endif /* ACE_HAS_WINCE */ +# endif /* ACE_HAS_WINCE */ ACE_OS::socket_initialized_ = 1; } -#else +# else ACE_UNUSED_ARG (version_high); ACE_UNUSED_ARG (version_low); -#endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ return 0; } int ACE_OS::socket_fini (void) { -#if defined (ACE_WIN32) +# if defined (ACE_WIN32) if (ACE_OS::socket_initialized_ != 0) { // cout << "WSACleanup" << endl; if (WSACleanup () != 0) { int error = ::WSAGetLastError (); -# if defined (ACE_HAS_WINCE) +# if defined (ACE_HAS_WINCE) wchar_t fmt[] = __TEXT ("%s failed, WSAGetLastError returned %d"); wchar_t buf[80]; // @@ Eliminate magic number. ACE_OS::sprintf (buf, fmt, __TEXT ("WSACleanup"), error); ::MessageBox (NULL, buf , __TEXT ("WSACleanup failed!"), MB_OK); -# else +# else cerr << "WSACleanup failed, WSAGetLastError returned " << error << endl; -# endif /* ACE_HAS_WINCE */ +# endif /* ACE_HAS_WINCE */ } ACE_OS::socket_initialized_ = 0; } -#endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ return 0; } -#if defined (ACE_LACKS_SYS_NERR) +# if defined (ACE_LACKS_SYS_NERR) int sys_nerr = ERRMAX + 1; -#endif /* ACE_LACKS_SYS_NERR */ +# endif /* ACE_LACKS_SYS_NERR */ -#if defined (VXWORKS) -# include /**/ <usrLib.h> /* for ::sp() */ +# if defined (VXWORKS) +# include /**/ <usrLib.h> /* for ::sp() */ // This global function can be used from the VxWorks shell to pass // arguments to a C main () function. @@ -3742,9 +3736,9 @@ spa (FUNCPTR entry, ...) // successful return ret > 0 ? 0 : ret; } -#endif /* VXWORKS */ +# endif /* VXWORKS */ -#if !defined (ACE_HAS_SIGINFO_T) +# if !defined (ACE_HAS_SIGINFO_T) siginfo_t::siginfo_t (ACE_HANDLE handle) : si_handle_ (handle), si_handles_ (&handle) @@ -3756,23 +3750,23 @@ siginfo_t::siginfo_t (ACE_HANDLE *handles) si_handles_ (handles) { } -#endif /* ACE_HAS_SIGINFO_T */ +# endif /* ACE_HAS_SIGINFO_T */ pid_t ACE_OS::fork (const char *program_name) { // ACE_TRACE ("ACE_OS::fork"); -#if defined (ACE_LACKS_FORK) +# if defined (ACE_LACKS_FORK) ACE_UNUSED_ARG (program_name); ACE_NOTSUP_RETURN (pid_t (-1)); -#else +# else pid_t pid = ::fork (); if (pid == 0) ACE_LOG_MSG->sync (program_name); return pid; -#endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ } void @@ -3863,8 +3857,8 @@ ACE_OS::pread (ACE_HANDLE handle, size_t nbytes, off_t offset) { -#if defined (ACE_HAS_P_READ_WRITE) -# if defined (ACE_WIN32) +# if defined (ACE_HAS_P_READ_WRITE) +# if defined (ACE_WIN32) ACE_MT (ACE_Thread_Mutex *ace_os_monitor_lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object @@ -3890,7 +3884,7 @@ ACE_OS::pread (ACE_HANDLE handle, DWORD bytes_read; -# if defined (ACE_HAS_WINNT4) +# if defined (ACE_HAS_WINNT4) OVERLAPPED overlapped; overlapped.Internal = 0; @@ -3921,7 +3915,7 @@ ACE_OS::pread (ACE_HANDLE handle, } } -# else /* ACE_HAS_WINNT4 */ +# else /* ACE_HAS_WINNT4 */ BOOL result = ::ReadFile (handle, buf, @@ -3931,7 +3925,7 @@ ACE_OS::pread (ACE_HANDLE handle, if (result == FALSE) return -1; -# endif /* ACE_HAS_WINNT4 */ +# endif /* ACE_HAS_WINNT4 */ // Reset the original file pointer position if (::SetFilePointer (handle, @@ -3942,13 +3936,13 @@ ACE_OS::pread (ACE_HANDLE handle, return (ssize_t) bytes_read; -# else /* ACE_WIN32 */ +# else /* ACE_WIN32 */ return ::pread (handle, buf, nbytes, offset); -# endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ -#else /* ACE_HAS_P_READ_WRITE */ +# else /* ACE_HAS_P_READ_WRITE */ ACE_MT (ACE_Thread_Mutex *ace_os_monitor_lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object @@ -3985,7 +3979,7 @@ ACE_OS::pread (ACE_HANDLE handle, return bytes_read; -#endif /* ACE_HAD_P_READ_WRITE */ +# endif /* ACE_HAD_P_READ_WRITE */ } ssize_t @@ -3994,8 +3988,8 @@ ACE_OS::pwrite (ACE_HANDLE handle, size_t nbytes, off_t offset) { -#if defined (ACE_HAS_P_READ_WRITE) -# if defined (ACE_WIN32) +# if defined (ACE_HAS_P_READ_WRITE) +# if defined (ACE_WIN32) ACE_MT (ACE_Thread_Mutex *ace_os_monitor_lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object @@ -4021,7 +4015,7 @@ ACE_OS::pwrite (ACE_HANDLE handle, DWORD bytes_written; -# if defined (ACE_HAS_WINNT4) +# if defined (ACE_HAS_WINNT4) OVERLAPPED overlapped; overlapped.Internal = 0; @@ -4052,7 +4046,7 @@ ACE_OS::pwrite (ACE_HANDLE handle, } } -# else /* ACE_HAS_WINNT4 */ +# else /* ACE_HAS_WINNT4 */ BOOL result = ::WriteFile (handle, buf, @@ -4062,7 +4056,7 @@ ACE_OS::pwrite (ACE_HANDLE handle, if (result == FALSE) return -1; -# endif /* ACE_HAS_WINNT4 */ +# endif /* ACE_HAS_WINNT4 */ // Reset the original file pointer position if (::SetFilePointer (handle, @@ -4073,13 +4067,13 @@ ACE_OS::pwrite (ACE_HANDLE handle, return (ssize_t) bytes_written; -# else /* ACE_WIN32 */ +# else /* ACE_WIN32 */ return ::pwrite (handle, buf, nbytes, offset); -# endif /* ACE_WIN32 */ +# endif /* ACE_WIN32 */ -#else /* ACE_HAS_P_READ_WRITE */ +# else /* ACE_HAS_P_READ_WRITE */ ACE_MT (ACE_Thread_Mutex *ace_os_monitor_lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object @@ -4116,10 +4110,10 @@ ACE_OS::pwrite (ACE_HANDLE handle, return bytes_written; -#endif /* ACE_HAD_P_READ_WRITE */ +# endif /* ACE_HAD_P_READ_WRITE */ } -#if defined (ACE_LACKS_DIFFTIME) +# if defined (ACE_LACKS_DIFFTIME) double ACE_OS::difftime (time_t t1, time_t t0) { @@ -4177,7 +4171,7 @@ ACE_OS::difftime (time_t t1, time_t t0) tms[0].tm_hour = 0; tms[0].tm_yday += 1; -# define ISLEAPYEAR(y) ((y)&3u?0:(y)%25u?1:(y)/25u&12?0:1) +# define ISLEAPYEAR(y) ((y)&3u?0:(y)%25u?1:(y)/25u&12?0:1) if (ISLEAPYEAR(tms[0].tm_year)) seconds += 60*60*24 * (366 - tms[0].tm_yday); @@ -4197,7 +4191,7 @@ ACE_OS::difftime (time_t t1, time_t t0) tms[0].tm_year += 1; } -# undef ISLEAPYEAR +# undef ISLEAPYEAR } else @@ -4250,9 +4244,9 @@ ACE_OS::difftime (time_t t1, time_t t0) return seconds; } -#endif /* ACE_LACKS_DIFFTIME */ +# endif /* ACE_LACKS_DIFFTIME */ -#if defined (ACE_HAS_WINCE) +# if defined (ACE_HAS_WINCE) wchar_t * ACE_OS::ctime (const time_t *t) { @@ -4278,15 +4272,15 @@ ACE_OS::ctime_r (const time_t *clock, file_time.dwLowDateTime = _100ns.LowPart; file_time.dwHighDateTime = _100ns.HighPart; -# if 1 +# if 1 FILETIME localtime; SYSTEMTIME systime; FileTimeToLocalFileTime (&file_time, &localtime); FileTimeToSystemTime (&localtime, &systime); -# else +# else SYSTEMTIME systime; FileTimeToSystemTime ((FILETIME *) &file_time, &systime); -# endif /* 0 */ +# endif /* 0 */ ACE_OS::sprintf (buf, ACE_OS_CTIME_R_FMTSTR, ACE_OS::day_of_week_name[systime.wDayOfWeek], ACE_OS::month_name[systime.wMonth - 1], @@ -4297,27 +4291,27 @@ ACE_OS::ctime_r (const time_t *clock, systime.wYear); return buf; } -#endif /* ACE_HAS_WINCE */ +# endif /* ACE_HAS_WINCE */ -#if !defined (ACE_HAS_WINCE) +# if !defined (ACE_HAS_WINCE) time_t ACE_OS::mktime (struct tm *t) { // ACE_TRACE ("ACE_OS::asctime"); -# if defined (ACE_HAS_MT_SAFE_MKTIME) || !defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_MT_SAFE_MKTIME) || !defined (ACE_HAS_THREADS) ACE_OSCALL_RETURN (::mktime (t), time_t, (time_t) -1); -# else +# else ACE_MT (ACE_Thread_Mutex *ace_os_monitor_lock = ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object (ACE_Object_Manager::ACE_OS_MONITOR_LOCK); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *ace_os_monitor_lock, (time_t) -1)); ACE_OSCALL_RETURN (::mktime (t), time_t, (time_t) -1); -# endif /* ACE_HAS_MT_SAFE_MKTIME */ +# endif /* ACE_HAS_MT_SAFE_MKTIME */ } -#endif /* !ACE_HAS_WINCE */ +# endif /* !ACE_HAS_WINCE */ -#if !defined (ACE_HAS_THREADS) || defined (ACE_LACKS_RWLOCK_T) +# if !defined (ACE_HAS_THREADS) || defined (ACE_LACKS_RWLOCK_T) int ACE_OS::rwlock_init (ACE_rwlock_t *rw, int type, @@ -4327,7 +4321,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw, // ACE_TRACE ("ACE_OS::rwlock_init"); type = type; name = name; -# if defined (ACE_HAS_THREADS) && defined (ACE_LACKS_RWLOCK_T) +# if defined (ACE_HAS_THREADS) && defined (ACE_LACKS_RWLOCK_T) // NT, POSIX, and VxWorks don't support this natively. ACE_UNUSED_ARG (name); int result = -1; @@ -4376,17 +4370,17 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw, errno = error; } return result; -# else +# else ACE_UNUSED_ARG (rw); ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (arg); ACE_NOTSUP_RETURN (-1); -# endif /* ACE_HAS_THREADS */ +# endif /* ACE_HAS_THREADS */ } -#endif /* ! ACE_HAS_THREADS || ACE_LACKS_RWLOCK_T */ +# endif /* ! ACE_HAS_THREADS || ACE_LACKS_RWLOCK_T */ -#if defined (ACE_PSOS) +# if defined (ACE_PSOS) // bit masks and shifts for prying info out of the pSOS time encoding const u_long ACE_PSOS_Time_t::year_mask = 0x0000FFFFul; @@ -4511,7 +4505,7 @@ ACE_PSOS_Time_t::get_system_time (ACE_PSOS_Time_t& t) { u_long ret_val = 0; -# if defined (ACE_PSOSIM) // system time is broken in simulator. +# if defined (ACE_PSOSIM) // system time is broken in simulator. timeval tv; int result = 0; ACE_OSCALL (::gettimeofday (&tv, 0), int, -1, result); @@ -4526,9 +4520,9 @@ ACE_PSOS_Time_t::get_system_time (ACE_PSOS_Time_t& t) t.date_ = pt.date_; t.time_ = pt.time_; t.ticks_ = pt.ticks_; -# else +# else ret_val = tm_get (&(t.date_), &(t.time_), &(t.ticks_)); -# endif /* ACE_PSOSIM */ +# endif /* ACE_PSOSIM */ return ret_val; } @@ -4543,7 +4537,7 @@ ACE_PSOS_Time_t::set_system_time (const ACE_PSOS_Time_t& t) // Static member function to set current system time. -# if defined (ACE_PSOSIM) +# if defined (ACE_PSOSIM) ACE_INLINE u_long ACE_PSOS_Time_t::init_simulator_time (void) @@ -4572,10 +4566,10 @@ ACE_PSOS_Time_t::init_simulator_time (void) // Static member function to initialize system time, using UNIX calls. -# endif /* ACE_PSOSIM */ -#endif /* ACE_PSOS */ +# endif /* ACE_PSOSIM */ +# endif /* ACE_PSOS */ -#if defined (__DGUX) && defined (ACE_HAS_THREADS) && defined (_POSIX4A_DRAFT10_SOURCE) +# if defined (__DGUX) && defined (ACE_HAS_THREADS) && defined (_POSIX4A_DRAFT10_SOURCE) extern "C" int __d6_sigwait (sigset_t *set); extern "C" int __d10_sigwait( const sigset_t *set, int *sig ) @@ -4588,9 +4582,9 @@ extern "C" int __d10_sigwait( const sigset_t *set, int *sig ) *sig = caught_sig; return 0; } -#endif /* __DGUX && PTHREADS && _POSIX4A_DRAFT10_SOURCE */ +# endif /* __DGUX && PTHREADS && _POSIX4A_DRAFT10_SOURCE */ -#if defined (CHORUS) +# if defined (CHORUS) extern "C" void ace_sysconf_dump (void) @@ -4665,9 +4659,9 @@ ace_sysconf_dump (void) ACE_OS::sysconf (_SC_TIMERS), ACE_OS::sysconf (_SC_VERSION))); } -#endif /* CHORUS */ +# endif /* CHORUS */ -#if defined (ACE_HAS_WINCE) +# if defined (ACE_HAS_WINCE) ACE_CE_Bridge *ACE_CE_Bridge::default_text_bridge_ = 0; ACE_CE_Bridge::ACE_CE_Bridge (void) @@ -4742,4 +4736,4 @@ ACE_CE_Bridge::write_msg (CString *s) MAKEWORD (this->idc_, this->notification_), (long)((void *) s)); } -#endif /* ACE_HAS_WINCE */ +# endif /* ACE_HAS_WINCE */ @@ -22,6 +22,11 @@ // configuration file (e.g., config-sunos5-sunc++-4.x.h). # include "ace/inc_user_config.h" +#if defined (ACE_PSOS_TM) +typedef long long longlong_t; +typedef long id_t; +#endif /*ACE_PSOS_TM*/ + # if defined (ACE_HAS_MOSTLY_UNICODE_APIS) && !defined (UNICODE) # error UNICODE must be defined when using ACE_HAS_MOSTLY_UNICODE_APIS, check your compiler document on how to enable UNICODE. # endif /* ACE_HAS_MOSTLY_UNICODE_APIS && !UNICODE */ @@ -562,17 +567,49 @@ typedef int key_t; # if defined (ACE_PSOS) + // remap missing error numbers for system functions + #define EPERM 1 /* Not super-user */ + #define ENOENT 2 /* No such file or directory */ + #define ESRCH 3 /* No such process */ +# if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) + #define EINTR 4 /* interrupted system call */ +# endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ + #define EBADF 9 /* Bad file number */ + #define EAGAIN 11 /* Resource temporarily unavailable */ +# if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) + #define EWOULDBLOCK EAGAIN /* Blocking resource request would block */ + #define ENOMEM 12 /* Not enough core */ +# endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ + #define EACCES 13 /* Permission denied */ +# if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) + #define EEXIST 17 /* File exists */ +# endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ + #define ENOSPC 28 /* No space left on device */ +# if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) + #define EPIPE 32 /* Broken pipe */ +# endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ + #define ETIME 62 /* timer expired */ + #define ENAMETOOLONG 78 /* path name is too long */ + #define ENOSYS 89 /* Unsupported file system operation */ +# if ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) + #define EADDRINUSE 125 /* Address already in use */ + #define ENETUNREACH 128 /* Network is unreachable */ + #define EISCONN 133 /* Socket is already connected */ + #define ESHUTDOWN 143 /* Can't send after socket shutdown */ + #define ECONNREFUSED 146 /* Connection refused */ + #define EINPROGRESS 150 /* operation now in progress */ +# endif /* ! defined (ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM) */ + #define ERRMAX 151 /* Last error number */ + +# 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 */ - -# if defined (ACE_PSOSIM) - /* In the *simulator* environment, use unsigned int for size_t */ -# define size_t unsigned int +# define size_t unsigned int -// #include /**/ <prepc.h> /* pREPC+ ANSI C Standard Library calls */ /* include <rpc.h> pRPC+ Remote Procedure Call Library calls */ /* are not supported by pSOSim */ @@ -585,54 +622,79 @@ typedef int key_t; /* 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> - - // remap missing error numbers for system functions -# define EPERM 1 /* Not super-user */ -# define ENOENT 2 /* No such file or directory */ -# define ESRCH 3 /* No such process */ -# define EINTR 4 /* interrupted system call */ -# define EBADF 9 /* Bad file number */ -# define EAGAIN 11 /* Resource temporarily unavailable */ -# define EWOULDBLOCK EAGAIN /* Blocking resource request would block */ -# define ENOMEM 12 /* Not enough core */ -# define EACCES 13 /* Permission denied */ -# define EEXIST 17 /* File exists */ -# define ENOSPC 28 /* No space left on device */ -# define EPIPE 32 /* Broken pipe */ -# define ETIME 62 /* timer expired */ -# define ENAMETOOLONG 78 /* path name is too long */ -# define ENOSYS 89 /* Unsupported file system operation */ -# define EADDRINUSE 125 /* Address already in use */ -# define ENETUNREACH 128 /* Network is unreachable */ -# define EISCONN 133 /* Socket is already connected */ -# define ESHUTDOWN 143 /* Can't send after socket shutdown */ -# define ECONNREFUSED 146 /* Connection refused */ -# define EINPROGRESS 150 /* operation now in progress */ -# define ERRMAX 151 /* Last error number */ - -# define TCP_ -# if ! defined (BUFSIZ) -# define BUFSIZ 1024 -# endif /* ! defined (BUFSIZ) */ - - -# else - -# include /**/ <rpc.h> /* pRPC+ Remote Procedure Call Library calls */ -# include /**/ <phile.h> /* pHILE+ file system calls */ - - -# endif /* defined (ACE_PSOSIM) */ - + #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 + 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; + typedef char *caddr_t; + typedef long pid_t; +// typedef unsigned char wchar_t; + #endif + + #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 */ + #include /**/ <unistd.h> /* Diab Data supplied file system calls */ + #include /**/ <sys/wait.h> /* Diab Data supplied header file */ + +// This collides with phile.h +// #include /**/ <sys/stat.h> /* Diab Data supplied header file */ + + // missing preprocessor definitions + #define AF_UNIX 0x1 + #define PF_UNIX AF_UNIX + #define PF_INET AF_INET + #define AF_MAX AF_INET + #define IFF_LOOPBACK IFF_EXTLOOPBACK + + typedef long fd_mask; + #define IPPORT_RESERVED 1024 + #define IPPORT_USERRESERVED 5000 + + #define howmany(x, y) (((x)+((y)-1))/(y)) + + 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) */ // For general purpose portability +typedef u_long ACE_idtype_t; +typedef u_long ACE_id_t; +# define ACE_SELF (0) +typedef u_long ACE_pri_t; + // Use pSOS semaphores, wrapped . . . typedef struct { @@ -659,7 +721,7 @@ typedef struct # endif /* ACE_DEFAULT_SVC_CONF */ # if !defined (ACE_DEFAULT_SEM_KEY) -# define ACE_DEFAULT_SEM_KEY "ACE_SEM_KEY" +# define ACE_DEFAULT_SEM_KEY 1234 # endif /* ACE_DEFAULT_SEM_KEY */ # define ACE_STDIN 0 @@ -827,6 +889,14 @@ struct ACE_OVERLAPPED ACE_HANDLE hEvent; }; +#if !defined(USER_INCLUDE_SYS_TIME_TM) +typedef struct timespec +{ + time_t tv_sec; // Seconds + long tv_nsec; // Nanoseconds +} timespec_t; +#endif + // Use pSOS time, wrapped . . . class ACE_Export ACE_PSOS_Time_t { @@ -972,7 +1042,7 @@ extern "C" pthread_t pthread_self (void); # endif /* VXWORKS */ # endif /* ACE_NEEDS_SYSTIME_H */ -# if !defined (ACE_HAS_POSIX_TIME) +# if !defined (ACE_HAS_POSIX_TIME) && !defined (ACE_PSOS) // Definition per POSIX. typedef struct timespec { @@ -1617,6 +1687,7 @@ struct stat { # 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; @@ -1626,11 +1697,14 @@ struct stat { 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 */ -# include /**/ <sys/stat.h> +# if ! defined (ACE_PSOS) +# include /**/ <sys/stat.h> +# endif # endif /* ACE_HAS_WINCE */ # if defined (ACE_NEW_THROWS_EXCEPTIONS) @@ -1931,11 +2005,16 @@ typedef ACE_mutex_t ACE_thread_mutex_t; // implement ACE_thread_mutex_t and ACE_mutex_t using pSOS semaphores typedef u_long ACE_mutex_t; typedef u_long ACE_thread_mutex_t; -typedef long pid_t; -typedef char *ACE_thread_t; -typedef int ACE_hthread_t; +typedef u_long ACE_thread_t; +typedef u_long ACE_hthread_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 @@ -1977,29 +2056,29 @@ typedef u_int ACE_thread_key_t; /* #define T_NOFPU 0x00000000 Not using FPU */ /* #define T_FPU 0x00000002 Using FPU bit */ -// pSOS signals are sent via as_send(u_long tid, u_long signals) -typedef u_long sigset_t; - -// Wrapper for NT events on pSOS. -class ACE_Export ACE_event_t -{ - friend class ACE_OS; -protected: - ACE_mutex_t lock_; - // Protect critical section. - - ACE_cond_t condition_; - // Keeps track of waiters. - - int manual_reset_; - // Specifies if this is an auto- or manual-reset event. - - int is_signaled_; - // "True" if signaled. - - u_long waiting_threads_; - // Number of waiting threads. -}; +//// forward declaration of cond_t emulation class +//class ACE_cond_t; +// +//// Wrapper for NT events on pSOS. +//class ACE_Export ACE_event_t +//{ +// friend class ACE_OS; +//protected: +// ACE_mutex_t lock_; +// // Protect critical section. +// +// ACE_cond_t condition_; +//// Keeps track of waiters. +// +//int manual_reset_; +//// Specifies if this is an auto- or manual-reset event. +// +//int is_signaled_; +//// "True" if signaled. +// +//u_long waiting_threads_; +//// Number of waiting threads. +//}; # elif defined (VXWORKS) @@ -2277,19 +2356,23 @@ typedef int ACE_mutex_t; typedef int ACE_thread_mutex_t; # if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_PSOS) typedef int ACE_sema_t; -# endif /* !ACE_HAS_POSIX_SEM */ +# 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; -# if defined (ACE_PSOS) +# endif /* ACE_HAS_THREADS */ + +# if defined (ACE_PSOS) // Wrapper for NT events on pSOS. class ACE_Export ACE_event_t { friend class ACE_OS; + protected: + ACE_mutex_t lock_; // Protect critical section. @@ -2306,9 +2389,7 @@ protected: // Number of waiting threads. }; -# endif /* ACE_PSOS */ - -# endif /* ACE_HAS_THREADS */ +# endif /* ACE_PSOS */ // Standard C Library includes // NOTE: stdarg.h must be #included before stdio.h on LynxOS. @@ -2316,17 +2397,55 @@ protected: # if !defined (ACE_HAS_WINCE) # include /**/ <assert.h> # include /**/ <stdio.h> -# include /**/ <new.h> -# include /**/ <signal.h> -# include /**/ <errno.h> -# include /**/ <fcntl.h> +// this is a nasty hack to get around problems with the +// pSOS definition of BUFSIZ as the config table entry +// (which is valued using the LC_BUFSIZ value anyway) +# if defined (ACE_PSOS) +# if defined (BUFSIZ) +# undef BUFSIZ +# endif /* defined (BUFSIZ) */ +# define BUFSIZ LC_BUFSIZ +# endif /* defined (ACE_PSOS) */ + +# include /**/ <new.h> +# include /**/ <signal.h> +# include /**/ <errno.h> +# include /**/ <fcntl.h> # endif /* ACE_HAS_WINCE */ + # include /**/ <limits.h> # include /**/ <ctype.h> # include /**/ <string.h> # include /**/ <stdlib.h> # include /**/ <float.h> +# if defined (ACE_PSOS_SNARFS_HEADER_INFO) + + // header information snarfed from compiler provided header files + // that are not included because there is already an identically + // named file provided with pSOS, which does not have this info + + // from compiler supplied stdio.h + extern FILE *fdopen(int, const char *); + extern int getopt(int, char *const *, const char *); + extern char *tempnam(const char *, const char *); + extern "C" int fileno(FILE *); + +// #define fileno(stream) ((stream)->_file) + + // from compiler supplied string.h + extern char *strdup(const char *); + + // from compiler supplied stat.h + extern mode_t umask(mode_t); + extern int mkfifo(const char *, mode_t); + extern int mkdir(const char *, mode_t); + + // from compiler supplied stdlib.h + extern int putenv(char *); + +# endif /* ACE_PSOS_SNARFS_HEADER_INFO */ + # if defined (ACE_NEEDS_SCHED_H) # include /**/ <sched.h> # endif /* ACE_NEEDS_SCHED_H */ @@ -2336,6 +2455,7 @@ protected: # define isdigit iswdigit # endif /* ACE_HAS_WINCE */ + // If the user wants minimum IOStream inclusion, we will just include // the forward declarations # if defined (ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION) @@ -2423,8 +2543,10 @@ typedef void *ACE_MALLOC_T; # if defined (ACE_HAS_SIG_C_FUNC) extern "C" { # endif /* ACE_HAS_SIG_C_FUNC */ +# if !defined (ACE_PSOS) typedef void (*ACE_SignalHandler)(int); typedef void (*ACE_SignalHandlerV)(int); +# endif /* !defined (ACE_PSOS) */ # if defined (ACE_HAS_SIG_C_FUNC) } # endif /* ACE_HAS_SIG_C_FUNC */ @@ -2807,6 +2929,10 @@ const int ACE_DEFAULT_SHLIB_MODE = 0; typedef ACE_UINT64 ACE_hrtime_t; +#if defined (ACE_SIGINFO_IS_SIGINFO_T) + typedef struct siginfo siginfo_t; +#endif /* ACE_LACKS_SIGINFO_H */ + # else /* !defined (ACE_WIN32) && !defined (ACE_PSOS) */ # if (defined (ACE_HAS_UNICODE) && (defined (UNICODE))) @@ -3717,6 +3843,8 @@ typedef const char **SYS_SIGLIST; // This is for C++ static methods. # if defined (VXWORKS) typedef FUNCPTR ACE_THR_FUNC; // where typedef int (*FUNCPTR) (...) +# elif defined (ACE_PSOS) +typedef void (*ACE_THR_FUNC)(void *); # else typedef void *(*ACE_THR_FUNC)(void *); # endif /* VXWORKS */ @@ -3730,6 +3858,10 @@ extern "C" { # if defined (VXWORKS) typedef FUNCPTR ACE_THR_C_FUNC; // where typedef int (*FUNCPTR) (...) +# elif defined (ACE_PSOS) +// needed to handle task entry point type inconsistencies in pSOS+ +typedef void (*PSOS_TASK_ENTRY_POINT)(); +typedef void (*ACE_THR_C_FUNC)(void *); # else typedef void *(*ACE_THR_C_FUNC)(void *); # endif /* VXWORKS */ @@ -3829,7 +3961,7 @@ private: typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext); // If the xti.h file redefines the function names, do it now, else -// when the function definitions are encountered, they won't match the +// when the functigon definitions are encountered, they won't match the // declaration here. # if defined (ACE_REDEFINES_XTI_FUNCTIONS) @@ -4216,8 +4348,14 @@ public: // However, we should provide UNICODE version of them. static FILE *fopen (const char *filename, const char *mode); + +#if defined (fdopen) +#undef fdopen +#endif + static FILE *fdopen (ACE_HANDLE handle, const char *mode); + static char *fgets (char *buf, int size, FILE *fp); @@ -5463,6 +5601,133 @@ private: # endif /* ACE_HAS_TSS_EMULATION */ +// moved ACE_TSS_Ref, ACE_TSS_Info, and ACE_TSS_Keys class +// declarations from OS.cpp so they are visible to the single +// file of template instantiations. +#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) +class ACE_TSS_Ref + // = TITLE + // "Reference count" for thread-specific storage keys. + // + // = DESCRIPTION + // Since the <ACE_Unbounded_Stack> doesn't allow duplicates, the + // "reference count" is the identify of the thread_id. +{ +public: + ACE_TSS_Ref (ACE_thread_t id); + // Constructor + + ACE_TSS_Ref (void); + // Default constructor + + int operator== (const ACE_TSS_Ref &); + // Check for equality. + + int operator!= (const ACE_TSS_Ref &); + // Check for inequality. + +// private: + + ACE_thread_t tid_; + // ID of thread using a specific key. +}; + +class ACE_TSS_Info + // = TITLE + // Thread Specific Key management. + // + // = DESCRIPTION + // This class maps a key to a "destructor." +{ +public: + ACE_TSS_Info (ACE_thread_key_t key, + void (*dest)(void *) = 0, + void *tss_inst = 0); + // Constructor + + ACE_TSS_Info (void); + // Default constructor + + int key_in_use (void) const { return thread_count_ != -1; } + // Returns 1 if the key is in use, 0 if not. + + void key_in_use (int flag) { thread_count_ = flag == 0 ? -1 : 1; } + // Mark the key as being in use if the flag is non-zero, or + // not in use if the flag is 0. + + int operator== (const ACE_TSS_Info &); + // Check for equality. + + int operator!= (const ACE_TSS_Info &); + // Check for inequality. + + void dump (void); + // Dump the state. + +private: + ACE_thread_key_t key_; + // Key to the thread-specific storage item. + + void (*destructor_)(void *); + // "Destructor" that gets called when the item is finally released. + + void *tss_obj_; + // Pointer to ACE_TSS<xxx> instance that has/will allocate the key. + + int thread_count_; + // Count of threads that are using this key. Contains -1 when the + // key is not in use. + + friend class ACE_TSS_Cleanup; +}; + +class ACE_TSS_Keys + // = TITLE + // Collection of in-use flags for a thread's TSS keys. + // For internal use only by ACE_TSS_Cleanup; it is public because + // some compilers can't use nested classes for template instantiation + // parameters. + // + // = DESCRIPTION + // Wrapper around array of whether each key is in use. A simple + // typedef doesn't work with Sun C++ 4.2. +{ + public: + ACE_TSS_Keys (void); + // Default constructor, to initialize all bits to zero (unused). + + int test_and_set (const ACE_thread_key_t key); + // Mark the specified key as being in use, if it was not already so marked. + // Returns 1 if the had already been marked, 0 if not. + + int test_and_clear (const ACE_thread_key_t key); + // Mark the specified key as not being in use, if it was not already so + // cleared. Returns 1 if the had already been cleared, 0 if not. + +private: + static void find (const u_int key, u_int &word, u_int &bit); + // For a given key, find the word and bit number that represent it. + + enum + { +# if ACE_SIZEOF_LONG == 8 + ACE_BITS_PER_WORD = 64, +# elif ACE_SIZEOF_LONG == 4 + ACE_BITS_PER_WORD = 32, +# else +# error ACE_TSS_Keys only supports 32 or 64 bit longs. +# endif /* ACE_SIZEOF_LONG == 8 */ + ACE_WORDS = (ACE_DEFAULT_THREAD_KEYS - 1) / ACE_BITS_PER_WORD + 1 + }; + + u_long key_bit_words_[ACE_WORDS]; + // Bit flag collection. A bit value of 1 indicates that the key is in + // use by this thread. +}; + +# endif /* defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) */ + + // Support non-scalar thread keys, such as with some POSIX // implementations, e.g., MVS. # if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T) @@ -5499,7 +5764,7 @@ private: } while (0) # endif /* ACE_NEW_THROWS_EXCEPTIONS */ -// Some useful abstration for expressions involving +// Some useful abstrations for expressions involving // ACE_Allocator.malloc (). The difference between ACE_NEW_MALLOC* // with ACE_ALLOCATOR* is that they call constructors also. @@ -5524,25 +5789,43 @@ private: } while (0) # define ACE_NOOP(x) -# define ACE_DES_NOFREE (POINTER,CLASS) POINTER -> CLASS :: ~ CLASS () -# define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \ + +# if defined (ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR) +# define ACE_DES_NOFREE (POINTER,CLASS) POINTER->~CLASS () +# define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \ + do { POINTER->~CLASS (); DEALLOCATOR (POINTER); } while (0) +# define ACE_DES_NOFREE_TEMPLATE (POINTER,T_CLASS,T_PARAMETER) \ + POINTER->~ T_CLASS () +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { POINTER->~ T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } while (0) +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { POINTER->~ T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } while (0) +# else /* ! ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR */ +# define ACE_DES_NOFREE(POINTER,CLASS) POINTER -> CLASS :: ~ CLASS () +# define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \ do { POINTER -> CLASS :: ~ CLASS (); DEALLOCATOR ( POINTER ); } while (0) -# define ACE_DES_NOFREE_TEMPLATE (POINTER,T_CLASS,T_PARAMETER) \ - POINTER-> T_CLASS T_PARAMETER ::~ T_CLASS () -# if defined (__Lynx__) && __LYNXOS_SDK_VERSION == 199701L +# define ACE_DES_NOFREE_TEMPLATE (POINTER,T_CLASS,T_PARAMETER) \ + POINTER -> T_CLASS T_PARAMETER ::~ T_CLASS () + +# if defined (__Lynx__) && __LYNXOS_SDK_VERSION == 199701L // LynxOS 3.0.0's g++ has trouble with the real versions of these. -# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) -# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) -# else -# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) +# else +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ do { POINTER-> T_CLASS T_PARAMETER ::~ T_CLASS (); \ DEALLOCATOR (POINTER); \ } while (0) -# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ do { POINTER-> T_CLASS <T_PARAM1, T_PARAM2> ::~ T_CLASS (); \ DEALLOCATOR (POINTER); \ } while (0) -# endif +# endif /* defined (__Lynx__) && __LYNXOS_SDK_VERSION == 199701L */ +# endif /* defined ! ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR */ # if defined (ACE_HAS_SIGNAL_SAFE_OS_CALLS) // The following two macros ensure that system calls are properly @@ -5643,7 +5926,7 @@ ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ \ } \ int \ ace_main_i -# elif defined (ACE_PSOS) +# elif defined (ACE_PSOS) && defined (ACE_PSOS_LACKS_ARGC_ARGV) // PSOS root lacks the standard argc, argv command line parameters, // create dummy argc and argv in the "real" main and pass to "user" main. // Ignore return value from user main as well. NOTE: ACE_MAIN must be @@ -533,7 +533,15 @@ ACE_OS::chdir (const char *path) # if defined (VXWORKS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::chdir ((char *) path), ace_result_), int, -1); -# else + +#elif defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (path); + ACE_NOTSUP_RETURN (-1); + +#elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::change_dir ((char *) path), ace_result_), + int, -1); +#else ACE_OSCALL_RETURN (::chdir (path), int, -1); # endif /* VXWORKS */ } @@ -557,14 +565,22 @@ ACE_INLINE int ACE_OS::fstat (ACE_HANDLE handle, struct stat *stp) { // ACE_TRACE ("ACE_OS::fstat"); +#if defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (stp); + ACE_NOTSUP_RETURN (-1); +#elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (::fstat_f (handle, stp), int, -1); +#else ACE_OSCALL_RETURN (::fstat (handle, stp), int, -1); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE gid_t ACE_OS::getgid (void) { // ACE_TRACE ("ACE_OS::getgid"); -# if defined (VXWORKS) || defined(CHORUS) +# if defined (VXWORKS) || defined(CHORUS) || defined (ACE_PSOS) // getgid() is not supported: just one group anyways return 0; # else @@ -576,7 +592,7 @@ ACE_INLINE int ACE_OS::getopt (int argc, char *const *argv, const char *optstring) { // ACE_TRACE ("ACE_OS::getopt"); -# if defined (VXWORKS) +#if defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_UNUSED_ARG (optstring); @@ -594,7 +610,7 @@ ACE_INLINE uid_t ACE_OS::getuid (void) { // ACE_TRACE ("ACE_OS::getuid"); -# if defined (VXWORKS) || defined(CHORUS) +# if defined (VXWORKS) || defined(CHORUS) || defined (ACE_PSOS) // getuid() is not supported: just one user anyways return 0; # else @@ -612,13 +628,13 @@ ACE_OS::isatty (ACE_HANDLE fd) # if !defined (ACE_HAS_MOSTLY_UNICODE_APIS) ACE_INLINE int ACE_OS::mkfifo (const char *file, mode_t mode) -{ - // ACE_TRACE ("ACE_OS::mkfifo"); -# if defined (VXWORKS) || defined (CHORUS) - ACE_UNUSED_ARG (file); - ACE_UNUSED_ARG (mode); - ACE_NOTSUP_RETURN (-1); -# else +{ + // ACE_TRACE ("ACE_OS::mkfifo"); +#if defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) + ACE_UNUSED_ARG (file); + ACE_UNUSED_ARG (mode); + ACE_NOTSUP_RETURN (-1); +#else ACE_OSCALL_RETURN (::mkfifo (file, mode), int, -1); # endif /* VXWORKS */ } @@ -636,7 +652,7 @@ ACE_INLINE int ACE_OS::pipe (ACE_HANDLE fds[]) { // ACE_TRACE ("ACE_OS::pipe"); -# if defined (VXWORKS) +#if defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (fds); ACE_NOTSUP_RETURN (-1); # else @@ -683,7 +699,7 @@ ACE_INLINE pid_t ACE_OS::setsid (void) { // ACE_TRACE ("ACE_OS::setsid"); -# if defined (VXWORKS) || defined (CHORUS) +#if defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) ACE_NOTSUP_RETURN (-1); # else ACE_OSCALL_RETURN (::setsid (), int, -1); @@ -694,7 +710,7 @@ ACE_INLINE mode_t ACE_OS::umask (mode_t cmask) { // ACE_TRACE ("ACE_OS::umask"); -# if defined (VXWORKS) +#if defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (cmask); ACE_NOTSUP_RETURN (-1); # else @@ -969,7 +985,13 @@ ACE_OS::stat (const char *file, struct stat *stp) // ACE_TRACE ("ACE_OS::stat"); # if defined (VXWORKS) ACE_OSCALL_RETURN (::stat ((char *) file, stp), int, -1); -# else +#elif defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (file); + ACE_UNUSED_ARG (stp); + ACE_NOTSUP_RETURN (-1); +#elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (::stat_f ((char *) file, stp), int, -1); +#else ACE_OSCALL_RETURN (::stat (file, stp), int, -1); # endif /* VXWORKS */ } @@ -1036,9 +1058,13 @@ ACE_OS::tempnam (const char *dir, const char *pfx) ACE_UNUSED_ARG (dir); ACE_UNUSED_ARG (pfx); ACE_NOTSUP_RETURN (0); -# else -# if defined (ACE_WIN32) -# if defined (__BORLANDC__) +#elif defined (ACE_PSOS) + // pSOS only considers the directory prefix + ACE_UNUSED_ARG (pfx); + ACE_OSCALL_RETURN (::tmpnam ((char *) dir), char *, 0); +#else +#if defined (ACE_WIN32) +#if defined (__BORLANDC__) ACE_OSCALL_RETURN (::_tempnam ((char *) dir, (char *) pfx), char *, 0); # else ACE_OSCALL_RETURN (::_tempnam (dir, pfx), char *, 0); @@ -1079,7 +1105,7 @@ ACE_OS::cuserid (LPTSTR user, size_t maxlen) ::remCurIdGet (user, 0); return user; } -#elif defined (CHORUS) || defined (ACE_HAS_WINCE) +#elif defined (CHORUS) || defined (ACE_HAS_WINCE) || defined (ACE_PSOS) // @@ WinCE doesn't support GetUserName. But there should be a way // to get around this. ACE_UNUSED_ARG (user); @@ -1108,6 +1134,9 @@ ACE_OS::_exit (int status) ::exit (status); #elif defined (ACE_PSOSIM) ::u_exit (status); +#elif defined (ACE_PSOS_LACKS_PREPC) // JINLU TM does not support exit + ACE_UNUSED_ARG (status); + return; #elif !defined (ACE_HAS_WINCE) ::_exit (status); #else @@ -1608,7 +1637,7 @@ ACE_INLINE long ACE_OS::sysconf (int name) { // ACE_TRACE ("ACE_OS::sysconf"); -#if defined (ACE_WIN32) || defined (VXWORKS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (-1); #else @@ -1695,6 +1724,13 @@ ACE_OS::mutex_init (ACE_mutex_t *m, return -1; } /* NOTREACHED */ + +# elif defined (ACE_PSOS) + ACE_UNUSED_ARG (type); + ACE_UNUSED_ARG (arg); + ACE_UNUSED_ARG (sa); + return (::sm_create ((char *) name, 1, SM_LOCAL | SM_PRIOR, m) == 0) ? 0 : -1; + # elif defined (VXWORKS) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (arg); @@ -1740,6 +1776,8 @@ ACE_OS::mutex_destroy (ACE_mutex_t *m) return -1; } /* NOTREACHED */ +# elif defined (ACE_PSOS) + return (::sm_delete (*m) == 0) ? 0 : -1; # elif defined (VXWORKS) return ::semDelete (*m) == OK ? 0 : -1; # endif /* ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ @@ -1789,6 +1827,8 @@ ACE_OS::mutex_lock (ACE_mutex_t *m) return -1; } /* NOTREACHED */ +# elif defined (ACE_PSOS) + return (::sm_p (*m, SM_WAIT, 0) == 0) ? 0 : -1; # elif defined (VXWORKS) return ::semTake (*m, WAIT_FOREVER) == OK ? 0 : -1; # endif /* ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ @@ -1886,6 +1926,18 @@ ACE_OS::mutex_trylock (ACE_mutex_t *m) return -1; } /* NOTREACHED */ +# elif defined (ACE_PSOS) + switch (::sm_p (*m, SM_NOWAIT, 0)) + { + case 0: + return 0; + case ERR_NOSEM: + errno = EBUSY; + // intentional fall through + default: + return -1; + } + # elif defined (VXWORKS) if (::semTake (*m, NO_WAIT) == ERROR) if (errno == S_objLib_OBJ_TIMEOUT) @@ -1975,6 +2027,8 @@ ACE_OS::mutex_unlock (ACE_mutex_t *m) return -1; } /* NOTREACHED */ +# elif defined (ACE_PSOS) + return (::sm_v (*m) == 0) ? 0 : -1; # elif defined (VXWORKS) return ::semGive (*m) == OK ? 0 : -1; # endif /* ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ @@ -2003,7 +2057,7 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m, ::InitializeCriticalSection (m); return 0; -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) return mutex_init (m, type, name, arg); # endif /* ACE_HAS_STHREADS || ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ #else @@ -2025,7 +2079,7 @@ ACE_OS::thread_mutex_destroy (ACE_thread_mutex_t *m) # elif defined (ACE_HAS_WTHREADS) ::DeleteCriticalSection (m); return 0; -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) return mutex_destroy (m); # endif /* ACE_HAS_STHREADS || ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ #else @@ -2044,7 +2098,7 @@ ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m) # elif defined (ACE_HAS_WTHREADS) ::EnterCriticalSection (m); return 0; -# elif defined (VXWORKS) +#elif defined (VXWORKS) || defined (ACE_PSOS) return mutex_lock (m); # endif /* ACE_HAS_STHREADS || ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ #else @@ -2074,7 +2128,7 @@ ACE_OS::thread_mutex_trylock (ACE_thread_mutex_t *m) ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_WIN32_TRYLOCK */ -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) return ACE_OS::mutex_trylock (m); # endif /* ACE_HAS_STHREADS || ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ #else @@ -2093,7 +2147,7 @@ ACE_OS::thread_mutex_unlock (ACE_thread_mutex_t *m) # elif defined (ACE_HAS_WTHREADS) ::LeaveCriticalSection (m); return 0; -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) return ACE_OS::mutex_unlock (m); # endif /* ACE_HAS_STHREADS || ACE_HAS_DCETHREADS || ACE_HAS_PTHREADS */ #else @@ -2334,9 +2388,9 @@ ACE_INLINE int ACE_OS::sema_destroy (ACE_sema_t *s) { // ACE_TRACE ("ACE_OS::sema_destroy"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) int result; -# if !defined (ACE_LACKS_NAMED_POSIX_SEM) +# if ! defined (ACE_LACKS_NAMED_POSIX_SEM) if (s->name_) { ACE_OS::free ((void *) s->name_); @@ -2344,45 +2398,44 @@ ACE_OS::sema_destroy (ACE_sema_t *s) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sem_close (s->sema_), ace_result_), int, -1); } else -# endif /* ACE_LACKS_NAMED_POSIX_SEM */ +# endif /* ! ACE_LACKS_NAMED_POSIX_SEM */ { ACE_OSCALL (ACE_ADAPT_RETVAL (::sem_destroy (s->sema_), result), int, -1, result); delete s->sema_; s->sema_ = 0; return result; } -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_destroy (s), ace_result_), int, -1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) int r1 = ACE_OS::mutex_destroy (&s->lock_); int r2 = ACE_OS::cond_destroy (&s->count_nonzero_); return r1 != 0 || r2 != 0 ? -1 : 0; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (*s), ace_result_), int, -1); -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ // Free up underlying objects of the simulated semaphore. int r1 = ACE_OS::thread_mutex_destroy (&s->lock_); int r2 = ACE_OS::event_destroy (&s->count_nonzero_); return r1 != 0 || r2 != 0 ? -1 : 0; -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) int result; - ACE_OSCALL (ACE_ADAPT_RETVAL (::semDelete (s->sema_), result), int, -1, result); + ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_delete (s->sema_), result), int, -1, result); s->sema_ = 0; return result; -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ +# elif defined (VXWORKS) int result; - ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_delete (s->sema_), result), int, -1, result); + ACE_OSCALL (ACE_ADAPT_RETVAL (::semDelete (s->sema_), result), int, -1, result); s->sema_ = 0; return result; -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } ACE_INLINE int @@ -2395,12 +2448,12 @@ ACE_OS::sema_init (ACE_sema_t *s, LPSECURITY_ATTRIBUTES sa) { // ACE_TRACE ("ACE_OS::sema_init"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) ACE_UNUSED_ARG (arg); ACE_UNUSED_ARG (max); ACE_UNUSED_ARG (sa); -# if !defined (ACE_LACKS_NAMED_POSIX_SEM) +# if !defined (ACE_LACKS_NAMED_POSIX_SEM) if (name) { ACE_ALLOCATOR_RETURN (s->name_, ACE_OS::strdup (name), -1); @@ -2411,21 +2464,21 @@ ACE_OS::sema_init (ACE_sema_t *s, return (s->sema_ == (sem_t *)-1 ? -1 : 0); } else -# endif /*ACE_LACKS_NAMED_POSIX_SEM */ +# endif /*ACE_LACKS_NAMED_POSIX_SEM */ { s->name_ = 0; ACE_NEW_RETURN (s->sema_, sem_t, -1); ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sem_init (s->sema_, type != USYNC_THREAD, count), ace_result_), int, -1); } -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (max); ACE_UNUSED_ARG (sa); ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_init (s, count, type, arg), ace_result_), int, -1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) ACE_UNUSED_ARG (max); ACE_UNUSED_ARG (sa); int result = -1; @@ -2447,8 +2500,8 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_OS::cond_destroy (&s->count_nonzero_); } return result; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if ! defined (ACE_USES_WINCE_SEMA_SIMULATION) ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (arg); // Create the semaphore with its value initialized to <count> and @@ -2460,7 +2513,7 @@ ACE_OS::sema_init (ACE_sema_t *s, /* NOTREACHED */ else return 0; -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ int result = -1; // Initialize internal object for semaphore simulation. @@ -2493,19 +2546,8 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_OS::event_destroy (&s->count_nonzero_); } return result; -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) - ACE_UNUSED_ARG (name); - ACE_UNUSED_ARG (arg); - ACE_UNUSED_ARG (max); - ACE_UNUSED_ARG (sa); - s->name_ = 0; - s->sema_ = ::semCCreate (type, count); - - return s->sema_ ? 0 : -1; -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) int result; ACE_OS::memcpy (s->name_, name, sizeof (s->name_)); // default semaphore creation flags to priority based, global across nodes @@ -2515,7 +2557,17 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_create (s->name_, count, flags, &(s->sema_)), result), int, -1, result); return result; -#else +# elif defined (VXWORKS) + ACE_UNUSED_ARG (name); + ACE_UNUSED_ARG (arg); + ACE_UNUSED_ARG (max); + ACE_UNUSED_ARG (sa); + s->name_ = 0; + s->sema_ = ::semCCreate (type, count); + + return s->sema_ ? 0 : -1; +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_UNUSED_ARG (count); ACE_UNUSED_ARG (type); @@ -2524,19 +2576,19 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_UNUSED_ARG (max); ACE_UNUSED_ARG (sa); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } ACE_INLINE int ACE_OS::sema_post (ACE_sema_t *s) { // ACE_TRACE ("ACE_OS::sema_post"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sem_post (s->sema_), ace_result_), int, -1); -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_post (s), ace_result_), int, -1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) int result = -1; if (ACE_OS::mutex_lock (&s->lock_) == 0) @@ -2551,12 +2603,12 @@ ACE_OS::sema_post (ACE_sema_t *s) ACE_OS::mutex_unlock (&s->lock_); } return result; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::ReleaseSemaphore (*s, 1, 0), ace_result_), int, -1); -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ int result = -1; // Since we are simulating semaphores, we need to update semaphore @@ -2574,19 +2626,18 @@ ACE_OS::sema_post (ACE_sema_t *s) ACE_OS::thread_mutex_unlock (&s->lock_); } return result; -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::semGive (s->sema_), ace_result_), int, -1); -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) int result; ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_v (s->sema_), result), int, -1, result); return result; -#else +# elif defined (VXWORKS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::semGive (s->sema_), ace_result_), int, -1); +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } ACE_INLINE int @@ -2616,17 +2667,17 @@ ACE_INLINE int ACE_OS::sema_trywait (ACE_sema_t *s) { // ACE_TRACE ("ACE_OS::sema_trywait"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) // POSIX semaphores set errno to EAGAIN if trywait fails ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sem_trywait (s->sema_), ace_result_), int, -1); -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) // STHREADS semaphores set errno to EBUSY if trywait fails. ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_trywait (s), ace_result_), int, -1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) int result = -1; @@ -2643,8 +2694,8 @@ ACE_OS::sema_trywait (ACE_sema_t *s) ACE_OS::mutex_unlock (&s->lock_); } return result; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) int result = ::WaitForSingleObject (*s, 0); if (result == WAIT_OBJECT_0) @@ -2655,7 +2706,7 @@ ACE_OS::sema_trywait (ACE_sema_t *s) // This is a hack, we need to find an appropriate mapping... return -1; } -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ // Check the status of semaphore first. Return immediately // if the semaphore is not available and avoid grabing the // lock. @@ -2686,8 +2737,19 @@ ACE_OS::sema_trywait (ACE_sema_t *s) errno = result == WAIT_TIMEOUT ? EBUSY : ::GetLastError (); // This is taken from the hack above. ;) return -1; -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) + switch (::sm_p (s->sema_, SM_NOWAIT, 0)) + { + case 0: + return 0; + case ERR_NOSEM: + errno = EBUSY; + // intentional fall through + default: + return -1; + } +# elif defined (VXWORKS) if (::semTake (s->sema_, NO_WAIT) == ERROR) if (errno == S_objLib_OBJ_TIMEOUT) { @@ -2701,29 +2763,23 @@ ACE_OS::sema_trywait (ACE_sema_t *s) else // got the semaphore return 0; -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ - int result; - ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_p (s->sema_, SM_NOWAIT, 0), result), - int, -1, result); - return result; -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } ACE_INLINE int ACE_OS::sema_wait (ACE_sema_t *s) { // ACE_TRACE ("ACE_OS::sema_wait"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sem_wait (s->sema_), ace_result_), int, -1); -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_wait (s), ace_result_), int, -1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) int result = 0; ACE_PTHREAD_CLEANUP_PUSH (&s->lock_); @@ -2756,8 +2812,8 @@ ACE_OS::sema_wait (ACE_sema_t *s) ACE_PTHREAD_CLEANUP_POP (0); return result < 0 ? -1 : result; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) switch (::WaitForSingleObject (*s, INFINITE)) { case WAIT_OBJECT_0: @@ -2768,7 +2824,7 @@ ACE_OS::sema_wait (ACE_sema_t *s) return -1; } /* NOTREACHED */ -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ // Timed wait. int result = -1; for (;;) @@ -2807,36 +2863,35 @@ ACE_OS::sema_wait (ACE_sema_t *s) return -1; } /* NOTREACHED */ -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::semTake (s->sema_, WAIT_FOREVER), ace_result_), int, -1); -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) int result; ACE_OSCALL (ACE_ADAPT_RETVAL (::sm_p (s->sema_, SM_WAIT, 0), result), int, -1, result); return result; -#else +# elif defined (VXWORKS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::semTake (s->sema_, WAIT_FOREVER), ace_result_), int, -1); +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } ACE_INLINE int ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) { // ACE_TRACE ("ACE_OS::sema_wait"); -#if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM) ACE_UNUSED_ARG (s); ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (-1); -#elif defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_STHREADS) +# elif defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (s); ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_HAS_PTHREADS) +# elif defined (ACE_HAS_PTHREADS) int result = 0; int error = 0; @@ -2866,9 +2921,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) if (result == 0) { -#if defined (ACE_LACKS_COND_TIMEDWAIT_RESET) +# if defined (ACE_LACKS_COND_TIMEDWAIT_RESET) tv = ACE_OS::gettimeofday (); -#endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */ +# endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */ --s->count_; } @@ -2877,8 +2932,8 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) ACE_PTHREAD_CLEANUP_POP (0); errno = error; return result < 0 ? -1 : result; -# elif defined (ACE_HAS_WTHREADS) -# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) +# elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_USES_WINCE_SEMA_SIMULATION) int msec_timeout; if (tv.sec () == 0 && tv.usec () == 0) @@ -2912,7 +2967,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) return -1; } /* NOTREACHED */ -# else /* ACE_USES_WINCE_SEMA_SIMULATION */ +# else /* ACE_USES_WINCE_SEMA_SIMULATION */ // Note that in this mode, the acquire is done in two steps, and // we may get signaled but cannot grab the semaphore before // timeout. In that case, we'll need to restart the process with @@ -2974,14 +3029,25 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // We have timed out. errno = ETIME; return -1; -# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ -# elif defined (VXWORKS) +# endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) + // Note that we must convert between absolute time (which is + // passed as a parameter) and relative time (which is what + // the system call expects). + ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); + + u_long ticks = relative_time.sec() * KC_TICKS2SEC + + relative_time.usec () * KC_TICKS2SEC / + ACE_ONE_SECOND_IN_USECS; + ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_WAIT, ticks), int, -1); +# elif defined (VXWORKS) // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // the system call expects). ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); int ticks_per_sec = ::sysClkRateGet (); + int ticks = relative_time.sec() * ticks_per_sec + relative_time.usec () * ticks_per_sec / ACE_ONE_SECOND_IN_USECS; if (::semTake (s->sema_, ticks) == ERROR) @@ -2996,23 +3062,12 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) { return 0; } -# endif /* ACE_HAS_STHREADS */ -#elif defined (ACE_PSOS) - /* TBD - move this into threaded section with mutithreaded port */ - // Note that we must convert between absolute time (which is - // passed as a parameter) and relative time (which is what - // the system call expects). - ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); - - u_long ticks = relative_time.sec() * KC_TICKS2SEC + - relative_time.usec () * KC_TICKS2SEC / - ACE_ONE_SECOND_IN_USECS; - ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_WAIT, ticks), int, -1); -#else +# endif /* ACE_HAS_STHREADS */ +# else ACE_UNUSED_ARG (s); ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (-1); -#endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ } #if defined (ACE_LACKS_COND_T) @@ -3029,7 +3084,7 @@ ACE_OS::cond_destroy (ACE_cond_t *cv) # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_WTHREADS) ACE_OS::event_destroy (&cv->waiters_done_); -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) ACE_OS::sema_destroy (&cv->waiters_done_); # endif /* VXWORKS */ ACE_OS::thread_mutex_destroy (&cv->waiters_lock_); @@ -3053,7 +3108,7 @@ ACE_OS::cond_init (ACE_cond_t *cv, int type, LPCTSTR name, void *arg) result = -1; else if (ACE_OS::thread_mutex_init (&cv->waiters_lock_) == -1) result = -1; -# if defined (VXWORKS) +# if defined (VXWORKS) || defined (ACE_PSOS) else if (ACE_OS::sema_init (&cv->waiters_done_, 0, type) == -1) # else else if (ACE_OS::event_init (&cv->waiters_done_) == -1) @@ -3124,7 +3179,7 @@ ACE_OS::cond_broadcast (ACE_cond_t *cv) result = -1; // Wait for all the awakened threads to acquire their part of // the counting semaphore. -# if defined (VXWORKS) +# if defined (VXWORKS) || defined (ACE_PSOS) else if (ACE_OS::sema_wait (&cv->waiters_done_) == -1) # else else if (ACE_OS::event_wait (&cv->waiters_done_) == -1) @@ -3217,7 +3272,7 @@ ACE_OS::cond_wait (ACE_cond_t *cv, // If we're the last waiter thread during this particular broadcast // then let all the other threads proceed. else if (last_waiter) -# if defined (VXWORKS) +# if defined (VXWORKS) || defined (ACE_PSOS) ACE_OS::sema_post (&cv->waiters_done_); # else ACE_OS::event_signal (&cv->waiters_done_); @@ -3245,7 +3300,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, // Handle the easy case first. if (timeout == 0) return ACE_OS::cond_wait (cv, external_mutex); -# if defined (ACE_HAS_WTHREADS) || defined (VXWORKS) +# if defined (ACE_HAS_WTHREADS) || defined (VXWORKS) || defined (ACE_PSOS) // Prevent race conditions on the <waiters_> count. ACE_OS::thread_mutex_lock (&cv->waiters_lock_); @@ -3301,6 +3356,11 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, result = ACE_OS::sema_wait (&cv->sema_, ACE_Time_Value (0, msec_timeout * 1000)); # endif /* ACE_USES_WINCE_SEMA_SIMULATION */ +# elif defined (ACE_PSOS) + // Inline the call to ACE_OS::sema_wait () because it takes an + // ACE_Time_Value argument. Avoid the cost of that conversion . . . + u_long ticks = (KC_TICKS2SEC * msec_timeout) / ACE_ONE_SECOND_IN_MSECS; + result = ::sm_p (cv->sema_.sema_, SM_WAIT, ticks); # elif defined (VXWORKS) // Inline the call to ACE_OS::sema_wait () because it takes an // ACE_Time_Value argument. Avoid the cost of that conversion . . . @@ -3332,6 +3392,20 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, } result = -1; } +# elif defined (ACE_PSOS) + if (result != 0) + { + switch (result) + { + case ERR_TIMEOUT: + error = ETIME; + break; + default: + error = errno; + break; + } + result = -1; + } # elif defined (VXWORKS) if (result == ERROR) { @@ -3383,7 +3457,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, errno = error; return result; -# endif /* ACE_HAS_WTHREADS || ACE_HAS_VXWORKS */ +# endif /* ACE_HAS_WTHREADS || ACE_HAS_VXWORKS || ACE_PSOS */ # else ACE_UNUSED_ARG (cv); ACE_UNUSED_ARG (external_mutex); @@ -4250,22 +4324,40 @@ ACE_OS::accept (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen) { // ACE_TRACE ("ACE_OS::accept"); +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::accept ((ACE_SOCKET) handle, (struct sockaddr_in *) addr, + (ACE_SOCKET_LEN *) addrlen), + ACE_HANDLE, ACE_INVALID_HANDLE); +#else ACE_SOCKCALL_RETURN (::accept ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN *) addrlen), ACE_HANDLE, ACE_INVALID_HANDLE); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE int ACE_OS::bind (ACE_HANDLE handle, struct sockaddr *addr, int addrlen) { // ACE_TRACE ("ACE_OS::bind"); +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::bind ((ACE_SOCKET) handle, (struct sockaddr_in *) addr, + (ACE_SOCKET_LEN) addrlen), + int, -1); +#else ACE_SOCKCALL_RETURN (::bind ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN) addrlen), int, -1); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE int ACE_OS::connect (ACE_HANDLE handle, struct sockaddr *addr, int addrlen) { // ACE_TRACE ("ACE_OS::connect"); +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::connect ((ACE_SOCKET) handle, (struct sockaddr_in *) addr, + (ACE_SOCKET_LEN) addrlen), + int, -1); +#else ACE_SOCKCALL_RETURN (::connect ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN) addrlen), int, -1); +#endif /* defined (ACE_PSOS) */ } #if !defined (VXWORKS) @@ -4273,7 +4365,10 @@ ACE_INLINE struct hostent * ACE_OS::gethostbyname (const char *name) { // ACE_TRACE ("ACE_OS::gethostbyname"); -# if defined (ACE_HAS_NONCONST_GETBY) +# if defined (ACE_PSOS) + ACE_UNUSED_ARG (name); + ACE_NOTSUP_RETURN (0); +# elif defined (ACE_HAS_NONCONST_GETBY) ACE_SOCKCALL_RETURN (::gethostbyname ((char *) name), struct hostent *, 0); # else ACE_SOCKCALL_RETURN (::gethostbyname (name), struct hostent *, 0); @@ -4284,7 +4379,12 @@ ACE_INLINE struct hostent * ACE_OS::gethostbyaddr (const char *addr, int length, int type) { // ACE_TRACE ("ACE_OS::gethostbyaddr"); -# if defined (ACE_HAS_NONCONST_GETBY) +# if defined (ACE_PSOS) + ACE_UNUSED_ARG (addr); + ACE_UNUSED_ARG (length); + ACE_UNUSED_ARG (type); + ACE_NOTSUP_RETURN (0); +# elif defined (ACE_HAS_NONCONST_GETBY) ACE_SOCKCALL_RETURN (::gethostbyaddr ((char *) addr, (ACE_SOCKET_LEN) length, type), struct hostent *, 0); # else @@ -4352,16 +4452,22 @@ ACE_OS::recvfrom (ACE_HANDLE handle, char *buf, int len, int flags, struct sockaddr *addr, int *addrlen) { // ACE_TRACE ("ACE_OS::recvfrom"); +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::recvfrom ((ACE_SOCKET) handle, buf, (ACE_SOCKET_LEN) len, flags, + (struct sockaddr_in *) addr, (ACE_SOCKET_LEN *) addrlen), + int, -1); +#else ACE_SOCKCALL_RETURN (::recvfrom ((ACE_SOCKET) handle, buf, (ACE_SOCKET_LEN) len, flags, addr, (ACE_SOCKET_LEN *) addrlen), int, -1); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE int ACE_OS::send (ACE_HANDLE handle, const char *buf, int len, int flags) { // ACE_TRACE ("ACE_OS::send"); -#if defined (VXWORKS) || defined (HPUX) +#if defined (VXWORKS) || defined (HPUX) || defined (ACE_PSOS) ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle, (char *) buf, len, flags), int, -1); #else ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle, buf, len, flags), int, -1); @@ -4381,6 +4487,10 @@ ACE_OS::sendto (ACE_HANDLE handle, ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle, (char *) buf, len, flags, ACE_const_cast (struct sockaddr *, addr), addrlen), int, -1); +#elif defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle, (char *) buf, len, flags, + (struct sockaddr_in *) addr, addrlen), + int, -1); #else ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle, buf, len, flags, ACE_const_cast (struct sockaddr *, addr), addrlen), @@ -4393,14 +4503,20 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen) { // ACE_TRACE ("ACE_OS::getpeername"); +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::getpeername ((ACE_SOCKET) handle, (struct sockaddr_in *) addr, + (ACE_SOCKET_LEN *) addrlen), + int, -1); +#else ACE_SOCKCALL_RETURN (::getpeername ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN *) addrlen), int, -1); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE struct protoent * ACE_OS::getprotobyname (const char *name) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) +#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (0); #elif defined (ACE_HAS_NONCONST_GETBY) @@ -4417,7 +4533,7 @@ ACE_OS::getprotobyname_r (const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) +#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -4456,7 +4572,7 @@ ACE_OS::getprotobyname_r (const char *name, ACE_INLINE struct protoent * ACE_OS::getprotobynumber (int proto) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) +#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) ACE_UNUSED_ARG (proto); ACE_NOTSUP_RETURN (0); #else @@ -4470,7 +4586,7 @@ ACE_OS::getprotobynumber_r (int proto, struct protoent *result, ACE_PROTOENT_DATA buffer) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) +#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) ACE_UNUSED_ARG (proto); ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -4524,9 +4640,14 @@ ACE_OS::getsockname (ACE_HANDLE handle, int *addrlen) { // ACE_TRACE ("ACE_OS::getsockname"); - +#if defined (ACE_PSOS) + ACE_SOCKCALL_RETURN (::getsockname ((ACE_SOCKET) handle, (struct sockaddr_in *) addr, + (ACE_SOCKET_LEN *) addrlen), + int, -1); +#else ACE_SOCKCALL_RETURN (::getsockname ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN *) addrlen), int, -1); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE int @@ -4553,7 +4674,6 @@ ACE_OS::setsockopt (ACE_HANDLE handle, int level, int optname, const char *optval, int optlen) { // ACE_TRACE ("ACE_OS::setsockopt"); - ACE_SOCKCALL_RETURN (::setsockopt ((ACE_SOCKET) handle, level, optname, (ACE_SOCKOPT_TYPE1) optval, optlen), int, -1); @@ -4601,7 +4721,7 @@ ACE_OS::sendmsg (ACE_HANDLE handle, const struct msghdr *msg, int flags) { // ACE_TRACE ("ACE_OS::sendmsg"); #if !defined (ACE_LACKS_SENDMSG) -# if defined (ACE_LACKS_POSIX_PROTOTYPES) +# if defined (ACE_LACKS_POSIX_PROTOTYPES) || defined (ACE_PSOS) ACE_SOCKCALL_RETURN (::sendmsg (handle, (struct msghdr *) msg, flags), int, -1); # else ACE_SOCKCALL_RETURN (::sendmsg (handle, (ACE_SENDMSG_TYPE *) msg, flags), int, -1); @@ -4794,7 +4914,15 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type, int *h_errnop) { // ACE_TRACE ("ACE_OS::gethostbyaddr_r"); -# if defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) +# if defined (ACE_PSOS) + ACE_UNUSED_ARG (addr); + ACE_UNUSED_ARG (length); + ACE_UNUSED_ARG (type); + ACE_UNUSED_ARG (result); + ACE_UNUSED_ARG (buffer); + ACE_UNUSED_ARG (h_errnop); + ACE_NOTSUP_RETURN (0); +# elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) # if defined (AIX) || defined (DIGITAL_UNIX) || defined (HPUX_10) ::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA)); @@ -4842,7 +4970,13 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result, int *h_errnop) { // ACE_TRACE ("ACE_OS::gethostbyname_r"); -# if defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) +#if defined (ACE_PSOS) + ACE_UNUSED_ARG (name); + ACE_UNUSED_ARG (result); + ACE_UNUSED_ARG (buffer); + ACE_UNUSED_ARG (h_errnop); + ACE_NOTSUP_RETURN (0); +# elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) # if defined (DIGITAL_UNIX) ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -4947,7 +5081,7 @@ ACE_INLINE long ACE_OS::inet_addr (const char *name) { // ACE_TRACE ("ACE_OS::inet_addr"); -#if defined (VXWORKS) +#if defined (VXWORKS) || defined (ACE_PSOS) u_long ret = 0; u_int segment; @@ -4991,7 +5125,12 @@ ACE_INLINE char * ACE_OS::inet_ntoa (const struct in_addr addr) { // ACE_TRACE ("ACE_OS::inet_ntoa"); +#if defined (ACE_PSOS) + ACE_UNUSED_ARG (addr); + ACE_NOTSUP_RETURN (0); +#else ACE_OSCALL_RETURN (::inet_ntoa (addr), char *, 0); +#endif /* defined (ACE_PSOS) */ } ACE_INLINE int @@ -5041,7 +5180,11 @@ ACE_OS::signal (int signum, ACE_SignalHandler func) if (signum == 0) return 0; else -#if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_UNIX_SIGNALS) +#if defined (ACE_PSOS) && !defined (ACE_PSOS_TM) + return (ACE_SignalHandler) ::signal (signum, (void (*)(void)) func); +#elif defined (ACE_PSOS_TM) //JINLU + return (ACE_SignalHandler) ::signal (signum, (void (*)(int)) func); +#elif !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_UNIX_SIGNALS) # if !defined (ACE_HAS_TANDEM_SIGNALS) && !defined (ACE_HAS_LYNXOS_SIGNALS) return ::signal (signum, func); # else @@ -5084,6 +5227,8 @@ ACE_OS::thr_continue (ACE_hthread_t target_thread) ACE_FAIL_RETURN (-1); else return 0; +# elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_resume (target_thread), ace_result_), int, -1); # elif defined (VXWORKS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskResume (target_thread), ace_result_), int, -1); # endif /* ACE_HAS_STHREADS */ @@ -5136,7 +5281,7 @@ ACE_OS::thr_getconcurrency (void) #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_STHREADS) return ::thr_getconcurrency (); -# elif defined (ACE_HAS_PTHREADS) || defined (VXWORKS) +# elif defined (ACE_HAS_PTHREADS) || defined (VXWORKS) || defined (ACE_PSOS) ACE_NOTSUP_RETURN (-1); # elif defined (ACE_HAS_WTHREADS) ACE_NOTSUP_RETURN (-1); @@ -5192,6 +5337,9 @@ ACE_OS::thr_getprio (ACE_hthread_t thr_id, int &prio) ACE_FAIL_RETURN (-1); else return 0; +# elif defined (ACE_PSOS) + // passing a 0 in the second argument does not alter task priority, third arg gets existing one + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_setpri (thr_id, 0, (u_long *) &prio), ace_result_), int, -1); # elif defined (VXWORKS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskPriorityGet (thr_id, &prio), ace_result_), int, -1); # else @@ -5221,6 +5369,8 @@ ACE_OS::thr_self (ACE_hthread_t &self) self = ::thr_self (); # elif defined (ACE_HAS_WTHREADS) self = ::GetCurrentThread (); +# elif defined (ACE_PSOS) + t_ident ((char *) 0, 0, &self); # elif defined (VXWORKS) self = ::taskIdSelf (); # endif /* ACE_HAS_STHREADS */ @@ -5241,6 +5391,10 @@ ACE_OS::thr_self (void) ACE_OSCALL_RETURN (::thr_self (), int, -1); # elif defined (ACE_HAS_WTHREADS) return ::GetCurrentThreadId (); +# elif defined (ACE_PSOS) + // there does not appear to be a way to get + // a task's name other than at creation + return 0; # elif defined (VXWORKS) return ::taskName (::taskIdSelf ()); # endif /* ACE_HAS_STHREADS */ @@ -5312,6 +5466,10 @@ ACE_TSS_Emulation::tss_base () { # if defined (VXWORKS) return ((void **&) taskIdCurrent->spare4); +#elif defined (ACE_PSOS) + // not supported + long x=0; //JINLU + return (void **&) x; # else return tss_collection_ [ACE_OS::thr_self ()]; # endif /* VXWORKS */ @@ -5325,6 +5483,7 @@ ACE_TSS_Emulation::total_keys () return total_keys_; } + ACE_INLINE int ACE_TSS_Emulation::next_key (ACE_thread_key_t &key) @@ -5370,11 +5529,19 @@ void *& ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key) { ACE_KEY_INDEX (key_index, key); + +#if defined (ACE_PSOS) + u_long tss_base; + t_getreg (0, PSOS_TASK_REG_TSS, &tss_base); + return ((void **) tss_base)[key_index]; +#else return tss_base ()[key_index]; +#endif defined (ACE_PSOS) } #endif /* ACE_HAS_TSS_EMULATION */ + ACE_INLINE int ACE_OS::thr_getspecific (ACE_thread_key_t key, void **data) { @@ -5466,7 +5633,7 @@ ACE_OS::thr_join (ACE_thread_t waiter_id, // This could be implemented if the DLL-Main function or the // task exit base class some log the threads which have exited ACE_NOTSUP_RETURN (-1); -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (waiter_id); ACE_UNUSED_ARG (thr_id); ACE_UNUSED_ARG (status); @@ -5513,7 +5680,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle, } ACE_FAIL_RETURN (-1); /* NOTREACHED */ -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) // VxWorks could possibly support thread join with // ::taskSafe()/::taskUnsafe(). But, a task can only calls those // functions on itself. Until there's really a need . . . @@ -5562,10 +5729,6 @@ ACE_OS::thr_setcancelstate (int new_state, int *old_state) ACE_UNUSED_ARG (new_state); ACE_UNUSED_ARG (old_state); ACE_NOTSUP_RETURN (-1); -# elif defined (VXWORKS) - ACE_UNUSED_ARG (new_state); - ACE_UNUSED_ARG (old_state); - ACE_NOTSUP_RETURN (-1); # else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */ ACE_UNUSED_ARG (new_state); ACE_UNUSED_ARG (old_state); @@ -5600,18 +5763,6 @@ ACE_OS::thr_setcanceltype (int new_type, int *old_type) ace_result_), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 */ -# elif defined (ACE_HAS_STHREADS) - ACE_UNUSED_ARG (new_type); - ACE_UNUSED_ARG (old_type); - ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (new_type); - ACE_UNUSED_ARG (old_type); - ACE_NOTSUP_RETURN (-1); -# elif defined (VXWORKS) - ACE_UNUSED_ARG (new_type); - ACE_UNUSED_ARG (old_type); - ACE_NOTSUP_RETURN (-1); # else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */ ACE_UNUSED_ARG (new_type); ACE_UNUSED_ARG (old_type); @@ -5637,15 +5788,6 @@ ACE_OS::thr_cancel (ACE_thread_t thr_id) ace_result_), int, -1); # endif /* ACE_HAS_DCE_DRAFT4_THREADS */ -# elif defined (ACE_HAS_STHREADS) - ACE_UNUSED_ARG (thr_id); - ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_HAS_WTHREADS) - ACE_UNUSED_ARG (thr_id); - ACE_NOTSUP_RETURN (-1); -# elif defined (VXWORKS) - ACE_UNUSED_ARG (thr_id); - ACE_NOTSUP_RETURN (-1); # else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */ ACE_UNUSED_ARG (thr_id); ACE_NOTSUP_RETURN (-1); @@ -5664,7 +5806,7 @@ ACE_OS::sigwait (sigset_t *set, int *sig) if (sig == 0) sig = &local_sig; #if defined (ACE_HAS_THREADS) -# if defined (__FreeBSD__) || defined (CHORUS) +# if defined (__FreeBSD__) || defined (CHORUS) || defined (ACE_PSOS) ACE_UNUSED_ARG (set); ACE_NOTSUP_RETURN (-1); # elif (defined (ACE_HAS_STHREADS) && !defined (_POSIX_PTHREAD_SEMANTICS)) @@ -5724,7 +5866,7 @@ ACE_OS::thr_testcancel (void) #endif /* !ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (ACE_HAS_STHREADS) # elif defined (ACE_HAS_WTHREADS) -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) # else // no-op: can't use ACE_NOTSUP_RETURN because there is no return value # endif /* ACE_HAS_PTHREADS */ @@ -5773,7 +5915,7 @@ ACE_OS::thr_sigsetmask (int how, ace_result_), int, -1); #endif /* 0 */ -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) || defined (ACE_PSOS) ACE_UNUSED_ARG (osm); ACE_UNUSED_ARG (nsm); ACE_UNUSED_ARG (how); @@ -5833,7 +5975,7 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_kill (thr_id, signum), ace_result_), int, -1); -# elif defined (ACE_HAS_WTHREADS) +# elif defined (ACE_HAS_WTHREADS) || defined (ACE_PSOS) ACE_UNUSED_ARG (signum); ACE_UNUSED_ARG (thr_id); @@ -5886,6 +6028,10 @@ ACE_OS::thr_min_stack (void) # endif /* _SC_THREAD_STACK_MIN */ # elif defined (ACE_HAS_WTHREADS) ACE_NOTSUP_RETURN (0); +# elif defined (ACE_PSOS) + // there does not appear to be a way to get the + // task stack size except at task creation + ACE_NOTSUP_RETURN (0); # elif defined (VXWORKS) TASK_DESC taskDesc; STATUS status; @@ -5921,7 +6067,7 @@ ACE_OS::thr_setconcurrency (int hint) ACE_UNUSED_ARG (hint); ACE_NOTSUP_RETURN (-1); -# elif defined (VXWORKS) +# elif defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (hint); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_STHREADS */ @@ -5972,6 +6118,11 @@ ACE_OS::thr_setprio (ACE_hthread_t thr_id, int prio) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetThreadPriority (thr_id, prio), ace_result_), int, -1); +# elif defined (ACE_PSOS) + u_long oldprio; + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_setpri (thr_id, prio, &oldprio), + ace_result_), + int, -1); # elif defined (VXWORKS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskPrioritySet (thr_id, prio), ace_result_), @@ -6005,6 +6156,8 @@ ACE_OS::thr_suspend (ACE_hthread_t target_thread) else ACE_FAIL_RETURN (-1); /* NOTREACHED */ +# elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::t_suspend (target_thread), ace_result_), int, -1); # elif defined (VXWORKS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskSuspend (target_thread), ace_result_), int, -1); # endif /* ACE_HAS_STHREADS */ @@ -6092,7 +6245,14 @@ ACE_OS::readv (ACE_HANDLE handle, int iovlen) { // ACE_TRACE ("ACE_OS::readv"); +# if defined (ACE_PSOS) + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (iov); + ACE_UNUSED_ARG (iovlen); + ACE_NOTSUP_RETURN (-1); +# else ACE_OSCALL_RETURN (::readv (handle, iov, iovlen), ssize_t, -1); +# endif /* defined (ACE_PSOS) */ } ACE_INLINE ssize_t @@ -6101,7 +6261,14 @@ ACE_OS::writev (ACE_HANDLE handle, int iovcnt) { // ACE_TRACE ("ACE_OS::writev"); +#if defined (ACE_PSOS) + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (iov); + ACE_UNUSED_ARG (iovcnt); + ACE_NOTSUP_RETURN (-1); +#else ACE_OSCALL_RETURN (::writev (handle, (ACE_WRITEV_TYPE *) iov, iovcnt), int, -1); +#endif /* defined (ACE_PSOS) */ } #if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) @@ -6599,13 +6766,17 @@ ACE_OS::creat (LPCTSTR filename, mode_t mode) // ACE_TRACE ("ACE_OS::creat"); #if defined (ACE_WIN32) return ACE_OS::open (filename, mode); +#elif defined(ACE_PSOS_TM) + ACE_UNUSED_ARG (filename); + ACE_UNUSED_ARG (mode); + ACE_NOTSUP_RETURN (-1); #else ACE_OSCALL_RETURN (::creat (filename, mode), ACE_HANDLE, ACE_INVALID_HANDLE); #endif /* ACE_WIN32 */ } -#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (CHORUS) +#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (CHORUS) && !defined (ACE_PSOS) // Don't inline on those platforms because this function contains // string literals, and some compilers, e.g., g++, don't handle those // efficiently in unused inline functions. @@ -6741,7 +6912,7 @@ ACE_OS::alarm (u_int secs) { // ACE_TRACE ("ACE_OS::alarm"); -#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) ACE_UNUSED_ARG (secs); ACE_NOTSUP_RETURN (0); @@ -8211,6 +8382,13 @@ ACE_OS::fdopen (ACE_HANDLE handle, const char *mode) } return file; +# elif defined (ACE_PSOS) + // @@ it may be possible to implement this for pSOS, + // but it isn't obvious how to do this (perhaps via + // f_stat to glean the default volume, and then open_fn ?) + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (mode); + ACE_NOTSUP_RETURN (0); # else ACE_OSCALL_RETURN (::fdopen (handle, mode), FILE *, 0); # endif /* ACE_WIN32 */ @@ -8227,6 +8405,12 @@ ACE_OS::ftruncate (ACE_HANDLE handle, off_t offset) else ACE_FAIL_RETURN (-1); /* NOTREACHED */ +#elif defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (offset); + ACE_NOTSUP_RETURN (-1); +#elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (::ftruncate_f (handle, offset), int, -1); #else ACE_OSCALL_RETURN (::ftruncate (handle, offset), int, -1); #endif /* ACE_WIN32 */ @@ -8305,7 +8489,7 @@ ACE_OS::dup (ACE_HANDLE handle) else ACE_FAIL_RETURN (ACE_INVALID_HANDLE); /* NOTREACHED */ -#elif defined (VXWORKS) +#elif defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_HAS_WINCE) @@ -8320,7 +8504,7 @@ ACE_INLINE int ACE_OS::dup2 (ACE_HANDLE oldhandle, ACE_HANDLE newhandle) { // ACE_TRACE ("ACE_OS::dup2"); -#if defined (ACE_WIN32) || defined (VXWORKS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_PSOS) // msvcrt has _dup2 ?! ACE_UNUSED_ARG (oldhandle); ACE_UNUSED_ARG (newhandle); @@ -8556,7 +8740,7 @@ ACE_OS::getpid (void) // ACE_TRACE ("ACE_OS::getpid"); #if defined (ACE_WIN32) return ::GetCurrentProcessId (); -#elif defined (VXWORKS) +#elif defined (VXWORKS) || defined (ACE_PSOS_TM) // getpid() is not supported: just one process anyways return 0; #elif defined (CHORUS) @@ -8573,7 +8757,7 @@ ACE_OS::getpgid (pid_t pid) #if defined (ACE_LACKS_GETPGID) ACE_UNUSED_ARG (pid); ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) +#elif defined (VXWORKS) || defined (ACE_PSOS) // getpid() is not supported, only one process anyway. ACE_UNUSED_ARG (pid); return 0; @@ -8650,7 +8834,7 @@ ACE_INLINE pid_t ACE_OS::wait (int *stat_loc) { // ACE_TRACE ("ACE_OS::wait"); -#if defined (ACE_WIN32) || defined (VXWORKS) || defined(CHORUS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined(CHORUS) || defined (ACE_PSOS) ACE_UNUSED_ARG (stat_loc); ACE_NOTSUP_RETURN (0); @@ -8671,7 +8855,7 @@ ACE_INLINE pid_t ACE_OS::waitpid (pid_t pid, int *stat_loc, int options) { // ACE_TRACE ("ACE_OS::waitpid"); -#if defined (ACE_WIN32) || defined (VXWORKS) || defined(CHORUS) +#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (stat_loc); ACE_UNUSED_ARG (options); @@ -8695,6 +8879,8 @@ ACE_OS::ioctl (ACE_HANDLE handle, int cmd, void *val) // This may not work very well... ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::ioctl (handle, cmd, (int) val), ace_result_), int, -1); +#elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (::ioctl (handle, cmd, (char *) val), int, -1); #else ACE_OSCALL_RETURN (::ioctl (handle, cmd, val), int, -1); #endif /* ACE_WIN32 */ @@ -8704,7 +8890,7 @@ ACE_INLINE int ACE_OS::kill (pid_t pid, int signum) { // ACE_TRACE ("ACE_OS::kill"); -#if defined (ACE_WIN32) || defined (CHORUS) +#if defined (ACE_WIN32) || defined (CHORUS) || defined(ACE_PSOS_TM) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (signum); ACE_NOTSUP_RETURN (-1); @@ -8729,7 +8915,7 @@ ACE_OS::sigaction (int signum, osa->sa_handler = ::signal (signum, nsa->sa_handler); return osa->sa_handler == SIG_ERR ? -1 : 0; -#elif defined (CHORUS) || defined (ACE_HAS_WINCE) +#elif defined (CHORUS) || defined (ACE_HAS_WINCE) || defined(ACE_PSOS_TM) ACE_UNUSED_ARG (signum); ACE_UNUSED_ARG (nsa); ACE_UNUSED_ARG (osa); @@ -8748,6 +8934,91 @@ ACE_OS::getcwd (char *buf, size_t size) // ACE_TRACE ("ACE_OS::getcwd"); # if defined (ACE_WIN32) return ::_getcwd (buf, size); +# elif defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (buf); + ACE_UNUSED_ARG (size); + ACE_NOTSUP_RETURN ( (char*)-1); +# elif defined (ACE_PSOS) + + static char pathbuf [BUFSIZ]; + + // blank the path buffer + ACE_OS::memset (pathbuf, '\0', BUFSIZ); + + // the following was suggested in the documentation for get_fn () + u_long result; + char cur_dir_name [BUFSIZ] = "."; + + u_long cur_dir = 0, prev_dir = 0; + while ((ACE_OS::strlen (pathbuf) < BUFSIZ) && + (ACE_OS::strlen (cur_dir_name) < BUFSIZ - ACE_OS::strlen ("/.."))) + { + // get the current directory handle + result = ::get_fn (cur_dir_name, &cur_dir); + + // check whether we're at the root: this test is + // really lame, but the get_fn documentation says + // *either* condition indicates you're trying to + // move above the root. + if ((result != 0) || ( cur_dir == prev_dir)) + { + break; + } + + // change name to the parent directory + ACE_OS::strcat (cur_dir_name, "/.."); + + // open the parent directory + XDIR xdir; + result = ::open_dir (cur_dir_name, &xdir); + if (result != 0) + { + return 0; + } + + // look for an entry that matches the current directory handle + struct dirent dir_entry; + while (1) + { + // get the next directory entry + result = ::read_dir (&xdir, &dir_entry); + if (result != 0) + { + return 0; + } + + // check for a match + if (dir_entry.d_filno == cur_dir) + { + // prefix the previous path with the entry's name and break + if (ACE_OS::strlen (pathbuf) + ACE_OS::strlen (dir_entry.d_name) < BUFSIZ) + { + ACE_OS::strcpy (pathbuf + ACE_OS::strlen (dir_entry.d_name), pathbuf); + ACE_OS::strcpy (pathbuf, dir_entry.d_name); + break; + } + else + { + // we're out of room in the buffer + return 0; + } + } + } + + // close the parent directory + result = ::close_dir (&xdir); + if (result != 0) + { + return 0; + } + + // save the current directory handle as the previous + prev_dir = cur_dir; + } + + // return the path, if there is one + return (ACE_OS::strlen (pathbuf) > 0) ? pathbuf : (char *) 0; + # else ACE_OSCALL_RETURN (::getcwd (buf, size), char *, 0); # endif /* ACE_WIN32 */ @@ -8876,6 +9147,12 @@ ACE_OS::mkdir (const char *path, mode_t mode) ACE_UNUSED_ARG (mode); ACE_OSCALL_RETURN (::_mkdir (path), int, -1); +# elif defined (ACE_PSOS_LACKS_PHILE) + ACE_UNUSED_ARG (path); + ACE_UNUSED_ARG (mode); + ACE_NOTSUP_RETURN (-1); +# elif defined (ACE_PSOS) + ACE_OSCALL_RETURN (::make_dir ((char *) path, mode), int, -1); # elif defined (VXWORKS) ACE_UNUSED_ARG (mode); ACE_OSCALL_RETURN (::mkdir ((char *) path), int, -1); @@ -8903,13 +9180,13 @@ ACE_OS::putenv (const char *string) { // ACE_TRACE ("ACE_OS::putenv"); // VxWorks declares ::putenv with a non-const arg. -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) && !defined (ACE_PSOS) ACE_OSCALL_RETURN (::putenv ((char *) string), int, -1); #else - // @@ WinCE doesn't have the concept of environment variables. + // @@ WinCE and pSOS don't have the concept of environment variables. ACE_UNUSED_ARG (string); ACE_NOTSUP_RETURN (-1); -#endif /* ! ACE_HAS_WINCE */ +#endif /* ! ACE_HAS_WINCE && ! ACE_PSOS */ } ACE_INLINE @@ -9930,6 +10207,17 @@ putchar (int c) #endif /* ACE_HAS_WINCE */ +#if defined (ACE_PSOS) +#if defined (fileno) +#undef fileno +ACE_INLINE ACE_HANDLE +fileno (FILE *fp) +{ + return (ACE_HANDLE) fp; +} +#endif /* defined (fileno)*/ +#endif /* defined (ACE_PSOS) */ + ACE_INLINE ACE_Cleanup::ACE_Cleanup (void) { @@ -9939,3 +10227,4 @@ ACE_INLINE ACE_Cleanup::~ACE_Cleanup (void) { } + diff --git a/ace/Object_Manager.h b/ace/Object_Manager.h index 88edc6a33df..56ecd7c78ff 100644 --- a/ace/Object_Manager.h +++ b/ace/Object_Manager.h @@ -58,7 +58,13 @@ class ACE_Export ACE_Object_Manager_Base // // = DESCRIPTION // Encapsulates the most useful ACE_Object_Manager data structures. +# if defined (ACE_PSOS) && defined (__DIAB) +// the Diab compiler got confused and complained about access rights +// if this section was protected (changing this to public makes it happy) +public: +# else /* ! defined (ACE_PSOS) && defined (__DIAB) */ protected: +# endif /* ! defined (ACE_PSOS) && defined (__DIAB) */ ACE_Object_Manager_Base (void); // Default constructor. diff --git a/ace/Process.cpp b/ace/Process.cpp index 44dfbfac1a1..82b54091e8b 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -85,7 +85,7 @@ ACE_Process::spawn (ACE_Process_Options &options) // If we must, set the working directory for the child process. if (options.working_directory () != 0) - ::chdir (options.working_directory ()); + ACE_OS::chdir (options.working_directory ()); // Child process executes the command. int result; @@ -112,7 +112,7 @@ ACE_Process::spawn (ACE_Process_Options &options) if (result == -1) { // If the execv fails, this child needs to exit. - + // Exit with the errno so that the calling process can // catch this and figure out what went wrong. ACE_OS::exit (errno); diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp index 59f351831a2..4da37aa61f5 100644 --- a/ace/Remote_Name_Space.cpp +++ b/ace/Remote_Name_Space.cpp @@ -49,7 +49,7 @@ ACE_Remote_Name_Space::bind (const ACE_WString &name, type, ACE_OS::strlen (type)); int result = this->ns_proxy_.request_reply (request); - return result == ACE_Name_Reply::SUCCESS ? 0 : result; + return result == ACE_Name_Reply::ACE_SUCCESS ? 0 : result; } int @@ -65,7 +65,7 @@ ACE_Remote_Name_Space::rebind (const ACE_WString &name, type, ACE_OS::strlen (type)); int result = this->ns_proxy_.request_reply (request); - return result == ACE_Name_Reply::SUCCESS ? 0 : result; + return result == ACE_Name_Reply::ACE_SUCCESS ? 0 : result; } int @@ -103,7 +103,7 @@ ACE_Remote_Name_Space::unbind (const ACE_WString &name) 0, 0, 0, 0); int result = this->ns_proxy_.request_reply (request); - return result == ACE_Name_Reply::SUCCESS ? 0 : result; + return result == ACE_Name_Reply::ACE_SUCCESS ? 0 : result; } int diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp index 3b75197690c..522131ecaa3 100644 --- a/ace/SOCK_Dgram_Mcast.cpp +++ b/ace/SOCK_Dgram_Mcast.cpp @@ -29,7 +29,13 @@ ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast (void) int ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr, int reuse_addr, +#if defined (ACE_PSOS) + // pSOS supports numbers, not + // names for network interfaces + long net_if, +#else const ASYS_TCHAR *net_if, +#endif /* defined (ACE_PSOS) */ int protocol_family, int protocol) { @@ -158,7 +164,14 @@ ACE_SOCK_Dgram_Mcast::unsubscribe (void) int ACE_SOCK_Dgram_Mcast::make_multicast_address (const ACE_INET_Addr &mcast_addr, - const ASYS_TCHAR *net_if) +#if defined (ACE_PSOS) + // pSOS supports numbers, not + // names for network interfaces + long net_if +#else + const ASYS_TCHAR *net_if +#endif /* defined (ACE_PSOS) */ + ) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::make_multicast_address"); @@ -167,7 +180,12 @@ ACE_SOCK_Dgram_Mcast::make_multicast_address (const ACE_INET_Addr &mcast_addr, #if !defined (ACE_WIN32) struct ifreq if_address; +#if defined (ACE_PSOS) + // look up the interface by number, not name + if_address.ifr_ifno = net_if; +#else ACE_OS::strcpy (if_address.ifr_name, net_if); +#endif /* defined (ACE_PSOS) */ if (ACE_OS::ioctl (this->get_handle (), SIOCGIFADDR, &if_address) == -1) return -1; @@ -189,6 +207,10 @@ ACE_SOCK_Dgram_Mcast::make_multicast_address (const ACE_INET_Addr &mcast_addr, else multicast_address_.imr_interface.s_addr = INADDR_ANY; +#if defined (ACE_PSOS) && !defined (ACE_PSOS_TM) + multicast_address_.imr_mcastaddr.s_addr = htonl (mcast_addr.get_ip_address ()); +#else multicast_address_.imr_multiaddr.s_addr = htonl (mcast_addr.get_ip_address ()); +#endif /* defined (ACE_PSOS) */ return 0; } diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h index 4e2f8165142..c2d68ef5976 100644 --- a/ace/SOCK_Dgram_Mcast.h +++ b/ace/SOCK_Dgram_Mcast.h @@ -41,7 +41,12 @@ public: int subscribe (const ACE_INET_Addr &mcast_addr, int reuse_addr = 1, +#if defined (ACE_PSOS) + // pSOS supports numbers, not names for network interfaces + long net_if = 0, +#else const ASYS_TCHAR *net_if = 0, +#endif /* defined (ACE_PSOS) */ int protocol_family = PF_INET, int protocol = 0); // Join a multicast group by telling the network interface device @@ -98,7 +103,14 @@ private: int flags = 0) const; int make_multicast_address (const ACE_INET_Addr &mcast_addr, - const ASYS_TCHAR *net_if = ASYS_TEXT ("le0")); +#if defined (ACE_PSOS) + // pSOS supports numbers, not + // names for network interfaces + long net_if = 0 +#else + const ASYS_TCHAR *net_if = ASYS_TEXT ("le0") +#endif /* defined (ACE_PSOS) */ + ); // Initialize a multicast address. ACE_INET_Addr mcast_addr_; diff --git a/ace/Service_Types.cpp b/ace/Service_Types.cpp index 866ef992628..e783c40966c 100644 --- a/ace/Service_Types.cpp +++ b/ace/Service_Types.cpp @@ -413,7 +413,6 @@ template class ACE_Thru_Task<ACE_SYNCH>; #pragma instantiate ACE_Stream_Tail<ACE_SYNCH> #pragma instantiate ACE_Task<ACE_SYNCH> #pragma instantiate ACE_Thru_Task<ACE_SYNCH> - // Even with threads, these ACE_NULL_SYNCH specializations are necessary. #if defined (ACE_HAS_THREADS) #pragma instantiate ACE_Message_Queue<ACE_NULL_SYNCH> diff --git a/ace/Signal.cpp b/ace/Signal.cpp index e59b2b93f79..39862db2def 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -285,7 +285,11 @@ ACE_Sig_Handler::remove_handler (int signum, if (ACE_Sig_Handler::in_range (signum)) { +#if defined (ACE_PSOS) + ACE_Sig_Action sa ((ACE_SignalHandler) 0, (sigset_t *) 0); +#else ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); // Define the default disposition. +#endif /* defined (ACE_PSOS) */ if (new_disp == 0) new_disp = &sa; @@ -331,7 +335,11 @@ ACE_Sig_Handler::dispatch (int signum, if (eh != 0 && eh->handle_signal (signum, siginfo, ucontext) == -1) { // Define the default disposition. +#if defined (ACE_PSOS) + ACE_Sig_Action sa ((ACE_SignalHandler) 0, (sigset_t *) 0); +#else ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); +#endif /* defined (ACE_PSOS) */ ACE_Sig_Handler::signal_handlers_[signum] = 0; @@ -639,7 +647,11 @@ ACE_Sig_Handlers::remove_handler (int signum, // register the new disposition or restore the default // disposition. +#if defined (ACE_PSOS) + ACE_Sig_Action sa ((ACE_SignalHandler) 0, (sigset_t *) 0); +#else ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); +#endif /* defined (ACE_PSOS) */ if (new_disp == 0) new_disp = &sa; diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index dfabd6b5f7a..a3a037cdc3e 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -841,5 +841,8 @@ ACE_TSS_Read_Guard<ACE_LOCK>::dump (void) const ACE_TSS_Guard<ACE_LOCK>::dump (); } + #endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ + #endif /* ACE_SYNCH_T_C */ + diff --git a/ace/Synch_T.h b/ace/Synch_T.h index 91951d8759a..ad181e51cd9 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -365,6 +365,40 @@ class ACE_Guard // the very least the <acquire>, <tryacquire>, <release>, and // <remove> methods. public: + +#if defined (ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE) + + // = Initialization and termination methods. + ACE_Guard (ACE_LOCK &l); + + ACE_Guard (ACE_LOCK &l, int block); + // Implicitly and automatically acquire (or try to acquire) the + // lock. + + ~ACE_Guard (void); + // Implicitly release the lock. + + // = Lock accessors. + + int acquire (void); + // Explicitly acquire the lock. + + int tryacquire (void); + // Conditionally acquire the lock (i.e., won't block). + + int release (void); + // Explicitly release the lock, but only if it is held! + + // = Utility methods. + int locked (void); + // 1 if locked, 0 if couldn't acquire the lock + // (errno will contain the reason for this). + + int remove (void); + // Explicitly remove the lock. + +#else + // = Initialization and termination methods. ACE_Guard (ACE_LOCK &l): lock_ (&l) { @@ -417,6 +451,8 @@ public: int remove (void) { return this->lock_->remove (); } // Explicitly remove the lock. +#endif /* defined (ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE) */ + void dump (void) const; // Dump the state of an object. @@ -424,6 +460,7 @@ public: // Declare the dynamic allocation hooks. protected: + ACE_Guard (ACE_LOCK *lock): lock_ (lock) {} // Helper, meant for subclass only. diff --git a/ace/Synch_T.i b/ace/Synch_T.i index 1c3eef7deff..ac1d32e2f3b 100644 --- a/ace/Synch_T.i +++ b/ace/Synch_T.i @@ -5,6 +5,78 @@ #include "ace/Thread.h" +#if defined (ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE) + +template <class ACE_LOCK> ACE_INLINE +ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l) + : lock_ (&l) +{ + this->acquire (); +} + +template <class ACE_LOCK> ACE_INLINE +ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l, int block) + : lock_ (&l) +{ + if (block) + this->acquire (); + else + this->tryacquire (); +} +// Implicitly and automatically acquire (or try to acquire) the +// lock. + +template <class ACE_LOCK> ACE_INLINE +ACE_Guard<ACE_LOCK>::~ACE_Guard (void) +{ + this->release (); +} +// Implicitly release the lock. + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::acquire (void) +{ + return this->owner_ = this->lock_->acquire (); +} +// Explicitly acquire the lock. + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::tryacquire (void) +{ + return this->owner_ = this->lock_->tryacquire (); +} +// Conditionally acquire the lock (i.e., won't block). + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::release (void) +{ + if (this->owner_ != -1) + { + this->owner_ = -1; + return this->lock_->release (); + } + else + return 0; +} +// Explicitly release the lock, but only if it is held! + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::locked (void) +{ + return this->owner_ != -1; +} +// 1 if locked, 0 if couldn't acquire the lock +// (errno will contain the reason for this). + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::remove (void) +{ + return this->lock_->remove (); +} +// Explicitly remove the lock. + +#endif /* defined (ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE) */ + template <class ACE_LOCKING_MECHANISM> ACE_INLINE ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (ACE_LOCKING_MECHANISM &lock) : lock_ (&lock), diff --git a/ace/Timer_Hash.cpp b/ace/Timer_Hash.cpp index 3f070859e2f..e08ec900b31 100644 --- a/ace/Timer_Hash.cpp +++ b/ace/Timer_Hash.cpp @@ -68,6 +68,7 @@ template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, ACE_Hash_Timer_Heap>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Timer_Node_T<ACE_Event_Handler *> #pragma instantiate ACE_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *> > #pragma instantiate ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *>, \ ACE_Null_Mutex> diff --git a/ace/Token_Request_Reply.h b/ace/Token_Request_Reply.h index 0161668b08e..a8cdd458e2e 100644 --- a/ace/Token_Request_Reply.h +++ b/ace/Token_Request_Reply.h @@ -174,7 +174,7 @@ class ACE_Export ACE_Token_Reply public: enum Constants { - SUCCESS = 0 // this MUST be zero!!! + ACE_SUCCESS = 0 // this MUST be zero!!! }; ACE_Token_Reply (void); diff --git a/ace/UPIPE_Stream.cpp b/ace/UPIPE_Stream.cpp index 2fb191dddea..73a87104434 100644 --- a/ace/UPIPE_Stream.cpp +++ b/ace/UPIPE_Stream.cpp @@ -222,6 +222,15 @@ ACE_UPIPE_Stream::recv_n (char *buf, return bytes_read; } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Module<ACE_Thread_Mutex, ACE_Condition_Thread_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Module<ACE_Thread_Mutex, ACE_Condition_Thread_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_THREADS */ - diff --git a/ace/config-psos-diab.h b/ace/config-psos-diab.h new file mode 100644 index 00000000000..40a22853ffd --- /dev/null +++ b/ace/config-psos-diab.h @@ -0,0 +1,200 @@ +/* -*- C++ -*- */ +// $Id$ + +// The following configuration file is designed to work for pSOSystem V2.2.1, +// using the Diab Data D-C++ 4.2 p3 compiler (or a later version) + +#if !defined (ACE_CONFIG_H) +#define ACE_CONFIG_H + +// #if ! defined (__ACE_INLINE__) +// # define __ACE_INLINE__ +// #endif /* ! __ACE_INLINE__ */ +#if defined (__ACE_INLINE__) +# undef __ACE_INLINE__ +#endif /* __ACE_INLINE__ */ + +#define ACE_LACKS_INLINE_FUNCTIONS + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_PSOS_LACKS_PREPC + +#define ACE_HAS_STRDUP_EMULATION + +#define ACE_HAS_IP_MULTICAST + +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS + +#define ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR + +# define ACE_HAS_BROKEN_NOOP_DTORS + +// Template instantiation definitions +// #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_FILE +#define ACE_TEMPLATES_REQUIRE_SOURCE +#define ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE + +/* #define ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION */ + +#define ACE_LACKS_HRTIME_T + +// #define ACE_LACKS_EVENT_T + +#define ACE_HAS_VERBOSE_NOTSUP + +#define ACE_LACKS_MEMORY_H + +// #define ACE_LACKS_MALLOC_H + +#define ACE_LACKS_MMAP + +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS + +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#define ACE_LACKS_SEMBUF_T + +#define ACE_LACKS_EXEC + +#define ACE_LACKS_FORK + +#define ACE_NEEDS_WRITEV + +#define ACE_NEEDS_READV + +// rename the main entry point +// #define ACE_MAIN extern "C" void root + +// All this was commented out for the single threaded port + +#define ACE_HAS_THREADS + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#define ACE_HAS_TSS_EMULATION + +#define ACE_DEFAULT_THREAD_KEYS 256 + +#define ACE_HAS_MT_SAFE_SOCKETS + +#define ACE_LACKS_COND_T + +// #define ACE_HAS_TSS_EMULATION + +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK + +/* #define ACE_HAS_BROKEN_SENDMSG */ + +/* #define ACE_HAS_BROKEN_WRITEV */ + +#define ACE_HAS_BROKEN_CONVERSIONS + +#define ACE_HAS_CHARPTR_SOCKOPT + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_MSG + +#define ACE_HAS_POSIX_NONBLOCK + +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_SIGINFO_IS_SIGINFO_T + +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_SIG_ATOMIC_T + +#define ACE_HAS_STRERROR + +#define ACE_LACKS_ACCESS + +#define ACE_LACKS_GETHOSTENT + +#define ACE_LACKS_GETSERVBYNAME + +#define ACE_LACKS_IOSTREAM_FX + +#define ACE_LACKS_KEY_T + +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#define ACE_LACKS_LONGLONG_T + +#define ACE_LACKS_MADVISE + +#define ACE_LACKS_MKTEMP + +#define ACE_LACKS_MPROTECT + +#define ACE_LACKS_MSYNC + +#define ACE_LACKS_PARAM_H + +#define ACE_LACKS_PWD_FUNCTIONS + +#define ACE_LACKS_RLIMIT + +#define ACE_LACKS_RPC_H + +#define ACE_LACKS_RWLOCK_T + +#define ACE_LACKS_SBRK + +#define ACE_LACKS_SIGNED_CHAR + +#define ACE_LACKS_SI_ADDR + +#define ACE_LACKS_SOCKETPAIR + +#define ACE_LACKS_STRCASECMP + +#define ACE_LACKS_STRRECVFD + +#define ACE_LACKS_SYSCALL + +#define ACE_LACKS_SYSV_MSG_H + +#define ACE_LACKS_SYSV_SHMEM + +// #define ACE_LACKS_SYS_NERR + +#define ACE_LACKS_SYS_TYPES_H + +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_UCONTEXT_H + +#define ACE_LACKS_UNIX_SIGNALS + +// #define ACE_MALLOC_ALIGN 8 +// #define ACE_NEEDS_SYSTIME_H + +#define ACE_PAGE_SIZE 4096 + +#if !defined (ACE_NTRACE) +# define ACE_NTRACE 1 +#endif /* ACE_NTRACE */ + +#define ACE_PSOS_CANT_USE_SYS_TYPES + +#define ACE_PSOS_SNARFS_HEADER_INFO + +#if !defined (ACE_PSOS) +#define ACE_PSOS +#endif /* ACE_PSOS */ + +#if !defined (ACE_PSOS_TBD) +#define ACE_PSOS_TBD +#endif /* ACE_PSOS_TBD */ + +#endif /* ACE_CONFIG_H */ diff --git a/ace/config-psos-tm.h b/ace/config-psos-tm.h new file mode 100644 index 00000000000..0825debf8f0 --- /dev/null +++ b/ace/config-psos-tm.h @@ -0,0 +1,206 @@ +/* -*- C++ -*- */ +// $Id$ + +// The following configuration file is designed to work for pSOSystem V2.2.1, +// using the Diab Data D-C++ 4.1a compiler + +#if !defined (ACE_CONFIG_H) +#define ACE_CONFIG_H + +// #if ! defined (__ACE_INLINE__) +// # define __ACE_INLINE__ +// #endif /* ! __ACE_INLINE__ */ +#if defined (__ACE_INLINE__) +# undef __ACE_INLINE__ +#endif /* __ACE_INLINE__ */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_HAS_STRDUP_EMULATION + +#define ACE_HAS_IP_MULTICAST + +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR + +// Template instantiation definitions +// #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_FILE +#define ACE_TEMPLATES_REQUIRE_SOURCE +#define ACE_LACKS_METHOD_DEFINITIONS_IN_CLASS_TEMPLATE + +#include <signal.h> //JINLU +#include <pna.h> //JINLU +#define NSIG _NSIG //_NSIG = 32 defined in signal.h JINLU +#define TCP_NODELAY 1 // this will be defined later by pSOS/TM + +/* #define ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION */ + +#define ACE_LACKS_HRTIME_T + +// #define ACE_LACKS_EVENT_T + +#define ACE_HAS_VERBOSE_NOTSUP + +#define ACE_LACKS_MEMORY_H + +// #define ACE_LACKS_MALLOC_H + +#define ACE_LACKS_MMAP + +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS + +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#define ACE_LACKS_SEMBUF_T + +#define ACE_LACKS_EXEC + +#define ACE_LACKS_FORK + +#define ACE_NEEDS_WRITEV + +#define ACE_NEEDS_READV + +// rename the main entry point +// #define ACE_MAIN extern "C" void root + +// All this was commented out for the single threaded port + +#define ACE_HAS_THREADS + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#define ACE_HAS_TSS_EMULATION + +#define ACE_DEFAULT_THREAD_KEYS 256 + +#define ACE_HAS_MT_SAFE_SOCKETS + +#define ACE_LACKS_COND_T + +// #define ACE_HAS_TSS_EMULATION + +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK + +/* #define ACE_HAS_BROKEN_SENDMSG */ + +/* #define ACE_HAS_BROKEN_WRITEV */ + +#define ACE_HAS_BROKEN_CONVERSIONS + +#define ACE_HAS_CHARPTR_SOCKOPT + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_MSG + +#define ACE_HAS_POSIX_NONBLOCK + +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_SIGINFO_IS_SIGINFO_T + +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_SIG_ATOMIC_T + +#define ACE_HAS_STRERROR + +#define ACE_LACKS_ACCESS + +#define ACE_LACKS_GETHOSTENT + +#define ACE_LACKS_GETSERVBYNAME + +#define ACE_LACKS_IOSTREAM_FX + +#define ACE_LACKS_KEY_T + +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#define ACE_LACKS_LONGLONG_T + +#define ACE_LACKS_MADVISE + +#define ACE_LACKS_MKTEMP + +#define ACE_LACKS_MPROTECT + +#define ACE_LACKS_MSYNC + +#define ACE_LACKS_PARAM_H + +#define ACE_LACKS_PWD_FUNCTIONS + +#define ACE_LACKS_RLIMIT + +#define ACE_LACKS_RPC_H + +#define ACE_LACKS_RWLOCK_T + +#define ACE_LACKS_SBRK + +#define ACE_LACKS_SIGNED_CHAR + +#define ACE_LACKS_SI_ADDR + +#define ACE_LACKS_SOCKETPAIR + +#define ACE_LACKS_STRCASECMP + +#define ACE_LACKS_STRRECVFD + +#define ACE_LACKS_SYSCALL + +#define ACE_LACKS_SYSV_MSG_H + +#define ACE_LACKS_SYSV_SHMEM + +#define ACE_LACKS_SYS_NERR // psos/tm does not have sys_nerr + +#define ACE_LACKS_SYS_TYPES_H + +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_UCONTEXT_H + +#define ACE_LACKS_UNIX_SIGNALS + +// #define ACE_MALLOC_ALIGN 8 +// #define ACE_NEEDS_SYSTIME_H + +#define ACE_PAGE_SIZE 4096 + +#if !defined (ACE_NTRACE) +# define ACE_NTRACE 1 +#endif /* ACE_NTRACE */ + +#define ACE_PSOS_TM +#define ACE_PSOS_PROVIDES_ERROR_SYMBOLS_TM +#define USER_INCLUDE_SYS_TIME_TM +#define ACE_LACKS_FILELOCKS +#define ACE_LACKS_SIGSET +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_FCNTL +#define ACE_PSOS_LACKS_PHILE +#define ACE_PSOS_LACKS_PREPC +#define ACE_PSOS_CANT_USE_SYS_TYPES + +//#define ACE_PSOS_SNARFS_HEADER_INFO + +#if !defined (ACE_PSOS) +#define ACE_PSOS +#endif /* ACE_PSOS */ + +#if !defined (ACE_PSOS_TBD) +#define ACE_PSOS_TBD +#endif /* ACE_PSOS_TBD */ + +#endif /* ACE_CONFIG_H */ |