diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-21 22:43:24 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-04-21 22:43:24 +0000 |
commit | 1b2276da2110d08dfb38bf6f64000a293e1fe421 (patch) | |
tree | 2547fd491d04980a0407e42fa48de5d98d172c25 /ace | |
parent | 993bea83732043d16f512b0423f3a0f3669c48f5 (diff) | |
download | ATCD-1b2276da2110d08dfb38bf6f64000a293e1fe421.tar.gz |
ChangeLogTag:Sat Apr 21 15:31:27 2001 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ACE.cpp | 1 | ||||
-rw-r--r-- | ace/Basic_Types.h | 4 | ||||
-rw-r--r-- | ace/Configuration.cpp | 64 | ||||
-rw-r--r-- | ace/Handle_Gobbler.i | 7 | ||||
-rw-r--r-- | ace/Lib_Find.cpp | 1 | ||||
-rw-r--r-- | ace/Local_Name_Space_T.cpp | 5 | ||||
-rw-r--r-- | ace/Log_Msg.cpp | 12 | ||||
-rw-r--r-- | ace/Makefile | 5 | ||||
-rw-r--r-- | ace/Mem_Map.cpp | 16 | ||||
-rw-r--r-- | ace/Memory_Pool.cpp | 8 | ||||
-rw-r--r-- | ace/Message_Queue.i | 2 | ||||
-rw-r--r-- | ace/NT_Service.cpp | 22 | ||||
-rw-r--r-- | ace/OS.cpp | 56 | ||||
-rw-r--r-- | ace/OS.h | 19 | ||||
-rw-r--r-- | ace/OS.i | 15 | ||||
-rw-r--r-- | ace/OS_String.cpp | 18 | ||||
-rw-r--r-- | ace/Process.cpp | 45 | ||||
-rw-r--r-- | ace/Process_Manager.cpp | 5 | ||||
-rw-r--r-- | ace/Registry.cpp | 22 | ||||
-rw-r--r-- | ace/SOCK_Connector.i | 9 | ||||
-rw-r--r-- | ace/Sock_Connect.cpp | 321 | ||||
-rw-r--r-- | ace/TTY_IO.cpp | 8 | ||||
-rw-r--r-- | ace/WFMO_Reactor.cpp | 31 | ||||
-rw-r--r-- | ace/WFMO_Reactor.i | 5 | ||||
-rw-r--r-- | ace/WIN32_Asynch_IO.cpp | 20 | ||||
-rw-r--r-- | ace/config-cygwin32-common.h | 85 | ||||
-rw-r--r-- | ace/config-g++-common.h | 10 | ||||
-rw-r--r-- | ace/config-win32-common.h | 27 | ||||
-rw-r--r-- | ace/config-win32-mingw.h | 64 | ||||
-rw-r--r-- | ace/config-win32.h | 6 | ||||
-rw-r--r-- | ace/streams.h | 1 |
31 files changed, 674 insertions, 240 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index b4a4bab492a..9e2036c215f 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -2572,6 +2572,7 @@ ACE::handle_timed_complete (ACE_HANDLE h, // ready for writing, which may indicate a problem. But we need to // make sure... #if defined (ACE_WIN32) + ACE_UNUSED_ARG (is_tli); need_to_check = rd_handles.is_set (h) || ex_handles.is_set (h); #elif defined (VXWORKS) ACE_UNUSED_ARG (is_tli); diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index 0f51a9909c5..359798cfabd 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -171,7 +171,6 @@ # endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ # endif /* !defined (ACE_SIZEOF_LONG_LONG) */ - // The sizes of the commonly implemented types are now known. Set up // typedefs for whatever we can. Some of these are needed for certain cases // of ACE_UINT64, so do them before the 64-bit stuff. @@ -447,6 +446,9 @@ typedef ACE_UINT16 ACE_USHORT16; # if defined (__IBMCPP__) && (__IBMCPP__ >= 400) # define ACE_UINT64_LITERAL(n) n ## LL # define ACE_INT64_LITERAL(n) n ## LL +# elif defined (__MINGW32__) +# define ACE_UINT64_LITERAL(n) n ## ull +# define ACE_INT64_LITERAL(n) n ## ll # else # define ACE_UINT64_LITERAL(n) n ## ui64 # define ACE_INT64_LITERAL(n) n ## i64 diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp index b2b5fbc306e..682a37ac983 100644 --- a/ace/Configuration.cpp +++ b/ace/Configuration.cpp @@ -234,7 +234,7 @@ ACE_Configuration::root_section (void) const } /** - * Determine if the contents of this object is the same as the + * Determine if the contents of this object is the same as the * contents of the object on the right hand side. * Returns 1 (True) if they are equal and 0 (False) if they are not equal */ @@ -251,7 +251,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const ACE_Configuration_Section_Key thisSection; // loop through each section in this object - while ((rc) && nonconst_this->enumerate_sections (this->root_, + while ((rc) && nonconst_this->enumerate_sections (this->root_, sectionIndex, sectionName)) { @@ -265,9 +265,9 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const // not equal. rc = 0; } - else if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, + else if (nonconst_this->open_section (this->root_, + sectionName.c_str (), + 0, thisSection) != 0) { // if there is some error opening the section in this object @@ -282,7 +282,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const VALUETYPE rhsType; // Enumerate each value in this section - while ((rc) && nonconst_this->enumerate_values (thisSection, + while ((rc) && nonconst_this->enumerate_values (thisSection, valueIndex, valueName, valueType)) @@ -292,7 +292,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const valueName.c_str (), rhsType) != 0) { - // We're not equal if the same value cannot + // We're not equal if the same value cannot // be found in the rhs object. rc = 0; } @@ -378,12 +378,12 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const { rc = (* (thisCharData + count) == * (rhsCharData + count)); } - }// end if the length's match + }// end if the length's match } // We should never have valueTypes of INVALID, therefore - // we're not comparing them. How would we since we have - // no get operation for invalid types. - // So, if we have them, we guess they are equal. + // we're not comparing them. How would we since we have + // no get operation for invalid types. + // So, if we have them, we guess they are equal. }// end else if values match. @@ -404,7 +404,7 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const valueName.c_str (), valueType) != 0) { - // We're not equal if the same value cannot + // We're not equal if the same value cannot // be found in the rhs object. rc = 0; } @@ -421,14 +421,14 @@ int ACE_Configuration::operator== (const ACE_Configuration& rhs) const // exist in this sectionIndex = 0; while ((rc) && - (!nonconst_rhs.enumerate_sections (rhsRoot, - sectionIndex, + (!nonconst_rhs.enumerate_sections (rhsRoot, + sectionIndex, sectionName))) { // find the section in this - if (nonconst_this->open_section (this->root_, - sectionName.c_str (), - 0, + if (nonconst_this->open_section (this->root_, + sectionName.c_str (), + 0, thisSection) != 0) { // if there is some error opening the section in this object @@ -512,7 +512,12 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K KEY_ALL_ACCESS, NULL, &result_key, - NULL) != ERROR_SUCCESS) +#if defined(__MINGW32__) + (PDWORD) 0 +#else + NULL +#endif /* __MINGW32__ */ + ) != ERROR_SUCCESS) return -3; } @@ -803,13 +808,13 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti name, NULL, &type, - (BYTE*)data, + (BYTE*)data, &buffer_length) != ERROR_SUCCESS) - { - delete data; - data = 0; - return -5; - } + { + delete data; + data = 0; + return -5; + } return 0; } @@ -919,13 +924,18 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey, // try creating it if (!create || ACE_TEXT_RegCreateKeyEx (result, key.fast_rep (), + 0, NULL, - NULL, - NULL, + 0, KEY_ALL_ACCESS, NULL, &subkey, - NULL) != ERROR_SUCCESS) +#if defined(__MINGW32__) + (PDWORD) 0 +#else + NULL +#endif /* __MINGW32__ */ + ) != ERROR_SUCCESS) { // error ::RegCloseKey (result); diff --git a/ace/Handle_Gobbler.i b/ace/Handle_Gobbler.i index a8313f08cb4..f4af340a012 100644 --- a/ace/Handle_Gobbler.i +++ b/ace/Handle_Gobbler.i @@ -1,6 +1,6 @@ // $Id$ -// Since this is only included in Handle_Gobbler.h, these should be +// Since this is only included in Handle_Gobbler.h, these should be // inline, not ACE_INLINE. // FUZZ: disable check_for_inline @@ -53,8 +53,11 @@ ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available) { int result = 0; +#if defined(ACE_WIN32) // On Win32, this style of gobbling doesn't seem to work. -#if !defined (ACE_WIN32) + ACE_UNUSED_ARG(n_handles_to_keep_available); + +#else while (1) { diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp index 51765c1cb93..3d735359e75 100644 --- a/ace/Lib_Find.cpp +++ b/ace/Lib_Find.cpp @@ -428,6 +428,7 @@ ACE_HANDLE ACE_Lib_Find::open_temp_file (const ACE_TCHAR *name, int mode, int perm) { #if defined (ACE_WIN32) + ACE_UNUSED_ARG(perm); return ACE_OS::open (name, mode | _O_TEMPORARY); #else diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index a341a4b9c41..eb049870012 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -404,7 +404,12 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void) ACE_OS::strcat (this->context_file_, database); #if !defined (CHORUS) +# if defined(ACE_WIN32) && \ + (!defined(ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0)) + ACE_MEM_POOL_OPTIONS options (this->name_options_->base_address (), 0); +# else ACE_MEM_POOL_OPTIONS options (this->name_options_->base_address ()); +# endif /* !ACE_HAS_WINNT4 */ #else // Use base address == 0, don't use a fixed address. ACE_MEM_POOL_OPTIONS options (0, diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 30fe7f6aea8..c58b8a55b19 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -115,7 +115,7 @@ int ACE_Log_Msg_Manager::init_backend (const u_long *flags) ACE_Log_Msg_Manager::log_backend_flags_ = *flags; } - + if (ACE_Log_Msg_Manager::log_backend_ == 0) { ACE_NO_HEAP_CHECK; @@ -792,9 +792,12 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, ACE_TRACE ("ACE_Log_Msg::log"); // External decls. -#if ! (defined(__BORLANDC__) && __BORLANDC__ >= 0x0530) +#if ! (defined(__BORLANDC__) && __BORLANDC__ >= 0x0530) \ + && !defined(__MINGW32__) #if defined (__FreeBSD__) || defined(__QNX__) extern const int sys_nerr; +#elif defined (__CYGWIN32__) +# define sys_nerr _sys_nerr #else extern int sys_nerr; #endif /* !__FreeBSD__ && !__QNX__ */ @@ -1144,7 +1147,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, case 't': // Format thread id. type = SKIP_SPRINTF; #if defined (ACE_WIN32) - ACE_OS::sprintf (bp, ACE_LIB_TEXT ("%u"), ACE_Thread::self ()); + ACE_OS::sprintf (bp, + ACE_LIB_TEXT ("%u"), + ACE_static_cast(unsigned, + ACE_Thread::self ())); #elif defined (AIX) && (ACE_AIX_MINOR_VERS <= 2) // AIX's pthread_t (ACE_hthread_t) is a pointer, and it's // a little ugly to send that through a %u format. So, diff --git a/ace/Makefile b/ace/Makefile index 9532a44f509..fe169767ecc 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -66,6 +66,7 @@ LOGGING_FILES = \ Log_Msg_Callback \ Log_Msg_Backend \ Log_Msg_IPC \ + Log_Msg_NT_Event_Log \ Log_Record \ Logging_Strategy \ Trace @@ -91,6 +92,7 @@ DEMUX_FILES = \ Handle_Set \ Msg_WFMO_Reactor \ POSIX_Proactor \ + WIN32_Proactor \ Priority_Reactor \ Proactor \ Reactor \ @@ -106,6 +108,7 @@ CONNECTION_FILES = \ Asynch_IO \ Asynch_IO_Impl \ POSIX_Asynch_IO \ + WIN32_Asynch_IO \ Strategies SOCKETS_FILES = \ Addr \ @@ -317,7 +320,7 @@ endif # ACE_HAS_GNUG_PRE_2_8 ## if we have the RAPI library installed ifeq ($(rapi),1) DIRS += QoS -endif # rapi +endif # rapi #### #### Build customization. diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp index 575d091765c..965f2f69216 100644 --- a/ace/Mem_Map.cpp +++ b/ace/Mem_Map.cpp @@ -65,8 +65,8 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, int unmap_result = this->unmap (); if (unmap_result != 0) return unmap_result; -#endif /* ACE_LACKS_AUTO_MMAP_REMAPPING */ - +#endif /* ACE_LACKS_AUTO_MMAP_REPLACEMENT */ + this->base_addr_ = addr; this->handle_ = handle; @@ -100,7 +100,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, { // File length implicitly requested by user requested_file_length = length_request + offset; - + // Check to see if we need to extend the backing store if (requested_file_length > current_file_length) { @@ -127,10 +127,10 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, if (requested_file_length > 0) // This will make the file size <requested_file_length> null_byte_position = requested_file_length - 1; - else + else // This will make the file size 1 null_byte_position = 0; - + if (ACE_OS::pwrite (this->handle_, "", 1, @@ -142,16 +142,16 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, if (requested_file_length > 0) // This will make the file size <requested_file_length> actual_file_length = requested_file_length; - else + else // This will make the file size 1 actual_file_length = 1; - + if (ACE_OS::ftruncate (this->handle_, actual_file_length) == -1) return -1; #endif /* !CHORUS */ } - + #if defined (__Lynx__) // Set flag that indicates whether PROT_WRITE has been enabled. write_enabled_ = ACE_BIT_ENABLED (prot, PROT_WRITE); diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp index ea4fb3bc79b..08d5e3320e8 100644 --- a/ace/Memory_Pool.cpp +++ b/ace/Memory_Pool.cpp @@ -402,7 +402,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes, int ACE_MMAP_Memory_Pool::seh_selector (void *ep) { - int ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode; + DWORD ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode; if (ecode == EXCEPTION_ACCESS_VIOLATION) { @@ -1007,8 +1007,8 @@ ACE_Pagefile_Memory_Pool::release (void) ACE_Pagefile_Memory_Pool::ACE_Pagefile_Memory_Pool (const ACE_TCHAR *backing_store_name, const OPTIONS *options) : shared_cb_ (0), - page_size_ (ACE_Pagefile_Memory_Pool::round_to_page_size (1)), - object_handle_ (0) + object_handle_ (0), + page_size_ (ACE_Pagefile_Memory_Pool::round_to_page_size (1)) { // Initialize local copy of pool statistics. if (options != 0) @@ -1096,7 +1096,7 @@ ACE_Pagefile_Memory_Pool::init_acquire (size_t nbytes, int ACE_Pagefile_Memory_Pool::seh_selector (void *ep) { - int ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode; + DWORD ecode = ((EXCEPTION_POINTERS *) ep)->ExceptionRecord->ExceptionCode; if (ecode == EXCEPTION_ACCESS_VIOLATION) { diff --git a/ace/Message_Queue.i b/ace/Message_Queue.i index b1afcc649d2..8cf619653a8 100644 --- a/ace/Message_Queue.i +++ b/ace/Message_Queue.i @@ -205,6 +205,8 @@ ACE_INLINE int ACE_Message_Queue_NT::peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { + ACE_UNUSED_ARG(first_item); + ACE_UNUSED_ARG(timeout); ACE_NOTSUP_RETURN (-1); } diff --git a/ace/NT_Service.cpp b/ace/NT_Service.cpp index 0fbfb41dd58..614fa9dfb1f 100644 --- a/ace/NT_Service.cpp +++ b/ace/NT_Service.cpp @@ -51,6 +51,7 @@ ACE_NT_Service::~ACE_NT_Service (void) int ACE_NT_Service::open (void *args) { + ACE_UNUSED_ARG (args); report_status (SERVICE_START_PENDING, 0); int svc_return = this->svc (); @@ -235,16 +236,17 @@ ACE_NT_Service::startup (DWORD startup) if (svc == 0) return -1; - BOOL ok = ChangeServiceConfig (svc, - SERVICE_NO_CHANGE,// No change to service type - startup, // New startup type - SERVICE_NO_CHANGE,// No change to error ctrl - 0, // No change to pathname - 0, // No change to load group - 0, // No change to tag - 0, // No change to dependencies - 0, 0, // No change to acct/passwd - 0); // No change to name + BOOL ok = + ChangeServiceConfig (svc, + (DWORD) SERVICE_NO_CHANGE,// No change to service type + startup, // New startup type + (DWORD) SERVICE_NO_CHANGE,// No change to error ctrl + 0, // No change to pathname + 0, // No change to load group + 0, // No change to tag + 0, // No change to dependencies + 0, 0, // No change to acct/passwd + 0); // No change to name return ok ? 0 : -1; } diff --git a/ace/OS.cpp b/ace/OS.cpp index 96b36884671..a4861ab8f9f 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -279,11 +279,11 @@ void ACE_Time_Value::set (const FILETIME &file_time) // Convert remainder to microseconds; this->tv_.tv_usec = (long)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); #else - ULARGE_INTEGER _100ns = - { - file_time.dwLowDateTime, - file_time.dwHighDateTime - }; + // Don't use a struct initializer, gcc don't like it. + ULARGE_INTEGER _100ns; + _100ns.LowPart = file_time.dwLowDateTime; + _100ns.HighPart = file_time.dwHighDateTime; + _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; // Convert 100ns units to seconds; @@ -612,6 +612,8 @@ ACE_OS::uname (struct utsname *name) ACE_OS::strcpy (name->sysname, ACE_LIB_TEXT ("Win32")); # endif /* ACE_HAS_PHARLAP */ + const ACE_TCHAR* unknown = ACE_LIB_TEXT ("???"); + if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { // Get information from the two structures @@ -621,11 +623,11 @@ ACE_OS::uname (struct utsname *name) # else ACE_LIB_TEXT ("Windows NT %d.%d"), # endif /* ACE_HAS_WINCE */ - vinfo.dwMajorVersion, - vinfo.dwMinorVersion); + (int) vinfo.dwMajorVersion, + (int) vinfo.dwMinorVersion); ACE_OS::sprintf (name->version, ACE_LIB_TEXT ("Build %d %s"), - vinfo.dwBuildNumber, + (int) vinfo.dwBuildNumber, vinfo.szCSDVersion); // We have to make sure that the size of (processor + subtype) @@ -688,27 +690,51 @@ ACE_OS::uname (struct utsname *name) ACE_OS::strcpy (processor, ACE_LIB_TEXT ("Unknown")); break; } - ACE_OS::sprintf (name->machine, ACE_LIB_TEXT ("%s %s"), processor, subtype); + ACE_OS::sprintf (name->machine, + ACE_LIB_TEXT ("%s %s"), + processor, subtype); } else if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - // Get Windows 95 Information - ACE_OS::strcpy (name->release, ACE_LIB_TEXT ("Windows 95")); - ACE_OS::sprintf (name->version, ACE_LIB_TEXT ("%d"), LOWORD (vinfo.dwBuildNumber)); + if (vinfo.dwMajorVersion == 4 && vinfo.dwMinorVersion == 0) + { + ACE_OS::strcpy (name->release, ACE_LIB_TEXT ("Windows 95")); + if (vinfo.szCSDVersion[1] == 'C') + ACE_OS::strcat (name->release, ACE_LIB_TEXT (" OSR2")); + } + else if (vinfo.dwMajorVersion == 4 && vinfo.dwMinorVersion == 10) + { + ACE_OS::strcpy (name->release, ACE_LIB_TEXT ("Windows 98")); + if (vinfo.szCSDVersion[1] == 'A') + ACE_OS::strcat (name->release, ACE_LIB_TEXT (" SE")); + } + else if (vinfo.dwMajorVersion == 4 && vinfo.dwMinorVersion == 90) + { + ACE_OS::strcpy (name->release, ACE_LIB_TEXT ("Windows Me")); + } + else + { + ACE_OS::strcpy (name->release, unknown); + } + + ACE_OS::sprintf (name->version, ACE_LIB_TEXT ("%d"), + LOWORD (vinfo.dwBuildNumber)); if (sinfo.dwProcessorType == PROCESSOR_INTEL_386) ACE_OS::strcpy (name->machine, ACE_LIB_TEXT ("Intel 80386")); else if (sinfo.dwProcessorType == PROCESSOR_INTEL_486) ACE_OS::strcpy (name->machine, ACE_LIB_TEXT ("Intel 80486")); else if (sinfo.dwProcessorType == PROCESSOR_INTEL_PENTIUM) ACE_OS::strcpy (name->machine, ACE_LIB_TEXT ("Intel Pentium")); + else + ACE_OS::strcpy (name->machine, unknown); } else { // We don't know what this is! - ACE_OS::strcpy (name->release, ACE_LIB_TEXT ("???")); - ACE_OS::strcpy (name->version, ACE_LIB_TEXT ("???")); - ACE_OS::strcpy (name->machine, ACE_LIB_TEXT ("???")); + ACE_OS::strcpy (name->release, unknown); + ACE_OS::strcpy (name->version, unknown); + ACE_OS::strcpy (name->machine, unknown); } # if defined (ACE_LACKS_HOSTNAME) @@ -1927,7 +1927,7 @@ struct stat #else # if defined (ACE_HAS_EXCEPTIONS) # define ACE_THROW_SPEC(X) throw X -# if defined (ACE_WIN32) && !defined (ghs) +# if defined (ACE_WIN32) && defined(_MSC_VER) && !defined (ghs) // @@ MSVC "supports" the keyword but doesn't implement it (Huh?). // Therefore, we simply supress the warning for now. # pragma warning( disable : 4290 ) @@ -3128,7 +3128,8 @@ typedef void (*ACE_SignalHandlerV)(...); // Turn off warnings for /W4 // To resume any of these warning: #pragma warning(default: 4xxx) // which should be placed after these defines -# if !defined (ALL_WARNINGS) && !defined(ghs) + +# if !defined (ALL_WARNINGS) && !defined(ghs) && !defined(__MINGW32__) // #pragma warning(disable: 4101) // unreferenced local variable # pragma warning(disable: 4127) /* constant expression for TRACE/ASSERT */ # pragma warning(disable: 4134) /* message map member fxn casts */ @@ -3230,7 +3231,11 @@ typedef void (*ACE_SignalHandlerV)(...); # define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("PATH") # define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (";") # define ACE_DLL_SUFFIX ACE_LIB_TEXT (".dll") -# define ACE_DLL_PREFIX ACE_LIB_TEXT ("") +# if defined (__MINGW32__) +# define ACE_DLL_PREFIX ACE_LIB_TEXT ("lib") +# else /* __MINGW32__ */ +# define ACE_DLL_PREFIX ACE_LIB_TEXT ("") +# endif /* __MINGW32__ */ // This will help until we figure out everything: # define NFDBITS 32 /* only used in unused functions... */ @@ -3353,7 +3358,9 @@ PAGE_NOCACHE */ typedef OVERLAPPED ACE_OVERLAPPED; typedef DWORD ACE_thread_t; +# if !defined(__MINGW32__) typedef long pid_t; +# endif /* __MINGW32__ */ typedef HANDLE ACE_hthread_t; #define ACE_INVALID_PID ((pid_t) -1) @@ -3386,7 +3393,9 @@ typedef pace_uid_t uid_t; typedef pace_gid_t gid_t; # else /* !ACE_HAS_PACE */ typedef DWORD nlink_t; +# if !defined(__MINGW32__) typedef int mode_t; +# endif /* !__MINGW32__ */ typedef int uid_t; typedef int gid_t; # endif /* ACE_HAS_PACE */ @@ -4124,9 +4133,9 @@ typedef fd_set ACE_FD_SET_TYPE; # if defined (ACE_LACKS_SIGSET) # if defined (ACE_HAS_PACE) && !defined (ACE_WIN32) typedef pace_sigset_t sigset_t; -# else +# elif !defined(__MINGW32__) typedef u_int sigset_t; -# endif /* ACE_HAS_PACE */ +# endif /* !ACE_HAS_PACE && !__MINGW32__*/ # endif /* ACE_LACKS_SIGSET */ # if defined (ACE_LACKS_SIGACTION) @@ -1,6 +1,10 @@ // -*- C++ -*- // $Id$ +#if defined (__CYGWIN32__) +# include <getopt.h> +#endif + #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE @@ -10309,6 +10313,8 @@ ACE_OS::execv (const char *path, #elif defined (ACE_WIN32) # if defined (__BORLANDC__) /* VSB */ return ::execv (path, argv); +# elif defined (__MINGW32__) + return ::_execv (path, (char *const *) argv); # else return ::_execv (path, (const char *const *) argv); # endif /* __BORLANDC__ */ @@ -10342,6 +10348,8 @@ ACE_OS::execve (const char *path, #elif defined (ACE_WIN32) # if defined (__BORLANDC__) /* VSB */ return ::execve (path, argv, envp); +# elif defined (__MINGW32__) + return ::_execve (path, (char *const *) argv, (char *const *) envp); # else return ::_execve (path, (const char *const *) argv, (const char *const *) envp); # endif /* __BORLANDC__ */ @@ -10373,6 +10381,8 @@ ACE_OS::execvp (const char *file, #elif defined (ACE_WIN32) # if defined (__BORLANDC__) /* VSB */ return ::execvp (file, argv); +# elif defined (__MINGW32__) + return ::_execvp (file, (char *const *) argv); # else return ::_execvp (file, (const char *const *) argv); # endif /* __BORLANDC__ */ @@ -10558,7 +10568,7 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) ACE_UNUSED_ARG (op); // Use .obj/gethrtime.o, which was compiled with g++. return ACE_gethrtime (); -#elif (defined(__KCC) || defined (__GNUG__)) && defined (ACE_HAS_PENTIUM) +#elif (defined(__KCC) || defined (__GNUG__)) && !defined (__MINGW32__) && defined (ACE_HAS_PENTIUM) ACE_UNUSED_ARG (op); # if defined (ACE_LACKS_LONGLONG_T) @@ -10602,6 +10612,7 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) return now; #elif defined (ACE_WIN32) + ACE_UNUSED_ARG(op); LARGE_INTEGER freq; ::QueryPerformanceCounter (&freq); @@ -11434,8 +11445,10 @@ ACE_OS::mkdir (const ACE_TCHAR *path, mode_t mode) ace_result_), int, -1); #elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + ACE_UNUSED_ARG (mode); ACE_OSCALL_RETURN (::_wmkdir (path), int, -1); #elif defined (ACE_WIN32) + ACE_UNUSED_ARG (mode); ACE_OSCALL_RETURN (::mkdir (path), int, -1); #else ACE_OSCALL_RETURN (::mkdir (path, mode), int, -1); diff --git a/ace/OS_String.cpp b/ace/OS_String.cpp index 6db181f53fe..6bc7aaf44f5 100644 --- a/ace/OS_String.cpp +++ b/ace/OS_String.cpp @@ -99,13 +99,17 @@ ACE_OS_String::strdup (const wchar_t *s) # elif defined (ACE_WCSDUP_EQUIVALENT) return ACE_WCSDUP_EQUIVALENT (s); # else /* ACE_LACKS_WCSDUP */ +# if defined (__MINGW32__) + return ::wcsdup (ACE_const_cast(wchar_t*, s)); +# else /* __MINGW32__ */ return ::wcsdup (s); +# endif /* __MINGW32__ */ # endif /* ACE_LACKS_WCSDUP */ } #endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRERROR) -/** +/** * Just returns "Unknown Error" all the time. */ char * @@ -847,7 +851,7 @@ ACE_OS_String::wcsncmp_emulation (const wchar_t *s1, #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCMP */ #if defined (ACE_LACKS_STRTOL) -long +long ACE_OS_String::strtol_emulation (const char *nptr, char **endptr, int base) { register const char *s = nptr; @@ -855,7 +859,7 @@ ACE_OS_String::strtol_emulation (const char *nptr, char **endptr, int base) register int c; register unsigned long cutoff; register int neg = 0, any, cutlim; - + /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else @@ -877,7 +881,7 @@ ACE_OS_String::strtol_emulation (const char *nptr, char **endptr, int base) } if (base == 0) base = c == '0' ? 8 : 10; - + /* * Compute the cutoff value between legal numbers and illegal * numbers. That is the largest legal value, divided by the @@ -928,8 +932,8 @@ ACE_OS_String::strtol_emulation (const char *nptr, char **endptr, int base) #if defined (ACE_LACKS_STRTOUL) unsigned long -ACE_OS_String::strtoul_emulation (const char *nptr, - char **endptr, +ACE_OS_String::strtoul_emulation (const char *nptr, + char **endptr, register int base) { register const char *s = nptr; @@ -937,7 +941,7 @@ ACE_OS_String::strtoul_emulation (const char *nptr, register int c; register unsigned long cutoff; register int neg = 0, any, cutlim; - + /* * See strtol for comments as to the logic used. */ diff --git a/ace/Process.cpp b/ace/Process.cpp index 3bdb2d2bb68..f4df495b037 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -48,10 +48,10 @@ ACE_Process::spawn (ACE_Process_Options &options) #if defined (ACE_WIN32) if (prepare (options) < 0) return ACE_INVALID_PID; - + BOOL fork_result = ACE_TEXT_CreateProcess (0, - options.command_line_buf (), + options.command_line_buf (), options.get_process_attributes (), options.get_thread_attributes (), options.handle_inheritence (), @@ -107,12 +107,12 @@ ACE_Process::spawn (ACE_Process_Options &options) #else /* ACE_WIN32 */ if (prepare (options) < 0) return ACE_INVALID_PID; - + // Fork the new process. this->child_id_ = ACE::fork (options.process_name (), options.avoid_zombies ()); - if (this->child_id_ == 0) + if (this->child_id_ == 0) { // If we're the child and the options specified a non-default // process group, try to set our pgid to it. This allows the @@ -124,12 +124,12 @@ ACE_Process::spawn (ACE_Process_Options &options) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p.\n"), ACE_LIB_TEXT ("ACE_Process::spawn: setpgid failed."))); - + #if !defined (ACE_LACKS_SETREUID) // Set user and group id's. - if (options.getruid () != (uid_t) -1 + if (options.getruid () != (uid_t) -1 || options.geteuid () != (uid_t) -1) - if (ACE_OS::setreuid (options.getruid (), + if (ACE_OS::setreuid (options.getruid (), options.geteuid ()) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p.\n"), @@ -137,7 +137,7 @@ ACE_Process::spawn (ACE_Process_Options &options) #endif /* ACE_LACKS_SETREUID */ #if !defined (ACE_LACKS_SETREGID) - if (options.getrgid () != (uid_t) -1 + if (options.getrgid () != (uid_t) -1 || options.getegid () != (uid_t) -1) if (ACE_OS::setregid (options.getrgid (), options.getegid ()) == -1) @@ -148,9 +148,9 @@ ACE_Process::spawn (ACE_Process_Options &options) this->child (ACE_OS::getppid ()); } - else if (this->child_id_ != -1) + else if (this->child_id_ != -1) this->parent (this->child_id_); - + // If we're not supposed to exec, return the process id. if (ACE_BIT_ENABLED (options.creation_flags (), ACE_Process_Options::NO_EXEC)) @@ -162,7 +162,7 @@ ACE_Process::spawn (ACE_Process_Options &options) // Error. return ACE_INVALID_PID; case 0: - // Child process...exec the + // Child process...exec the { if (options.get_stdin () != ACE_INVALID_HANDLE && ACE_OS::dup2 (options.get_stdin (), @@ -258,12 +258,12 @@ ACE_Process::running (void) const #if defined (ACE_WIN32) DWORD code; - BOOL result = ::GetExitCodeProcess (this->gethandle (), + BOOL result = ::GetExitCodeProcess (this->gethandle (), &code); return result && code == STILL_ACTIVE; #else - return ACE_OS::kill (this->getpid (), - 0) == 0 + return ACE_OS::kill (this->getpid (), + 0) == 0 || errno != ESRCH; #endif /* ACE_WIN32 */ } @@ -304,7 +304,7 @@ ACE_Process::wait (const ACE_Time_Value &tv, ACE_Time_Value wait_until = ACE_OS::gettimeofday () + tv; - for (;;) + for (;;) { int result = ACE_OS::waitpid (this->getpid (), status, @@ -577,7 +577,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in, std_in, ::GetCurrentProcess (), &this->startup_info_.hStdInput, - NULL, + 0, TRUE, DUPLICATE_SAME_ACCESS)) return -1; @@ -586,7 +586,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in, std_out, ::GetCurrentProcess (), &this->startup_info_.hStdOutput, - NULL, + 0, TRUE, DUPLICATE_SAME_ACCESS)) return -1; @@ -595,7 +595,7 @@ ACE_Process_Options::set_handles (ACE_HANDLE std_in, std_err, ::GetCurrentProcess (), &this->startup_info_.hStdError, - NULL, + 0, TRUE, DUPLICATE_SAME_ACCESS)) return -1; @@ -679,8 +679,8 @@ int ACE_Process_Options::command_line (const ACE_ANTI_TCHAR *format, ...) { ACE_ANTI_TCHAR *anti_clb; - ACE_NEW_RETURN (anti_clb, - ACE_ANTI_TCHAR[this->command_line_buf_len_], + ACE_NEW_RETURN (anti_clb, + ACE_ANTI_TCHAR[this->command_line_buf_len_], -1); // Store all ... args in argp. @@ -695,7 +695,7 @@ ACE_Process_Options::command_line (const ACE_ANTI_TCHAR *format, ...) // Useless macro. va_end (argp); - ACE_OS::strcpy (this->command_line_buf_, + ACE_OS::strcpy (this->command_line_buf_, ACE_TEXT_ANTI_TO_TCHAR (anti_clb)); delete [] anti_clb; @@ -734,7 +734,7 @@ ACE_Process_Options::command_line_argv (void) int x = 0; do command_line_argv_[x] = parser.next (); - while (command_line_argv_[x] != 0 + while (command_line_argv_[x] != 0 // substract one for the ending zero. && ++x < MAX_COMMAND_LINE_OPTIONS - 1); @@ -743,4 +743,3 @@ ACE_Process_Options::command_line_argv (void) return command_line_argv_; } - diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp index f05ce1e8e1b..b6dd137b69a 100644 --- a/ace/Process_Manager.cpp +++ b/ace/Process_Manager.cpp @@ -373,9 +373,11 @@ ACE_Process_Manager::handle_signal (int, ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, lock_, -1)); ssize_t i = this->find_proc (proc); +#if 0 pid_t pid = i != -1 ? process_table_[i].process_->getpid () : ACE_INVALID_PID; +#endif this->notify_proc_handler (i, status); this->remove_proc (i); } @@ -812,7 +814,8 @@ ACE_Process_Manager::wait (pid_t pid, // Green Hills produces a warning that result >= WAIT_OBJECT_0 is // a pointless comparison because WAIT_OBJECT_0 is zero and DWORD is // unsigned long, so this test is skipped for Green Hills. -# if defined (ghs) + // Same for mingw. +# if defined (ghs) || defined (__MINGW32__) ACE_ASSERT (result < WAIT_OBJECT_0 + current_count_); # else ACE_ASSERT (result >= WAIT_OBJECT_0 diff --git a/ace/Registry.cpp b/ace/Registry.cpp index aba7b6f8557..16e4b7ef32d 100644 --- a/ace/Registry.cpp +++ b/ace/Registry.cpp @@ -808,9 +808,9 @@ ACE_Registry::Naming_Context::list (Binding_List &list) // Default constructor ACE_Registry::Binding_Iterator::Binding_Iterator () - : iteration_complete_ (*this), - object_iteration_ (*this), - context_iteration_ (*this) + : object_iteration_ (*this), + context_iteration_ (*this), + iteration_complete_ (*this) { this->reset (); } @@ -1123,4 +1123,20 @@ ACE_Predefined_Naming_Contexts::is_local_host (const ACE_TCHAR *machine_name) return result; } +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Node<ACE_Registry::Binding>; +template class ACE_Unbounded_Set<ACE_Registry::Binding>; +template class ACE_Unbounded_Set_Iterator<ACE_Registry::Binding>; +template class ACE_Node<ACE_Registry::Name_Component>; +template class ACE_Unbounded_Set<ACE_Registry::Name_Component>; +template class ACE_Unbounded_Set_Iterator<ACE_Registry::Name_Component>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Node<ACE_Registry::Binding> +#pragma instantiate ACE_Unbounded_Set<ACE_Registry::Binding> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Registry::Binding> +#pragma instantiate ACE_Node<ACE_Registry::Name_Component> +#pragma instantiate ACE_Unbounded_Set<ACE_Registry::Name_Component> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Registry::Name_Component> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_WIN32 */ diff --git a/ace/SOCK_Connector.i b/ace/SOCK_Connector.i index c4801c01cf0..82b5e3e1739 100644 --- a/ace/SOCK_Connector.i +++ b/ace/SOCK_Connector.i @@ -20,17 +20,16 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (void) ACE_TRACE ("ACE_SOCK_Connector::ACE_SOCK_Connector"); } -ASYS_INLINE int +ASYS_INLINE int ACE_SOCK_Connector::reset_new_handle (ACE_HANDLE handle) { - ACE_UNUSED_ARG (handle); #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association + // Reset the event association return ::WSAEventSelect ((SOCKET) handle, NULL, - 0); + 0); #else /* !defined ACE_HAS_WINSOCK2 */ + ACE_UNUSED_ARG (handle); return 0; #endif /* ACE_WIN32 */ } - diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index 972f838ef92..3c28a8b32af 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -14,15 +14,65 @@ ACE_RCSID(ace, Sock_Connect, "$Id$") #if defined (ACE_WIN32) && \ -(!defined (ACE_HAS_WINSOCK2) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 0))) + (!defined (ACE_HAS_WINSOCK2) \ + || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 0))) + +static int +get_reg_subkeys (const ACE_TCHAR *key, + ACE_TCHAR *buffer, + DWORD &buf_len) +{ + HKEY hk; + LONG rc = ACE_TEXT_RegOpenKeyEx (HKEY_LOCAL_MACHINE, + key, + 0, + KEY_READ, + &hk); + + if (rc != ERROR_SUCCESS) + return -1; + + ACE_TCHAR subkeyname[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1]; + DWORD subkeyname_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN; + FILETIME update_dummy; + + DWORD total = 0; + + for (int i = 0; + (rc = ACE_TEXT_RegEnumKeyEx (hk, i, + subkeyname, + &subkeyname_len, + 0, 0, 0, + &update_dummy)) != ERROR_NO_MORE_ITEMS; + ++i) + { + if (subkeyname_len < buf_len - total) + { + ACE_OS::strcpy(buffer + total, subkeyname); + total += subkeyname_len + 1; + // Reset: was changed by RegEnumKeyEx call. + subkeyname_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; + } + else + return -1; + } + + buf_len = total; + + ::RegCloseKey (hk); + return 0; +} + // Return value in buffer for a key/name pair from the Windows // Registry up to buf_len size. +// If all_subkeys == 1, look for name under all subkeys of key. static int get_reg_value (const ACE_TCHAR *key, const ACE_TCHAR *name, ACE_TCHAR *buffer, - DWORD &buf_len) + DWORD &buf_len, + int all_subkeys = 0) { HKEY hk; DWORD buf_type; @@ -31,27 +81,121 @@ get_reg_value (const ACE_TCHAR *key, 0, KEY_READ, &hk); - // 1. open key that defines the interfaces used for TCP/IP? + if (rc != ERROR_SUCCESS) // print_error_string(ACE_LIB_TEXT ("RegOpenKeyEx"), rc); return -1; - rc = ACE_TEXT_RegQueryValueEx (hk, - name, - 0, - &buf_type, - (u_char *) buffer, - &buf_len); - if (rc != ERROR_SUCCESS) + if (all_subkeys) { - // print_error_string(ACE_LIB_TEXT ("RegEnumKeyEx"), rc); - RegCloseKey (hk); - return -2; + ACE_TCHAR ifname[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1]; + DWORD ifname_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; + FILETIME update_dummy; + + DWORD total = 0; + DWORD size = buf_len; + + for (int i = 0; + (rc = ACE_TEXT_RegEnumKeyEx (hk, i, ifname, &ifname_len, + 0, 0, 0, + &update_dummy)) != ERROR_NO_MORE_ITEMS; + ++i) + { + HKEY ifkey; + if (rc != ERROR_SUCCESS + || ACE_TEXT_RegOpenKeyEx (hk, ifname, 0, + KEY_READ, &ifkey) != ERROR_SUCCESS) + continue; + + if (ACE_TEXT_RegQueryValueEx (ifkey, name, 0, NULL, + (u_char*) (buffer + total), + &size) != ERROR_SUCCESS) + { + RegCloseKey(ifkey); + continue; + } + else + { + total += size; + size = buf_len - total; + } + // Needs to be reset. + ifname_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; + } + + if (total == 0) + { + ::RegCloseKey (hk); + return -2; + } + else + { + buf_len = total; + } + } + else + { + + rc = ACE_TEXT_RegQueryValueEx (hk, + name, + 0, + &buf_type, + (u_char *) buffer, + &buf_len); + if (rc != ERROR_SUCCESS) + { + // print_error_string(ACE_LIB_TEXT ("RegEnumKeyEx"), rc); + RegCloseKey (hk); + return -2; + } } ::RegCloseKey (hk); return 0; } + +enum ACE_WINDOWS_VERSION { + ACE_WINDOWS_IS_UNKNOWN, + ACE_WINDOWS_IS_WIN95, + ACE_WINDOWS_IS_WIN98, + ACE_WINDOWS_IS_WINME, + ACE_WINDOWS_IS_WINNT, + ACE_WINDOWS_IS_WIN2K +}; + +static ACE_WINDOWS_VERSION +get_windows_version() +{ + OSVERSIONINFO vinfo; + vinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (::GetVersionEx(&vinfo) == 0) + { + return ACE_WINDOWS_IS_UNKNOWN; + } + + switch (vinfo.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + if (vinfo.dwMajorVersion <= 4) + return ACE_WINDOWS_IS_WINNT; + else + return ACE_WINDOWS_IS_WIN2K; + case VER_PLATFORM_WIN32_WINDOWS: + if (vinfo.dwMajorVersion == 4) + { + if (vinfo.dwMinorVersion == 0) + return ACE_WINDOWS_IS_WIN95; + else if (vinfo.dwMinorVersion == 10) + return ACE_WINDOWS_IS_WIN98; + else if (vinfo.dwMinorVersion == 90) + return ACE_WINDOWS_IS_WINME; + } + // If no match we fall throu. + default: + return ACE_WINDOWS_IS_UNKNOWN; + } +} + #endif //(ACE_WIN32) && !(ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 0) // Bind socket to an unused port. @@ -470,25 +614,114 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, # else /* ACE_HAS_PHARLAP */ - const ACE_TCHAR *SVCS_KEY1 = - ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services\\"); - const ACE_TCHAR *LINKAGE_KEY1 = - ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Linkage"); - const ACE_TCHAR *TCP_PARAM_SUBKEY = ACE_LIB_TEXT ("\\Parameters\\Tcpip"); - const ACE_TCHAR *BIND_NAME_ID = ACE_LIB_TEXT ("Bind"); - const ACE_TCHAR *IPADDR_NAME_ID = ACE_LIB_TEXT ("IPAddress"); + // + // No Winsock2. + // Get interface information from the registry. + // As this information is in different locations of the registry + // on different windows versions, we need to ask at runtime. + // + + // Normally we have to look under one key for interfaces name, + // and under a second key for ip address of those interfaces. + // Exact values and the way to search depend on windows version. + + // This is the first key we have to look for. + const ACE_TCHAR *BASE_KEY1; + + // This is the name we have to look for under the first key. + // If this is == 0, we need to look for subkeys, not the values from + // a name. + const ACE_TCHAR *KEY1_NAME_ID; + + // The second key is normally constructed concatenating a prefix, + // the value found on KEY1_NAME_ID stripped from the first s_offset + // characters, and a suffix. + unsigned int s_offset; + const ACE_TCHAR *PREFFIX_KEY2; + const ACE_TCHAR *SUFFIX_KEY2; + + // If != 0, look for the value of KEY1_NAME_ID not directly under + // BASE_KEY1, but on every subkey of BASE_KEY1. + int use_subkeys; + + // When we search for IP Addresses below, we look for a key with a + // name in this array (null terminated). + // For some windows versions, there is an + // aditional key for ppp interfaces that will be stored on [1]. + const ACE_TCHAR *IPADDR_NAME_ID[3] = { + ACE_LIB_TEXT ("IPAddress"), 0, 0 + }; + + // Skip addresses that match this. const ACE_TCHAR *INVALID_TCPIP_DEVICE_ADDR = ACE_LIB_TEXT ("0.0.0.0"); + ACE_WINDOWS_VERSION winver = get_windows_version(); + + switch (winver) + { + case ACE_WINDOWS_IS_WINNT: + PREFFIX_KEY2 = ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services\\"); + BASE_KEY1 = + ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services") + ACE_LIB_TEXT ("\\Tcpip\\Linkage"); + SUFFIX_KEY2 = ACE_LIB_TEXT ("\\Parameters\\Tcpip"); + KEY1_NAME_ID = ACE_LIB_TEXT ("Bind"); + s_offset = 8; + use_subkeys = 0; + break; + + case ACE_WINDOWS_IS_WIN2K: + BASE_KEY1 = + ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services") + ACE_LIB_TEXT ("\\Tcpip\\Parameters\\Interfaces\\"); + PREFFIX_KEY2 = BASE_KEY1; + SUFFIX_KEY2 = ACE_LIB_TEXT (""); + KEY1_NAME_ID = 0; + s_offset = 0; + use_subkeys = 1; + // PPP. + IPADDR_NAME_ID[1] = ACE_LIB_TEXT ("DhcpIPAddress"); + break; + + // If ACE_HAS_WINNT4 we can safely assume the ones below will + // not be needed. +# if !defined(ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0) + case ACE_WINDOWS_IS_WIN95: + case ACE_WINDOWS_IS_WIN98: + case ACE_WINDOWS_IS_WINME: + PREFFIX_KEY2 = + ACE_LIB_TEXT ("SYSTEM\\CurrentControlSet\\Services\\Class\\"); + BASE_KEY1 = ACE_LIB_TEXT ("Enum\\Network\\MSTCP"); + SUFFIX_KEY2 = ACE_LIB_TEXT (""); + KEY1_NAME_ID = ACE_LIB_TEXT ("Driver"); + use_subkeys = 1; + s_offset = 0; + break; +# endif /* !ACE_HAS_WINNT4 */ + + default: + return -1; + } + ACE_TCHAR raw_buffer[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1]; DWORD raw_buflen = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; - ACE_TCHAR buffer[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1]; - DWORD buf_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; - if (::get_reg_value (LINKAGE_KEY1, - BIND_NAME_ID, - raw_buffer, - raw_buflen)) - return -1; + if (KEY1_NAME_ID == 0) + { + if (::get_reg_subkeys (BASE_KEY1, + raw_buffer, + raw_buflen)) + return -1; + } + else + { + if (::get_reg_value (BASE_KEY1, + KEY1_NAME_ID, + raw_buffer, + raw_buflen, + use_subkeys)) + return -1; + } // return buffer contains 0 delimited strings ACE_Tokenizer dev_names (raw_buffer); @@ -506,28 +739,37 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, ACE_NEW_RETURN (addrs, ACE_INET_Addr[n_interfaces], -2); + + ACE_TCHAR buffer[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1]; + DWORD buf_len = ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 1; + count = 0; for (int i = 0; i < n_interfaces; i++) { - // a. construct name to access IPAddress for this interface - ACE_TString ifdevkey (SVCS_KEY1); - ACE_TString the_dev = dev_names.next (); - - // chop off the "\Device" and keep last name. - if (the_dev.length() < 8) - return -3; // Something's wrong - else + for (const ACE_TCHAR **ipaddr_name_id = IPADDR_NAME_ID; + *ipaddr_name_id != 0; + ++ipaddr_name_id) { - // rest of string from offset 8 - the_dev = the_dev.substring (8); + // a. construct name to access IP Address for this interface + ACE_TString ifdevkey (PREFFIX_KEY2); + ACE_TString the_dev = dev_names.next (); + + if (the_dev.length() < s_offset) + { + return -3; // Something's wrong + } + + // rest of string from offset. + the_dev = the_dev.substring (s_offset); + ifdevkey += the_dev; - ifdevkey += TCP_PARAM_SUBKEY; + ifdevkey += SUFFIX_KEY2; // b. extract value // Gets overwritten on each call buf_len = sizeof (buffer); if (get_reg_value (ifdevkey.fast_rep (), - IPADDR_NAME_ID, + *ipaddr_name_id, buffer, buf_len)) continue; // Skip unknown devices. @@ -541,6 +783,7 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, ACE_INET_Addr ((u_short) 0, buffer); } } + return 0; # endif /* ACE_HAS_PHARLAP */ # endif /* Winsock 2 && MSVC 5 or later */ diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp index 33809ff5ef2..4aa76bbdc39 100644 --- a/ace/TTY_IO.cpp +++ b/ace/TTY_IO.cpp @@ -361,8 +361,12 @@ ACE_TTY_IO::control (Control_Mode cmd, timeouts.ReadTotalTimeoutMultiplier = MAXDWORD; // ensure specified timeout is below MAXDWORD - if(arg->readtimeoutmsec < MAXDWORD) - timeouts.ReadTotalTimeoutConstant = arg->readtimeoutmsec ; + + // We don't test arg->readtimeoutmsec against MAXDWORD + // directly to avoid a warning in the case DWORD is unsigned. + DWORD dw = arg->readtimeoutmsec; + if (dw < MAXDWORD) + timeouts.ReadTotalTimeoutConstant = dw; else timeouts.ReadTotalTimeoutConstant = MAXDWORD; } diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index 54f96b9d70c..a661b7733fa 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -1022,25 +1022,27 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh, delete_signal_handler_ (0), timer_queue_ (0), delete_timer_queue_ (0), - handler_rep_ (*this), delete_handler_rep_ (0), delete_notify_handler_ (0), lock_adapter_ (lock_), + handler_rep_ (*this), // this event is initially signaled ok_to_wait_ (1), // this event is initially unsignaled wakeup_all_threads_ (0), // this event is initially unsignaled waiting_to_change_state_ (0), - new_owner_ (0), active_threads_ (0), owner_ (ACE_Thread::self ()), + new_owner_ (0), change_state_thread_ (0), open_for_business_ (0), deactivated_ (0) { if (this->open (ACE_WFMO_Reactor::DEFAULT_SIZE, 0, sh, tq) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("WFMO_Reactor"))); + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("%p\n"), + ACE_LIB_TEXT ("WFMO_Reactor"))); } ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, @@ -1051,19 +1053,19 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, delete_signal_handler_ (0), timer_queue_ (0), delete_timer_queue_ (0), - handler_rep_ (*this), delete_handler_rep_ (0), delete_notify_handler_ (0), lock_adapter_ (lock_), + handler_rep_ (*this), // this event is initially signaled ok_to_wait_ (1), // this event is initially unsignaled wakeup_all_threads_ (0), // this event is initially unsignaled waiting_to_change_state_ (0), - new_owner_ (0), active_threads_ (0), owner_ (ACE_Thread::self ()), + new_owner_ (0), change_state_thread_ (0), open_for_business_ (0), deactivated_ (0) @@ -1071,7 +1073,9 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, ACE_UNUSED_ARG (unused); if (this->open (size, 0, sh, tq) == -1) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("WFMO_Reactor"))); + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("%p\n"), + ACE_LIB_TEXT ("WFMO_Reactor"))); } int @@ -1089,6 +1093,7 @@ ACE_WFMO_Reactor::open (size_t size, ACE_Reactor_Notify *notify) { ACE_UNUSED_ARG (unused); + ACE_UNUSED_ARG (disable_notify_pipe); // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); @@ -1791,8 +1796,11 @@ ACE_WFMO_Reactor::dispatch_handles (size_t wait_status) number_of_handlers_dispatched++) { bool ok = ( -#if ! (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0530)) && !defined (ghs) - // wait_status is unsigned in Borland and Green Hills; +#if ! (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0530)) \ + && !defined (ghs) \ + && !defined (__MINGW32__) + // wait_status is unsigned in Borland, Green Hills + // and mingw32; // This >= is always true, with a warning. wait_status >= WAIT_OBJECT_0 && #endif @@ -2154,6 +2162,8 @@ int ACE_WFMO_Reactor_Notify::dispatch_notifications (int &number_of_active_handles, ACE_Handle_Set &rd_mask) { + ACE_UNUSED_ARG (number_of_active_handles); + ACE_UNUSED_ARG (rd_mask); return -1; } @@ -2164,8 +2174,8 @@ ACE_WFMO_Reactor_Notify::close (void) } ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify (void) - : max_notify_iterations_ (-1), - timer_queue_ (0) + : timer_queue_ (0), + max_notify_iterations_ (-1) { } @@ -2174,6 +2184,7 @@ ACE_WFMO_Reactor_Notify::open (ACE_Reactor_Impl *wfmo_reactor, ACE_Timer_Queue *timer_queue, int ignore_notify) { + ACE_UNUSED_ARG (ignore_notify); timer_queue_ = timer_queue; return wfmo_reactor->register_handler (this); } diff --git a/ace/WFMO_Reactor.i b/ace/WFMO_Reactor.i index 5e851527c3e..22d35cbe1be 100644 --- a/ace/WFMO_Reactor.i +++ b/ace/WFMO_Reactor.i @@ -1065,6 +1065,9 @@ ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler, int ops) { // Don't have an implementation for this yet... + ACE_UNUSED_ARG (event_handler); + ACE_UNUSED_ARG (mask); + ACE_UNUSED_ARG (ops); ACE_NOTSUP_RETURN (-1); } @@ -1074,6 +1077,8 @@ ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle, int ops) { // Don't have an implementation for this yet... + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (ops); ACE_NOTSUP_RETURN (-1); } diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp index b43205109a2..891e378aa6e 100644 --- a/ace/WIN32_Asynch_IO.cpp +++ b/ace/WIN32_Asynch_IO.cpp @@ -1363,7 +1363,7 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block, // Cleanup dynamically allocated Asynch_Result. delete result; - + if (ACE::debug ()) { ACE_DEBUG ((LM_ERROR, @@ -1373,6 +1373,12 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block, return -1; } #else /* ACE_HAS_WINNT4 .......|| ACE_HAS_AIO_CALLS */ + ACE_UNUSED_ARG (message_block); + ACE_UNUSED_ARG (bytes_to_read); + ACE_UNUSED_ARG (accept_handle); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); ACE_NOTSUP_RETURN (-1); #endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || (defined (ACE_HAS_AIO_CALLS) */ } @@ -1646,7 +1652,7 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, // Cleanup dynamically allocated Asynch_Result delete result; - + if (ACE::debug ()) { ACE_DEBUG ((LM_ERROR, @@ -1656,6 +1662,16 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, return -1; } #else /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) */ + ACE_UNUSED_ARG (file); + ACE_UNUSED_ARG (header_and_trailer); + ACE_UNUSED_ARG (bytes_to_write); + ACE_UNUSED_ARG (offset); + ACE_UNUSED_ARG (offset_high); + ACE_UNUSED_ARG (bytes_per_send); + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_AIO_CALLS */ } diff --git a/ace/config-cygwin32-common.h b/ace/config-cygwin32-common.h index f288b544339..64b02d233fd 100644 --- a/ace/config-cygwin32-common.h +++ b/ace/config-cygwin32-common.h @@ -4,7 +4,7 @@ // This configuration file is designed to be included by another, // specific configuration file. It provides config information common // to all CygWin platforms. It automatically determines the CPU -// architecture, compiler (g++ or egcs), and libc (libc5 or glibc), +// architecture, compiler (g++ or egcs), and libc (libc5/glibc/newlib), // and configures based on those. #ifndef ACE_CYGWIN32_COMMON_H @@ -13,12 +13,22 @@ #define CYGWIN32 +// We trust this file will get included before <sys/types.h> +#if !defined(FD_SETSIZE) +# define FD_SETSIZE 1024 +#endif + #define ACE_LACKS_UNIX_DOMAIN_SOCKETS #define ACE_LACKS_SYSV_MSG_H #define ACE_HAS_SIG_MACROS #define ACE_LACKS_SYSTIME_H #define ACE_LACKS_TELLDIR #define ACE_LACKS_SYSV_SHMEM + +#define ACE_LACKS_FORK +#define ACE_LACKS_MMAP +#define ACE_LACKS_MPROTECT + #define ACE_LACKS_SEMBUF_T #define ACE_LACKS_NAMED_POSIX_SEM #define ACE_LACKS_SENDMSG @@ -29,6 +39,7 @@ #define ACE_LACKS_SEEKDIR #define ACE_LACKS_TEMPNAM #define ACE_LACKS_MKTEMP +// #define ACE_HAS_BROKEN_SAP_ANY #if ! defined (__ACE_INLINE__) # define __ACE_INLINE__ @@ -40,46 +51,7 @@ // First the machine specific part -#define ACE_HAS_CYGWIN32_SOCKET_H -#define ACE_LACKS_TCP_H - -// Then glibc/libc5 specific parts - -#if defined(__GLIBC__) -# define ACE_HAS_BROKEN_SETRLIMIT -# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who -# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource -# define ACE_HAS_SOCKLEN_T - - // To avoid the strangeness with Linux's ::select (), which modifies - // its timeout argument, use ::poll () instead. -# define ACE_HAS_POLL - - // NOTE: the following defines are necessary with glibc 2.0 (0.961212-5) - // on Alpha. I assume that they're necessary on Intel as well, - // but that may depend on the version of glibc that is used. -# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C -# define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -# define ACE_LACKS_GETPGID - // The strtok_r declaration is protected in string.h. - extern "C" char *strtok_r __P ((char *__s, __const char *__delim, - char **__save_ptr)); - // NOTE: end of glibc 2.0 (0.961212-5)-specific configuration. - -# if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 -# undef ACE_HAS_BYTESEX_H -# define ACE_HAS_SIGINFO_T -# define ACE_LACKS_SIGINFO_H -# define ACE_HAS_UCONTEXT_T -# endif /* __GLIBC__ 2.1+ */ - // Changes above were suggested by Robert Hanzlik <robi@codalan.cz> - // to get ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8 - -#endif /* __GLIBC__ */ - +// #define ACE_HAS_CYGWIN32_SOCKET_H // Then the compiler specific parts @@ -89,19 +61,24 @@ #if defined (__GNUG__) # include "ace/config-g++-common.h" -#elif defined (__KCC) -# include "ace/config-kcc-common.h" -#else /* ! __GNUG__ && ! __KCC */ -# error unsupported compiler in ace/config-linux-common.h -#endif /* ! __GNUG__ && ! __KCC */ +#else +# error unsupported compiler in ace/config-cygwin32-common.h +#endif /* __GNUG__ */ // Completely common part :-) // Platform/compiler has the sigwait(2) prototype #define ACE_HAS_SIGWAIT - -# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#define ACE_HAS_POSIX_TIME +#define ACE_LACKS_TIMESPEC_T +#define ACE_HAS_MSG +#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_GETHOSTENT +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_LACKS_GETPGID_PROTOTYPE // Compiler/platform supports alloca(). #define ACE_HAS_ALLOCA @@ -115,22 +92,12 @@ // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -// ONLY define this if you have config'd multicast into a 2.x kernel. -// If you do anything else, we've never tested it! #if !defined(ACE_HAS_IP_MULTICAST) # define ACE_HAS_IP_MULTICAST #endif /* #if ! defined(ACE_HAS_IP_MULTICAST) */ #define ACE_HAS_BIG_FD_SET -// Linux defines struct msghdr in /usr/include/socket.h -#define ACE_HAS_MSG - -// Linux "improved" the interface to select() so that it modifies -// the struct timeval to reflect the amount of time not slept -// (see NOTES in Linux's select(2) man page). -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - #define ACE_HAS_TERM_IOCTLS #define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 @@ -172,4 +139,4 @@ #define ACE_LACKS_MKFIFO #include "ace/post.h" -#endif /* ACE_LINUX_COMMON_H */ +#endif /* ACE_CYGWIN32_COMMON_H */ diff --git a/ace/config-g++-common.h b/ace/config-g++-common.h index 91876848014..3b5c6756f83 100644 --- a/ace/config-g++-common.h +++ b/ace/config-g++-common.h @@ -1,4 +1,4 @@ -// -*- C++ -*- +// -*- C++ -*- // // $Id$ @@ -37,10 +37,10 @@ # endif /* __GNUC__ >= 2.91 */ #if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 97 ) - // gcc 2.97 and higher use libstdc++-v3 and require - // the use of the std namespace for using iostreams + // gcc 2.97 and higher use libstdc++-v3 and require + // the use of the std namespace for using iostreams # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# undef ACE_USES_OLD_IOSTREAMS +# undef ACE_USES_OLD_IOSTREAMS #endif /* __GNUC__ >= 2.97 */ # if __GNUC__ == 2 && __GNUC_MINOR__ != 9 && __GNUC_MINOR__ != 91 @@ -78,7 +78,7 @@ # define ACE_SIZEOF_LONG_DOUBLE 12 #endif /* i386 */ -#if defined (i386) || defined (__i386__) +#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__)) // If running an Intel, assume that it's a Pentium so that // ACE_OS::gethrtime () can use the RDTSC instruction. If running a // 486 or lower, be sure to comment this out. (If not running an diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 6f29a75994b..afad57f010f 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -16,7 +16,7 @@ #define ACE_WIN32 -// Define this if you're running NT 4.x +// Define this if you're running NT >= 4.0 (Win2K == NT 5). // Setting applies to : building ACE // Runtime restrictions: System must be Windows NT => 4.0 #if !defined (ACE_HAS_WINNT4) @@ -27,6 +27,11 @@ # if !defined (_WIN32_WINNT) # define _WIN32_WINNT 0x0400 # endif +#else +// On Win9X, a shared address SHOULD be between the 2nd and 3rd Gb. +// Note this will not work for NT: The addresses above 2Gb are +// reserved for the system, so this one will fail. +# define ACE_DEFAULT_BASE_ADDR ((char*) ((2048UL+512UL)*1024UL*1024UL)) #endif // Define ACE_HAS_MFC to 1, if you want ACE to use CWinThread. This should @@ -156,7 +161,7 @@ // By default WIN32 has FD_SETSIZE of 64, which places the limit // between 61 and 64 on the number of clients a server using the // Select Reactor can support at the same time (i.e., 64 - standard in, -// out, error). He we raise the limit to 1024. Adjust the definition +// out, error). Here we raise the limit to 1024. Adjust the definition // below if you need to raise or lower it. #if defined (FD_SETSIZE) @@ -186,7 +191,9 @@ #if !defined (ACE_HAS_WINCE) // Platform supports pread() and pwrite() # define ACE_HAS_P_READ_WRITE -# define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS +# if !defined (__MINGW32__) +# define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS +# endif /* __MINGW32__ */ #endif /* ! ACE_HAS_WINCE */ #define ACE_DEFAULT_THREAD_PRIORITY 0 @@ -224,10 +231,15 @@ #define ACE_SIZEOF_LONG_LONG 8 // Green Hills Native x86 does not support __int64 keyword -#if !defined (ghs) +// Neither does mingw32. +#if !defined (ghs) && !defined (__MINGW32__) typedef unsigned __int64 ACE_UINT64; #endif /* (ghs) */ +#if defined (__MINGW32__) +typedef unsigned long long ACE_UINT64; +#endif + // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT @@ -312,7 +324,7 @@ typedef unsigned __int64 ACE_UINT64; // If you want to use highres timers, ensure that // Build.Settings.C++.CodeGeneration.Processor is // set to Pentium ! -#if (_M_IX86 > 400) +#if !defined(ACE_HAS_PENTIUM) && (_M_IX86 > 400) # define ACE_HAS_PENTIUM #endif @@ -461,6 +473,11 @@ typedef unsigned __int64 ACE_UINT64; # define ACE_WSOCK_VERSION 1, 1 #endif /* ACE_HAS_WINSOCK2 */ +// mingw32 doesn't define this (yet...) +#if defined(__MINGW32__) && !defined(MWMO_ALERTABLE) +# define MWMO_ALERTABLE 0x0002 +#endif + // Platform supports IP multicast on Winsock 2 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) # define ACE_HAS_IP_MULTICAST diff --git a/ace/config-win32-mingw.h b/ace/config-win32-mingw.h new file mode 100644 index 00000000000..2689fb97645 --- /dev/null +++ b/ace/config-win32-mingw.h @@ -0,0 +1,64 @@ +// -*- C++ -*- +// $Id$ + +// +// The following configuration file is designed to work for win32 +// platforms using gcc/g++ with mingw32 (http://www.mingw.org). +// + +#ifndef ACE_CONFIG_WIN32_MINGW_H +#define ACE_CONFIG_WIN32_MINGW_H +#include "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#define ACE_CC_NAME ACE_LIB_TEXT ("g++") +#define ACE_CC_PREPROCESSOR "cpp" +#define ACE_CC_PREPROCESOR_ARGS "" + +// Why all this is not in config-g++-common.h? +#define ACE_CC_MAJOR_VERSION __GNUC__ +#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ +#define ACE_CC_BETA_VERSION (0) + +#if !defined(__MINGW32__) +# error You do not seem to be using mingw32 +#endif + +#define ACE_AS_STATIC_LIBS + +#include "ace/config-g++-common.h" + +#include <_mingw.h> + +#define ACE_LACKS_MODE_MASKS +#define ACE_HAS_USER_MODE_MASKS + +#if (__MINGW32_MAJOR_VERSION == 0) && (__MINGW32_MINOR_VERSION < 5) +#error You need a newer version (>= 0.5) of mingw32/w32api +#endif + +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_STRERROR + +// We trust the user: He must have used -mpentiumpro or -mpentium +// if that is what he wants. +#if defined(pentiumpro) || defined(pentium) +# define ACE_HAS_PENTIUM +#endif + +#if !defined (ACE_HAS_WINNT4) +# if (defined (WINNT) && WINNT == 1) \ + || (defined (__WINNT__) && __WINNT__ == 1) +# define ACE_HAS_WINNT4 1 +# else +# define ACE_HAS_WINNT4 0 +# endif +#endif + +#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS)) + +#include "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MINGW_H */ diff --git a/ace/config-win32.h b/ace/config-win32.h index 61b4a79344b..410d788d9bd 100644 --- a/ace/config-win32.h +++ b/ace/config-win32.h @@ -5,10 +5,10 @@ * * $Id$ * - * @brief Microsoft Windows configuration file. + * @brief Microsoft Windows configuration file. * * This file is the ACE configuration file for all of Microsoft Windows - * platforms that ACE runs on. Based on preprocessor definitions, it + * platforms that ACE runs on. Based on preprocessor definitions, it * includes other more specific configuration files. * * @author Darrell Brunsch <brunsch@cs.wustl.edu> @@ -44,6 +44,8 @@ # include "ace/config-win32-visualage.h" #elif defined (ghs) # include "ace/config-win32-ghs.h" +#elif defined (__MINGW32__) +# include "ace/config-win32-mingw.h" #else # error Compiler is not supported #endif diff --git a/ace/streams.h b/ace/streams.h index f724ad03e7e..363f580bd0b 100644 --- a/ace/streams.h +++ b/ace/streams.h @@ -130,6 +130,7 @@ # include /**/ <istream.h> # include /**/ <ostream.h> # endif /* _MSC_VER */ +# elif !defined (__MINGW32__) # include /**/ <strstrea.h> // VSB # else # include /**/ <strstream.h> |