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 | |
parent | 993bea83732043d16f512b0423f3a0f3669c48f5 (diff) | |
download | ATCD-1b2276da2110d08dfb38bf6f64000a293e1fe421.tar.gz |
ChangeLogTag:Sat Apr 21 15:31:27 2001 Carlos O'Ryan <coryan@uci.edu>
83 files changed, 1676 insertions, 496 deletions
diff --git a/ChangeLog b/ChangeLog index 25931b26024..2feaeb44477 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,89 @@ +Sat Apr 21 15:31:27 2001 Carlos O'Ryan <coryan@uci.edu> + + * PACE/pace/ctype.h: + * PACE/pace/config/compiler.h: + * PACE/pace/config/platform.h: + * PACE/pace/win32/pthread.c: + * PACE/pace/win32/pthread.inl: + * PACE/pace/win32/semaphore.c: + * PACE/pace/win32/semaphore.h: + * PACE/pace/win32/signal.inl: + * PACE/pace/win32/socket.c: + * PACE/pace/win32/socket.h: + * PACE/pace/win32/socket.inl: + * PACE/pace/win32/stdlib.inl: + * PACE/pace/win32/unistd.h: + * PACE/pace/win32/unistd.inl: + * PACE/pace/win32/utime.c: + * PACE/pace/win32/utsname.c: + * PACE/pace/win32/utsname.inl: + * PACE/pace/win32/wait.inl: + * ace/ACE.cpp: + * ace/Basic_Types.h: + * ace/Configuration.cpp: + * ace/Handle_Gobbler.i: + * ace/Lib_Find.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/Log_Msg.cpp: + * ace/Makefile: + * ace/Mem_Map.cpp: + * ace/Memory_Pool.cpp: + * ace/Message_Queue.i: + * ace/NT_Service.cpp: + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + * ace/OS_String.cpp: + * ace/Process.cpp: + * ace/Process_Manager.cpp: + * ace/Registry.cpp: + * ace/SOCK_Connector.i: + * ace/Sock_Connect.cpp: + * ace/TTY_IO.cpp: + * ace/WFMO_Reactor.cpp: + * ace/WFMO_Reactor.i: + * ace/WIN32_Asynch_IO.cpp: + * ace/config-cygwin32-common.h: + * ace/config-g++-common.h: + * ace/config-win32-common.h: + * ace/config-win32-mingw.h: + * ace/config-win32.h: + * ace/streams.h: + * examples/NT_Service/Makefile: + * examples/NT_Service/main.cpp: + * examples/NT_Service/ntsvc.cpp: + * include/makeinclude/platform_cygwin32.GNU: + * include/makeinclude/platform_gnuwin32_common.GNU: + * include/makeinclude/platform_mingw32.GNU: + * include/makeinclude/rules.local.GNU: + * include/makeinclude/wrapper_macros.GNU: + * tests/CDR_File_Test.cpp: + * tests/Cached_Accept_Conn_Test.cpp: + * tests/Cached_Conn_Test.cpp: + * tests/Conn_Test.cpp: + * tests/Handle_Set_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/MEM_Stream_Test.h: + * tests/MM_Shared_Memory_Test.cpp: + * tests/MT_SOCK_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Mem_Map_Test.cpp: + * tests/OS_Test.cpp: + * tests/Priority_Reactor_Test.cpp: + * tests/Process_Strategy_Test.cpp: + * tests/Reactor_Exceptions_Test.cpp: + * tests/Reactor_Notify_Test.cpp: + * tests/SOCK_Send_Recv_Test.cpp: + * tests/SOCK_Test.cpp: + * tests/SPIPE_Test.cpp: + * tests/Svc_Handler_Test.cpp: + * tests/run_tests.bat: + * tests/run_tests.sh: + * tests/RMCast/RMCast_Fragment_Test.cpp: + Add support for mingw (www.mingw.org) and partial support for + cygwin (http://cygwin.com/). Many thanks to Cristian Ferretti + <cristian_ferretti@yahoo.com> + Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> * ace/CDR_Stream.i (align_write_ptr): @@ -6,13 +92,13 @@ Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> Fri Apr 20 19:37:53 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/Get_Opt.h: Updated the documentation to match the constructor - arguments for ACE_Get_Opt. Thanks to Benot Desmeules - <bdesmeules@eurekium.com> for reporting this. - - * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on - Linux for the OS/390 OS. Thanks to James Dorsey - <James.Dorsey@acxiom.com> for reporting this. + * ace/Get_Opt.h: Updated the documentation to match the constructor + arguments for ACE_Get_Opt. Thanks to Benot Desmeules + <bdesmeules@eurekium.com> for reporting this. + + * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on + Linux for the OS/390 OS. Thanks to James Dorsey + <James.Dorsey@acxiom.com> for reporting this. Fri Apr 20 00:57:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 25931b26024..2feaeb44477 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,89 @@ +Sat Apr 21 15:31:27 2001 Carlos O'Ryan <coryan@uci.edu> + + * PACE/pace/ctype.h: + * PACE/pace/config/compiler.h: + * PACE/pace/config/platform.h: + * PACE/pace/win32/pthread.c: + * PACE/pace/win32/pthread.inl: + * PACE/pace/win32/semaphore.c: + * PACE/pace/win32/semaphore.h: + * PACE/pace/win32/signal.inl: + * PACE/pace/win32/socket.c: + * PACE/pace/win32/socket.h: + * PACE/pace/win32/socket.inl: + * PACE/pace/win32/stdlib.inl: + * PACE/pace/win32/unistd.h: + * PACE/pace/win32/unistd.inl: + * PACE/pace/win32/utime.c: + * PACE/pace/win32/utsname.c: + * PACE/pace/win32/utsname.inl: + * PACE/pace/win32/wait.inl: + * ace/ACE.cpp: + * ace/Basic_Types.h: + * ace/Configuration.cpp: + * ace/Handle_Gobbler.i: + * ace/Lib_Find.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/Log_Msg.cpp: + * ace/Makefile: + * ace/Mem_Map.cpp: + * ace/Memory_Pool.cpp: + * ace/Message_Queue.i: + * ace/NT_Service.cpp: + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + * ace/OS_String.cpp: + * ace/Process.cpp: + * ace/Process_Manager.cpp: + * ace/Registry.cpp: + * ace/SOCK_Connector.i: + * ace/Sock_Connect.cpp: + * ace/TTY_IO.cpp: + * ace/WFMO_Reactor.cpp: + * ace/WFMO_Reactor.i: + * ace/WIN32_Asynch_IO.cpp: + * ace/config-cygwin32-common.h: + * ace/config-g++-common.h: + * ace/config-win32-common.h: + * ace/config-win32-mingw.h: + * ace/config-win32.h: + * ace/streams.h: + * examples/NT_Service/Makefile: + * examples/NT_Service/main.cpp: + * examples/NT_Service/ntsvc.cpp: + * include/makeinclude/platform_cygwin32.GNU: + * include/makeinclude/platform_gnuwin32_common.GNU: + * include/makeinclude/platform_mingw32.GNU: + * include/makeinclude/rules.local.GNU: + * include/makeinclude/wrapper_macros.GNU: + * tests/CDR_File_Test.cpp: + * tests/Cached_Accept_Conn_Test.cpp: + * tests/Cached_Conn_Test.cpp: + * tests/Conn_Test.cpp: + * tests/Handle_Set_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/MEM_Stream_Test.h: + * tests/MM_Shared_Memory_Test.cpp: + * tests/MT_SOCK_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Mem_Map_Test.cpp: + * tests/OS_Test.cpp: + * tests/Priority_Reactor_Test.cpp: + * tests/Process_Strategy_Test.cpp: + * tests/Reactor_Exceptions_Test.cpp: + * tests/Reactor_Notify_Test.cpp: + * tests/SOCK_Send_Recv_Test.cpp: + * tests/SOCK_Test.cpp: + * tests/SPIPE_Test.cpp: + * tests/Svc_Handler_Test.cpp: + * tests/run_tests.bat: + * tests/run_tests.sh: + * tests/RMCast/RMCast_Fragment_Test.cpp: + Add support for mingw (www.mingw.org) and partial support for + cygwin (http://cygwin.com/). Many thanks to Cristian Ferretti + <cristian_ferretti@yahoo.com> + Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> * ace/CDR_Stream.i (align_write_ptr): @@ -6,13 +92,13 @@ Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> Fri Apr 20 19:37:53 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/Get_Opt.h: Updated the documentation to match the constructor - arguments for ACE_Get_Opt. Thanks to Benot Desmeules - <bdesmeules@eurekium.com> for reporting this. - - * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on - Linux for the OS/390 OS. Thanks to James Dorsey - <James.Dorsey@acxiom.com> for reporting this. + * ace/Get_Opt.h: Updated the documentation to match the constructor + arguments for ACE_Get_Opt. Thanks to Benot Desmeules + <bdesmeules@eurekium.com> for reporting this. + + * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on + Linux for the OS/390 OS. Thanks to James Dorsey + <James.Dorsey@acxiom.com> for reporting this. Fri Apr 20 00:57:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 25931b26024..2feaeb44477 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,89 @@ +Sat Apr 21 15:31:27 2001 Carlos O'Ryan <coryan@uci.edu> + + * PACE/pace/ctype.h: + * PACE/pace/config/compiler.h: + * PACE/pace/config/platform.h: + * PACE/pace/win32/pthread.c: + * PACE/pace/win32/pthread.inl: + * PACE/pace/win32/semaphore.c: + * PACE/pace/win32/semaphore.h: + * PACE/pace/win32/signal.inl: + * PACE/pace/win32/socket.c: + * PACE/pace/win32/socket.h: + * PACE/pace/win32/socket.inl: + * PACE/pace/win32/stdlib.inl: + * PACE/pace/win32/unistd.h: + * PACE/pace/win32/unistd.inl: + * PACE/pace/win32/utime.c: + * PACE/pace/win32/utsname.c: + * PACE/pace/win32/utsname.inl: + * PACE/pace/win32/wait.inl: + * ace/ACE.cpp: + * ace/Basic_Types.h: + * ace/Configuration.cpp: + * ace/Handle_Gobbler.i: + * ace/Lib_Find.cpp: + * ace/Local_Name_Space_T.cpp: + * ace/Log_Msg.cpp: + * ace/Makefile: + * ace/Mem_Map.cpp: + * ace/Memory_Pool.cpp: + * ace/Message_Queue.i: + * ace/NT_Service.cpp: + * ace/OS.cpp: + * ace/OS.h: + * ace/OS.i: + * ace/OS_String.cpp: + * ace/Process.cpp: + * ace/Process_Manager.cpp: + * ace/Registry.cpp: + * ace/SOCK_Connector.i: + * ace/Sock_Connect.cpp: + * ace/TTY_IO.cpp: + * ace/WFMO_Reactor.cpp: + * ace/WFMO_Reactor.i: + * ace/WIN32_Asynch_IO.cpp: + * ace/config-cygwin32-common.h: + * ace/config-g++-common.h: + * ace/config-win32-common.h: + * ace/config-win32-mingw.h: + * ace/config-win32.h: + * ace/streams.h: + * examples/NT_Service/Makefile: + * examples/NT_Service/main.cpp: + * examples/NT_Service/ntsvc.cpp: + * include/makeinclude/platform_cygwin32.GNU: + * include/makeinclude/platform_gnuwin32_common.GNU: + * include/makeinclude/platform_mingw32.GNU: + * include/makeinclude/rules.local.GNU: + * include/makeinclude/wrapper_macros.GNU: + * tests/CDR_File_Test.cpp: + * tests/Cached_Accept_Conn_Test.cpp: + * tests/Cached_Conn_Test.cpp: + * tests/Conn_Test.cpp: + * tests/Handle_Set_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/MEM_Stream_Test.h: + * tests/MM_Shared_Memory_Test.cpp: + * tests/MT_SOCK_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Mem_Map_Test.cpp: + * tests/OS_Test.cpp: + * tests/Priority_Reactor_Test.cpp: + * tests/Process_Strategy_Test.cpp: + * tests/Reactor_Exceptions_Test.cpp: + * tests/Reactor_Notify_Test.cpp: + * tests/SOCK_Send_Recv_Test.cpp: + * tests/SOCK_Test.cpp: + * tests/SPIPE_Test.cpp: + * tests/Svc_Handler_Test.cpp: + * tests/run_tests.bat: + * tests/run_tests.sh: + * tests/RMCast/RMCast_Fragment_Test.cpp: + Add support for mingw (www.mingw.org) and partial support for + cygwin (http://cygwin.com/). Many thanks to Cristian Ferretti + <cristian_ferretti@yahoo.com> + Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> * ace/CDR_Stream.i (align_write_ptr): @@ -6,13 +92,13 @@ Fri Apr 20 18:21:41 2001 Carlos O'Ryan <coryan@uci.edu> Fri Apr 20 19:37:53 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> - * ace/Get_Opt.h: Updated the documentation to match the constructor - arguments for ACE_Get_Opt. Thanks to Benot Desmeules - <bdesmeules@eurekium.com> for reporting this. - - * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on - Linux for the OS/390 OS. Thanks to James Dorsey - <James.Dorsey@acxiom.com> for reporting this. + * ace/Get_Opt.h: Updated the documentation to match the constructor + arguments for ACE_Get_Opt. Thanks to Benot Desmeules + <bdesmeules@eurekium.com> for reporting this. + + * ace/TP_Reactor.cpp: Added a workaround for compiling ACE on + Linux for the OS/390 OS. Thanks to James Dorsey + <James.Dorsey@acxiom.com> for reporting this. Fri Apr 20 00:57:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> diff --git a/PACE/pace/config/compiler.h b/PACE/pace/config/compiler.h index 92e25c97a05..6928db40a93 100644 --- a/PACE/pace/config/compiler.h +++ b/PACE/pace/config/compiler.h @@ -28,7 +28,11 @@ * static. Otherwise, we want PACE_INLINE to be defined as nothing. */ # if defined (PACE_HAS_INLINE) -# define PACE_INLINE static +# if defined (__GNUC__) +# define PACE_INLINE static inline +# else +# define PACE_INLINE static +# endif # else # define PACE_INLINE # endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/config/platform.h b/PACE/pace/config/platform.h index 333e845197e..ec206c25599 100644 --- a/PACE/pace/config/platform.h +++ b/PACE/pace/config/platform.h @@ -64,6 +64,7 @@ # define PACE_WIN32 0 /* Doesn't use the makefile! */ #elif defined (WIN32) +# undef PACE_WIN32 # define PACE_WIN32 2000 # define PACE_LACKS_POSIX PACE_WIN32 # define PACE_LINUX 0 diff --git a/PACE/pace/ctype.h b/PACE/pace/ctype.h index ff8ca36b242..10a457f51ba 100644 --- a/PACE/pace/ctype.h +++ b/PACE/pace/ctype.h @@ -147,16 +147,6 @@ extern "C" { PACE_INLINE int pace_toupper (int c); #endif /* PACE_HAS_POSIX_CLS_UOF */ -#if defined (PACE_HAS_INLINE) -# if (PACE_HAS_POSIX) -# include "pace/posix/ctype.inl" -# elif (PACE_VXWORKS) -# include "pace/vxworks/ctype.inl" -# elif (PACE_WIN32) -# include "pace/win32/ctype.inl" -# endif -#endif /* PACE_HAS_INLINE */ - #if defined (PACE_HAS_CPLUSPLUS) } #endif /* PACE_HAS_CPLUSPLUS */ diff --git a/PACE/pace/win32/pthread.c b/PACE/pace/win32/pthread.c index 790add37a53..a314c903e9c 100644 --- a/PACE/pace/win32/pthread.c +++ b/PACE/pace/win32/pthread.c @@ -31,6 +31,9 @@ pthread_create (pace_pthread_t * thread, void * (*start_routine) (void*), void * arg) { + /* Get around a gcc bug. */ + typedef unsigned (__stdcall *bthrexr)(void*); + unsigned flags = 0x0, thr_addr = 0x0; if (attr->sparam_.sched_priority != THREAD_PRIORITY_NORMAL) { @@ -38,12 +41,13 @@ pthread_create (pace_pthread_t * thread, flags = CREATE_SUSPENDED; } - thread = (pace_pthread_t) _beginthreadex (0, - attr->stack_size_, - (unsigned (__stdcall *)(void*))start_routine, - arg, - flags, - &thr_addr); + thread = (pace_pthread_t) + _beginthreadex (0, + attr->stack_size_, + (bthrexr) start_routine, + arg, + flags, + &thr_addr); if (flags == CREATE_SUSPENDED && thread != 0) { @@ -77,6 +81,7 @@ pthread_getschedparam (pace_pthread_t thread, int * policy, pace_sched_param * param) { + PACE_UNUSED_ARG (policy) if (param != (pace_sched_param*)0) { param->sched_priority = GetThreadPriority (thread); @@ -92,6 +97,8 @@ pthread_getschedparam (pace_pthread_t thread, int policy, const pace_sched_param * param) { + PACE_UNUSED_ARG(policy); + if (SetThreadPriority (thread, param->sched_priority)) { return 0; diff --git a/PACE/pace/win32/pthread.inl b/PACE/pace/win32/pthread.inl index 7a61a99d66f..3fea1729342 100644 --- a/PACE/pace/win32/pthread.inl +++ b/PACE/pace/win32/pthread.inl @@ -37,6 +37,11 @@ pace_pthread_create (pace_pthread_t * thread, void * (*start_routine) (void*), void * arg) { + PACE_UNUSED_ARG (thread); + PACE_UNUSED_ARG (attr); + PACE_UNUSED_ARG (start_routine); + PACE_UNUSED_ARG (arg); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); } #endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/win32/semaphore.c b/PACE/pace/win32/semaphore.c index 401ebddc5a5..23728df5c29 100644 --- a/PACE/pace/win32/semaphore.c +++ b/PACE/pace/win32/semaphore.c @@ -47,6 +47,8 @@ sem_destroy (pace_sem_t * sem) int sem_init (pace_sem_t * sem, int pshared, unsigned int value) { + PACE_UNUSED_ARG (pshared); + /* Create the semaphore with its value initialized to <count> and its maximum value initialized to <max>. diff --git a/PACE/pace/win32/semaphore.h b/PACE/pace/win32/semaphore.h index d7e395f7fc6..7abd89211f0 100644 --- a/PACE/pace/win32/semaphore.h +++ b/PACE/pace/win32/semaphore.h @@ -40,7 +40,7 @@ extern "C" { #endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ #if (PACE_HAS_POSIX_NONUOF_FUNCS) - pace_sem_t * sem_open (const char * name, int oflag, ...); + PACE_INLINE pace_sem_t * sem_open (const char * name, int oflag, ...); #endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ #if (PACE_HAS_POSIX_NONUOF_FUNCS) diff --git a/PACE/pace/win32/signal.inl b/PACE/pace/win32/signal.inl index 57c4fd87ad7..437d609f926 100644 --- a/PACE/pace/win32/signal.inl +++ b/PACE/pace/win32/signal.inl @@ -142,6 +142,7 @@ pace_sigqueue (pace_pid_t pid, int signo, { PACE_UNUSED_ARG (pid); PACE_UNUSED_ARG (signo); + PACE_UNUSED_ARG (value); PACE_ERRNO_NO_SUPPORT_RETURN (-1); } #endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/win32/socket.c b/PACE/pace/win32/socket.c new file mode 100644 index 00000000000..9b9450e3886 --- /dev/null +++ b/PACE/pace/win32/socket.c @@ -0,0 +1,5 @@ +#include "pace/sys/socket.h" + +/* + * Empty for win32. + */ diff --git a/PACE/pace/win32/socket.h b/PACE/pace/win32/socket.h new file mode 100644 index 00000000000..bfaaaab9953 --- /dev/null +++ b/PACE/pace/win32/socket.h @@ -0,0 +1,5 @@ +/* + * $Id$ + * + * Empty for win32. + */ diff --git a/PACE/pace/win32/socket.inl b/PACE/pace/win32/socket.inl new file mode 100644 index 00000000000..72935ceee77 --- /dev/null +++ b/PACE/pace/win32/socket.inl @@ -0,0 +1,3 @@ +/* + * Empty for win32. + */ diff --git a/PACE/pace/win32/stdlib.inl b/PACE/pace/win32/stdlib.inl index 455943da667..3597e1954dc 100644 --- a/PACE/pace/win32/stdlib.inl +++ b/PACE/pace/win32/stdlib.inl @@ -230,6 +230,17 @@ pace_strtoul (const char* nptr, #if (PACE_HAS_POSIX_NONUOF_FUNCS) PACE_INLINE +int +pace_system (const char* string) +{ + PACE_UNUSED_ARG (string); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} + +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE pace_size_t pace_wcstombs (char* s, const pace_wchar_t* pwcs, diff --git a/PACE/pace/win32/unistd.h b/PACE/pace/win32/unistd.h index 7751ddcf509..1292cea5bd9 100644 --- a/PACE/pace/win32/unistd.h +++ b/PACE/pace/win32/unistd.h @@ -104,7 +104,7 @@ typedef ssize_t pace_ssize_t; #if (PACE_HAS_POSIX_DI_UOF) pace_ssize_t pace_win32_read (PACE_HANDLE fildes, - const void * buf, + void * buf, pace_size_t nbyte); #endif /* PACE_HAS_POSIX_DI_UOF */ diff --git a/PACE/pace/win32/unistd.inl b/PACE/pace/win32/unistd.inl index 29599b5ee22..83f3f2a9e14 100644 --- a/PACE/pace/win32/unistd.inl +++ b/PACE/pace/win32/unistd.inl @@ -109,11 +109,11 @@ int pace_execv (const char * path, char * const argv[]) { -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) || defined(__MINGW32__) return execv (path, argv); -#else /* __BORLANDC__ */ +#else /* __BORLANDC__ || __MINGW32__ */ return _execv (path, (const char * const *) argv); -#endif /* __BORLANDC__ */ +#endif /* __BORLANDC__ || __MINGW32__ */ /* if successful, this operation does NOT return */ } #endif /* PACE_HAS_POSIX_MP_UOF */ @@ -125,12 +125,12 @@ pace_execve (const char * path, char * const argv[], char * const envp[]) { -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) || defined (__MINGW32__) return execve (path, argv, envp); -#else /* __BORLANDC__ */ +#else /* __BORLANDC__ || __MINGW32__ */ return _execve (path, (const char *const *) argv, (const char *const *) envp); -#endif /* __BORLANDC__ */ +#endif /* __BORLANDC__ || __MINGW32__ */ /* if successful, this operation does NOT return */ } #endif /* PACE_HAS_POSIX_MP_UOF */ @@ -141,11 +141,11 @@ int pace_execvp (const char * file, char * const argv[]) { -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) || defined (__MINGW32__) return execvp (file, argv); -#else /* __BORLANDC__ */ +#else /* __BORLANDC__ || __MINGW32__ */ return _execvp (file, (const char *const *) argv); -#endif /* __BORLANDC__ */ +#endif /* __BORLANDC__ || __MINGW32__ */ /* if successful, this operation does NOT return */ } #endif /* PACE_HAS_POSIX_MP_UOF */ @@ -262,6 +262,8 @@ PACE_INLINE int pace_getlogin_r (char * name, size_t namesize) { + PACE_UNUSED_ARG (name); + PACE_UNUSED_ARG (namesize); PACE_ERRNO_NO_SUPPORT_RETURN (-1); } #endif /* PACE_HAS_POSIX_UGR_UOF */ @@ -310,11 +312,11 @@ PACE_INLINE int pace_isatty (int fildes) { -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) || defined (__MINGW32__) return isatty (fildes); -#else /* __BORLANDC__ */ +#else /* __BORLANDC__ || __MINGW32__ */ return _isatty (fildes); -#endif /* __BORLANDC__ */ +#endif /* __BORLANDC__ || __MINGW32__ */ } #endif /* PACE_HAS_POSIX_DS_UOF */ @@ -473,7 +475,7 @@ PACE_INLINE char * pace_ttyname (PACE_HANDLE fildes) { - char * retval = (void*)0; + char * retval = (char*) 0; PACE_UNUSED_ARG (fildes); PACE_ERRNO_NO_SUPPORT_RETURN (retval); } diff --git a/PACE/pace/win32/utime.c b/PACE/pace/win32/utime.c index 1ee2542885b..cafec0eb6cb 100644 --- a/PACE/pace/win32/utime.c +++ b/PACE/pace/win32/utime.c @@ -23,15 +23,19 @@ int win32_utime (const char * path, const pace_utimbuf * times) { + PACE_UNUSED_ARG (path); + PACE_UNUSED_ARG (times); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); - /* Not yet working +#if 0 + /* Not yet working */ char * path2 = (char*) malloc (sizeof (path)); pace_strcpy (path2, path); pace_utimbuf * times2 = (pace_utimbuf*) malloc (sizeof (pace_utimbuf); memcpy (times2, times, sizeof times); return _utime (path2, times2); - */ +#endif } #endif /* PACE_HAS_POSIX_FS_UOF */ diff --git a/PACE/pace/win32/utsname.c b/PACE/pace/win32/utsname.c index 208b3f2f142..9963f1ff624 100644 --- a/PACE/pace/win32/utsname.c +++ b/PACE/pace/win32/utsname.c @@ -23,6 +23,7 @@ int uname (pace_utsname * name) { + PACE_UNUSED_ARG (name); PACE_ERRNO_NO_SUPPORT_RETURN (-1); #if 0 /* Emulation: Not bug free! :-/ */ diff --git a/PACE/pace/win32/utsname.inl b/PACE/pace/win32/utsname.inl index e906fc1e131..bc79bb80db4 100644 --- a/PACE/pace/win32/utsname.inl +++ b/PACE/pace/win32/utsname.inl @@ -20,6 +20,7 @@ PACE_INLINE int pace_uname (pace_utsname * name) { + PACE_UNUSED_ARG (name); PACE_ERRNO_NO_SUPPORT_RETURN (-1); } #endif /* PACE_HAS_POSIX_SP_UOF */ diff --git a/PACE/pace/win32/wait.inl b/PACE/pace/win32/wait.inl index 02c1aca2ce7..166a0936d10 100644 --- a/PACE/pace/win32/wait.inl +++ b/PACE/pace/win32/wait.inl @@ -18,8 +18,12 @@ PACE_INLINE pace_pid_t pace_wait (int * statloc) { - pace_pid_t retval = -1; - PACE_ERRNO_NO_SUPPORT_RETURN (retval); + PACE_UNUSED_ARG (statloc); + + { + pace_pid_t retval = -1; + PACE_ERRNO_NO_SUPPORT_RETURN (retval); + } } #endif /* PACE_HAS_POSIX_MP_UOF */ @@ -28,8 +32,14 @@ PACE_INLINE pace_pid_t pace_waitpid (pace_pid_t pid, int * statloc, int options) { + PACE_UNUSED_ARG (pid); + PACE_UNUSED_ARG (statloc); + PACE_UNUSED_ARG (options); + /* ACE version uses a HANDLE */ - pace_pid_t retval = -1; - PACE_ERRNO_NO_SUPPORT_RETURN (retval); + { + pace_pid_t retval = -1; + PACE_ERRNO_NO_SUPPORT_RETURN (retval); + } } #endif /* PACE_HAS_POSIX_MP_UOF */ 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> diff --git a/examples/NT_Service/Makefile b/examples/NT_Service/Makefile new file mode 100644 index 00000000000..9a6d67bf8e9 --- /dev/null +++ b/examples/NT_Service/Makefile @@ -0,0 +1,41 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile for NT_Service +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +BIN = ntsvc + +SRC = main.cpp ntsvc.cpp + +LDLIBS = + +VLDLIBS = $(LDLIBS:%=%$(VAR)) + +BUILD = $(VBIN) + +INSTALL = + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. diff --git a/examples/NT_Service/main.cpp b/examples/NT_Service/main.cpp index 74472b4af4d..c517615a11e 100644 --- a/examples/NT_Service/main.cpp +++ b/examples/NT_Service/main.cpp @@ -14,7 +14,7 @@ // runs on Win32. // // = AUTHOR -// Gonzalo Diethelm <gonzo@cs.wustl.edu> +// Gonzalo Diethelm <gonzo@cs.wustl.edu> // and Steve Huston <shuston@riverace.com> // // ============================================================================ @@ -72,7 +72,7 @@ Process::~Process (void) ACE::fini (); } -void +void Process::print_usage_and_die (void) { ACE_DEBUG ((LM_INFO, @@ -89,11 +89,11 @@ Process::print_usage_and_die (void) ACE_OS::exit(1); } -void +void Process::parse_args (int argc, ACE_TCHAR* argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("i:rskt:d")); - int c; + int c; while ((c = get_opt ()) != -1) switch (c) @@ -143,6 +143,7 @@ Process::parse_args (int argc, ACE_TCHAR* argv[]) static BOOL __stdcall ConsoleHandler (DWORD ctrlType) { + ACE_UNUSED_ARG (ctrlType); SERVICE::instance ()->handle_control (SERVICE_CONTROL_STOP); return TRUE; } @@ -151,7 +152,7 @@ ACE_NT_SERVICE_DEFINE (Beeper, Service, ACE_TEXT ("Annoying Beeper Service")); -int +int Process::run (int argc, ACE_TCHAR* argv[]) { SERVICE::instance ()->name (ACE_TEXT ("Beeper"), @@ -195,12 +196,18 @@ Process::run (int argc, ACE_TCHAR* argv[]) "%p\n", "Couldn't start service")); } - + return 0; } -int +int main (int argc, ACE_TCHAR* argv[]) { return PROCESS::instance ()->run (argc, argv); } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Singleton<Process, ACE_Mutex>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Singleton<Process, ACE_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/NT_Service/ntsvc.cpp b/examples/NT_Service/ntsvc.cpp index b08f5ba0cab..c671f4a7967 100644 --- a/examples/NT_Service/ntsvc.cpp +++ b/examples/NT_Service/ntsvc.cpp @@ -13,7 +13,7 @@ // seconds until the service is stopped. // // = AUTHOR -// Gonzalo Diethelm <gonzo@cs.wustl.edu> +// Gonzalo Diethelm <gonzo@cs.wustl.edu> // and Steve Huston <shuston@riverace.com> // // ============================================================================ @@ -36,10 +36,10 @@ Service::Service (void) // handles requests for stop and shutdown by calling terminate (). // All others get handled by calling up to inherited::handle_control. -void +void Service::handle_control (DWORD control_code) { - if (control_code == SERVICE_CONTROL_SHUTDOWN + if (control_code == SERVICE_CONTROL_SHUTDOWN || control_code == SERVICE_CONTROL_STOP) { report_status (SERVICE_STOP_PENDING); @@ -58,7 +58,7 @@ Service::handle_control (DWORD control_code) // doesn't do anything except aid on popping the reactor off its wait // and causing a drop out of handle_events. -int +int Service::handle_exception (ACE_HANDLE) { return 0; @@ -66,10 +66,11 @@ Service::handle_exception (ACE_HANDLE) // Beep every two seconds. This is what this NT service does... -int +int Service::handle_timeout (const ACE_Time_Value &tv, const void *) { + ACE_UNUSED_ARG (tv); MessageBeep (MB_OK); return 0; } @@ -78,7 +79,7 @@ Service::handle_timeout (const ACE_Time_Value &tv, // the initial configuration and runs the event loop until a shutdown // request is received. -int +int Service::svc (void) { ACE_DEBUG ((LM_DEBUG, @@ -101,3 +102,9 @@ Service::svc (void) "Shutting down\n")); return 0; } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Singleton<Service, ACE_Mutex>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Singleton<Service, ACE_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/include/makeinclude/platform_cygwin32.GNU b/include/makeinclude/platform_cygwin32.GNU new file mode 100644 index 00000000000..69837b81084 --- /dev/null +++ b/include/makeinclude/platform_cygwin32.GNU @@ -0,0 +1,24 @@ +# $Id$ + +# +# This file should allow to build ACE for cygwin32 with cygwin tools. +# +# Edit to change TCPU and w32api defs below. +# +# Don't forget to define the ACE_ROOT environment variable! +# + +# +# Chose your target CPU (uncomment ONE of these). +# +TCPU = pentiumpro +#TCPU = pentium +#TCPU = i486 +#TCPU = i386 + +cygwin32 = 1 +threads = 0 +static_libs_only = 1 +optimize = 0 + +include $(ACE_ROOT)/include/makeinclude/platform_gnuwin32_common.GNU diff --git a/include/makeinclude/platform_gnuwin32_common.GNU b/include/makeinclude/platform_gnuwin32_common.GNU new file mode 100644 index 00000000000..412420bf95a --- /dev/null +++ b/include/makeinclude/platform_gnuwin32_common.GNU @@ -0,0 +1,96 @@ +# $Id$ + +ifneq ($(mingw32),1) + ifneq ($(cygwin32),1) + fail := \ + $(shell \ + echo "You should not use this file but one of"; \ + echo "platform_mingw32.GNU or platform_cygwin32.GNU"; \ + exit 1) + endif +endif + +# debug = 1 +# optimize = 1 +# exceptions = 0 + +ifndef winsock2 + winsock2 = 1 +endif + +ifndef exceptions + exceptions = 0 +endif +ifeq (,$(debug)) + debug = 1 +endif +ifeq (,$(optimize)) + optimize = 1 +endif +ifeq (,$(threads)) + threads = 1 +endif +ifeq ($(threads),0) + CFLAGS += -DACE_MT_SAFE=0 +endif # threads + +ifeq ($(mingw32),1) +CFLAGS += \ + -I$(MINGW_BASE)/mingw32/include \ + -I$(MINGW_BASE)/w32api/include \ + -I$(MINGW_BASE)/include +LDFLAGS += \ + -L$(MINGW_BASE)/mingw32/lib \ + -L$(MINGW_BASE)/w32api/lib \ + -L$(MINGW_BASE)/lib +endif + +ifeq ($(debug),0) +CFLAGS += -DNDEBUG +endif + +CC = gcc -m$(TCPU) +CXX = g++ -m$(TCPU) + +# Never use -pipe with 95/98. On NT/2000, not sure if it helps. +CFLAGS += -W -Wall -Wpointer-arith +ifeq ($(threads),1) + CC += -mthreads + CXX += -mthreads +endif # threads + +ifeq ($(IMPLICIT_TEMPLATES_FLAG),) + IMPLICIT_TEMPLATES_FLAG=-fno-implicit-templates +endif + +CCFLAGS += $(CFLAGS) $(IMPLICIT_TEMPLATES_FLAG) +DCFLAGS += -g +DLD = $(CXX) +LD = $(CXX) + +ifeq ($(mingw32),1) +ifeq ($(winsock2),1) +LIBS += -lws2_32 -lmswsock +endif +LIBS += -lwsock32 +endif + +VSHDIR = .obj/ + +OCFLAGS += -O3 +PIC = +AR = ar +ARFLAGS = rsuv +RANLIB = ranlib +SOEXT = dll +SOFLAGS = $(CPPFLAGS) +SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $< +# The sed below is a workaround to a bug in ld. +SHLIBBUILD = dlltool --export-all --output-def $@.def --dllname $@ $(VSHOBJS1) && mv $@.def $@.def.old && sed 's/;.*$$//g' < $@.def.old > $@.def && $(SOLINK.cc) -Wl,--enable-auto-image-base -Wl,--out-implib,$@.a -shared -o $@ $(LDFLAGS) $@.def $(VSHOBJS1) $(LIBS) && $(RM) $@.def.old $@.def + +ifeq ($(exceptions),1) +SHLIBBUILD += \ + ;echo "Warning: exceptions fail when mixing DLL and non DLL calls." +endif + +PRELIB = @true diff --git a/include/makeinclude/platform_mingw32.GNU b/include/makeinclude/platform_mingw32.GNU new file mode 100644 index 00000000000..ba2d31272df --- /dev/null +++ b/include/makeinclude/platform_mingw32.GNU @@ -0,0 +1,62 @@ +# $Id$ + +# +# This file should allow to build ACE for mingw32 with mingw tools. +# Edit to change TCPU and M32_BASE below. +# +# Don't forget to define the ACE_ROOT environment variable! +# + +# +# mingw32 packages as distributed from sourceforge: +# http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=15084 +# See also http://www.mingw.org. +# +# You will also need a GNU Make for win32 (so you can actualy +# USE this file :-). Tested with make/sh from cygwin. +# +# Tested with: +# +# mingw-runtime-0.5-20010221 +# w32api-0.5-20010301 +# gcc-2.95.2-20001116 +# binutils-2.10.91-20010114 +# ld-2.10.91-20010126 +# libbfd-2.10.91-20010121 +# +# Caveat: +# +# If ld complains about not finding crt2.o, dllcrt2.o or gcrt2.o +# when linking executables, you will need to modify the specs file for gcc: +# lib/gcc-lib/mingw32/2.95.2/specs +# look for the line after the one begining ``*startfile:'', and add +# full path as prefix for crt2, dllcrt2 and gcrt2 +# (i.e., change +# ... %{!shared:%{!mdll:crt2%O%s}} ... +# with +# ... %{!shared:%{!mdll:c:/mingw32/lib/gcc-lib/mingw32/2.95.2/crt2%O%s}} ... +# or something similar depending on the location of your instalation). +# + +# +# Chose your target CPU (uncomment ONE of these). +# +TCPU = pentiumpro +#TCPU = pentium +#TCPU = i486 +#TCPU = i386 + +# +# Define here mingw32 instalation location. +# These asumes no fancy hierachy, just all packages above unpacked on +# the same base directory. +# Optionally, you can define it as an environment variable, or set it +# on your platform_macros.GNU before including this file. +# +ifndef MINGW_BASE + MINGW_BASE = c:/live/local/mingw32 +endif + +mingw32 = 1 + +include $(ACE_ROOT)/include/makeinclude/platform_gnuwin32_common.GNU diff --git a/include/makeinclude/rules.local.GNU b/include/makeinclude/rules.local.GNU index ed0854313b6..756f5cea871 100644 --- a/include/makeinclude/rules.local.GNU +++ b/include/makeinclude/rules.local.GNU @@ -221,7 +221,7 @@ clean.local: -$(RM) -r SunWS_cache ir.out realclean.local: clean.local - -$(RM) $(BIN) $(BIN:%=%_debug) $(BIN:%=%_profile) $(BIN:%=%_optimize) $(LIB:%=%) $(LIB:%=%_debug) $(LIB:%=%_profile) $(LIB:%=%_optimize) $(SHLIB:%=%) $(SHLIB:%=%_debug) $(SHLIB:%=%_profile) $(SHLIB:%=%_optimize) $(SHLIBA:%=%) $(BIN2) $(BIN2:%=%_debug) $(BIN2:%=%_profile) $(BIN2:%=%_optimize) $(LIB2:%=%) $(LIB2:%=%_debug) $(LIB2:%=%_profile) $(LIB2:%=%_optimize) $(SHLIB2:%=%) $(SHLIB2:%=%_debug) $(SHLIB2:%=%_profile) $(SHLIB2:%=%_optimize) $(SHLIBA2:%=%) + -$(RM) $(BIN) $(BIN:%=%_debug) $(BIN:%=%_profile) $(BIN:%=%_optimize) $(LIB:%=%) $(LIB:%=%_debug) $(LIB:%=%_profile) $(LIB:%=%_optimize) $(SHLIB:%=%) $(SHLIB:%=%.a) $(SHLIB:%=%_debug) $(SHLIB:%=%_profile) $(SHLIB:%=%_optimize) $(SHLIBA:%=%) $(BIN2) $(BIN2:%=%_debug) $(BIN2:%=%_profile) $(BIN2:%=%_optimize) $(LIB2:%=%) $(LIB2:%=%_debug) $(LIB2:%=%_profile) $(LIB2:%=%_optimize) $(SHLIB2:%=%) $(SHLIB2:%=%_debug) $(SHLIB2:%=%_profile) $(SHLIB2:%=%_optimize) $(SHLIBA2:%=%) #---------------------------------------------------------------------------- # Dependency generation target diff --git a/include/makeinclude/wrapper_macros.GNU b/include/makeinclude/wrapper_macros.GNU index 9d5e88d1548..bdbd1c912e8 100644 --- a/include/makeinclude/wrapper_macros.GNU +++ b/include/makeinclude/wrapper_macros.GNU @@ -279,13 +279,13 @@ endif ifeq ($(findstring g++,$(CXX)),g++) ifndef ACE_HAS_GNUG_PRE_2_8 - ifeq ($(notdir $(CXX)),g++) + ifeq ($(filter g++,$(notdir $(CXX))),g++) ACE_HAS_GNUG_PRE_2_8 := \ $(shell \ if $(CXX) --version | egrep '^(cygnus-)?2\.[0-7]' > /dev/null; then \ echo 1; else echo 0; fi) else # ! g++ - ifeq (eg++,$(notdir $(CXX)),eg++) + ifeq (eg++,$(filter g++,$(notdir $(CXX))),eg++) # Assume that eg++ is egcs. ACE_HAS_GNUG_PRE_2_8 := 0 else # ! plain g++ or eg++ @@ -568,7 +568,7 @@ ifdef shared_libs VDIR = .shobj/ ifeq ($(BIN),) #### No executables are being built, so don't create .obj/. - OBJDIRS = .shobj + OBJDIRS = $(VSHDIR) endif # BIN endif # ! VXWORKS endif # ! SHLIB diff --git a/tests/CDR_File_Test.cpp b/tests/CDR_File_Test.cpp index 010ae8683c6..49ae77be57a 100644 --- a/tests/CDR_File_Test.cpp +++ b/tests/CDR_File_Test.cpp @@ -341,6 +341,7 @@ main (int argc, ACE_TCHAR *argv[]) filename.set (fn); } + ACE_FILE_Connector connector; ACE_FILE_IO file; @@ -352,11 +353,17 @@ main (int argc, ACE_TCHAR *argv[]) 0, ((writing) ? (O_RDWR | O_CREAT) : O_RDONLY), ACE_DEFAULT_FILE_PERMS) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("connect failed for %p\n"), - filename.get_path_name ()), - 1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("connect failed for %p\n"), + filename.get_path_name ()), + 1); + +#if !defined (ACE_WIN32) \ + || (defined (ACE_HAS_WINNT4) && ACE_HAS_WINNT4 == 1) +# define TEST_CAN_UNLINK_IN_ADVANCE +#endif +#if defined(TEST_CAN_UNLINK_IN_ADVANCE) if (fn == 0) { // Unlink this file right away so that it is automatically removed @@ -367,6 +374,7 @@ main (int argc, ACE_TCHAR *argv[]) filename.get_path_name ()), 1); } +#endif CDR_Test cdr_test ('a', 0x00ff, @@ -393,6 +401,18 @@ main (int argc, ACE_TCHAR *argv[]) cdr_test); } +#if !defined (TEST_CAN_UNLINK_IN_ADVANCE) + if (fn == 0) + { + file.close (); + if (file.unlink () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("unlink failed for %p\n"), + filename.get_path_name ()), + 1); + } +#endif + ACE_END_TEST; return 0; } diff --git a/tests/Cached_Accept_Conn_Test.cpp b/tests/Cached_Accept_Conn_Test.cpp index dbc6eeace92..fba0e81eb94 100644 --- a/tests/Cached_Accept_Conn_Test.cpp +++ b/tests/Cached_Accept_Conn_Test.cpp @@ -149,12 +149,12 @@ typedef Accept_Strategy<Server_Svc_Handler, ACE_SOCK_ACCEPTOR> defined (ACE_HAS_GNU_REPO) // The explicit instantiations are necessary with g++ 2.91.66 // with -frepo, because it misses some of them. -# if defined (ghs) && defined(ACE_WIN32) +# if (defined (ghs) || defined(__MINGW32__)) && defined(ACE_WIN32) template class ACE_Node<ACE_HANDLE>; # endif // = Handle Gobbler # if (ACE_SIZEOF_INT != 4) && !defined (ACE_WIN32) -// These might be already instantiated in ace/stats.cpp +// These might be already instantiated in ace/stats.cpp // (if ACE_HANDLE == int && ACE_INT32 == int) template class ACE_Node<ACE_HANDLE>; # endif /* ACE_SIZEOF_INT != 4 && !ACE_WIN32 */ diff --git a/tests/Cached_Conn_Test.cpp b/tests/Cached_Conn_Test.cpp index 0c599fc769d..05220d9361f 100644 --- a/tests/Cached_Conn_Test.cpp +++ b/tests/Cached_Conn_Test.cpp @@ -124,12 +124,12 @@ typedef ACE_Cached_Connect_Strategy_Ex<Svc_Handler, ACE_SOCK_CONNECTOR, CACHING_ // The explicit instantiations are necessary with g++ 2.91.66 // with -frepo, because it misses some of them. -# if defined (ghs) && defined(ACE_WIN32) +# if (defined (ghs) || defined (__MINGW32__)) && defined (ACE_WIN32) template class ACE_Node<ACE_HANDLE>; # endif // = Handle Gobbler #if (ACE_SIZEOF_INT != 4) && !defined (ACE_WIN32) -// These might be already instantiated in ace/stats.cpp +// These might be already instantiated in ace/stats.cpp // (if ACE_HANDLE == int && ACE_INT32 == int) template class ACE_Node<ACE_HANDLE>; #endif /* ACE_SIZEOF_INT != 4 && !ACE_WIN32 */ diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index 3bd2ea1280e..687970b213b 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -345,6 +345,28 @@ Svc_Handler::idle (u_long flags) return ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::idle (flags); } +struct Client_Info + // = TITLE + // Information passed to the client so it can communicate with the + // server. +{ + ACE_INET_Addr *server_addr_; + // Address of the server to connect with. + + CONNECTOR *connector_; + // Connection factory. + + STRAT_CONNECTOR *strat_connector_; + // Strategy for connecting. + +#if defined (ACE_HAS_THREADS) + ACE_Barrier *barrier_; + // Performs barrier synchronization. +#endif /* ACE_HAS_THREADS */ +}; + +#if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) + static void timed_blocking_connect (CONNECTOR &con, const ACE_INET_Addr &server_addr) @@ -443,26 +465,6 @@ cached_connect (STRAT_CONNECTOR &con, } } -struct Client_Info - // = TITLE - // Information passed to the client so it can communicate with the - // server. -{ - ACE_INET_Addr *server_addr_; - // Address of the server to connect with. - - CONNECTOR *connector_; - // Connection factory. - - STRAT_CONNECTOR *strat_connector_; - // Strategy for connecting. - -#if defined (ACE_HAS_THREADS) - ACE_Barrier *barrier_; - // Performs barrier synchronization. -#endif /* ACE_HAS_THREADS */ -}; - static void * client_connections (void *arg) { @@ -538,7 +540,8 @@ client (void *arg) THR_NEW_LWP) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("client thread spawn failed"))); + ACE_TEXT ("client thread spawn failed"), + 1)); // Wait for the threads to exit. client_manager.wait (); @@ -616,6 +619,8 @@ server (void *arg) ACE_NOTREACHED (return 0); } +#endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ + #if !defined (ACE_LACKS_FORK) static void handler (int /* signum */) @@ -648,7 +653,8 @@ spawn_processes (ACCEPTOR *acceptor, case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("fork failed"))); + ACE_TEXT ("fork failed"), + 1)); ACE_OS::exit (-1); /* NOTREACHED */ case 0: // In the child. @@ -759,7 +765,8 @@ spawn_threads (ACCEPTOR *acceptor, ) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("server thread create failed"))); + ACE_TEXT ("server thread create failed"), + 1)); if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) client, @@ -771,7 +778,8 @@ spawn_threads (ACCEPTOR *acceptor, ) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("client thread create failed"))); + ACE_TEXT ("client thread create failed"), + 1)); // Wait for the threads to exit. // But, wait for a limited time because sometimes the test hangs on Irix. @@ -854,9 +862,10 @@ main (int argc, ACE_TCHAR *argv[]) #elif defined (ACE_HAS_THREADS) status = spawn_threads (&acceptor, &server_addr); #else /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), - 1)); + ACE_ERROR ((LM_INFO, + ACE_TEXT ("(%P|%t) ") + ACE_TEXT ("only one thread may be run") + ACE_TEXT (" in a process on this platform"))); #endif /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ } diff --git a/tests/Handle_Set_Test.cpp b/tests/Handle_Set_Test.cpp index 99a5c285227..a8a2e172d12 100644 --- a/tests/Handle_Set_Test.cpp +++ b/tests/Handle_Set_Test.cpp @@ -106,7 +106,7 @@ test_boundaries (void) const int SET_IS_EMPTY_SO_SHOULD_NOT_SEE_THIS = 1; ACE_ASSERT (0 == SET_IS_EMPTY_SO_SHOULD_NOT_SEE_THIS); #else /* ! defined (ACE_PSOS_DIAB) */ - ACE_ASSERT (0 == + ACE_ASSERT (0 == ACE_TEXT ("this shouldn't get called since ") ACE_TEXT ("the set is empty!\n")); #endif /* defined (ACE_PSOS_DIAB) */ @@ -207,16 +207,16 @@ main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Handle_Set_Test")); - int count = argc > 1 - ? ACE_OS::atoi (argv[1]) + int count = argc > 1 + ? ACE_OS::atoi (argv[1]) : ACE_Handle_Set::MAXSIZE; size_t max_handles = - argc > 2 - ? ACE_OS::atoi (argv[2]) + argc > 2 + ? ACE_OS::atoi (argv[2]) : ACE_Handle_Set::MAXSIZE; size_t max_iterations = - argc > 3 - ? ACE_OS::atoi (argv[3]) + argc > 3 + ? ACE_OS::atoi (argv[3]) : ACE_MAX_ITERATIONS; test_duplicates (count); @@ -231,7 +231,8 @@ main (int argc, ACE_TCHAR *argv[]) // The ACE_Node<ACE_INT32> instantation is in ace/Stats.cpp. template class ACE_Unbounded_Set<ACE_HANDLE>; template class ACE_Unbounded_Set_Iterator<ACE_HANDLE>; -# if defined(_CRAYMPP) || defined(ghs) && defined (ACE_WIN32) +# if defined(_CRAYMPP) \ + || ((defined(ghs) || defined(__MINGW32__)) && defined (ACE_WIN32)) // MPP Cray ACE_HANDLE is 64-bit, defined as int, but ACE_INT32 is short // so instantiation in ace/Stats.cpp isn't used in this case template class ACE_Node<ACE_HANDLE>; diff --git a/tests/MEM_Stream_Test.cpp b/tests/MEM_Stream_Test.cpp index 9e537456e0b..f21d35e02ff 100644 --- a/tests/MEM_Stream_Test.cpp +++ b/tests/MEM_Stream_Test.cpp @@ -30,7 +30,7 @@ ACE_RCSID(tests, MEM_Stream_Test, "$Id$") -#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_THREADS) && (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) #include "MEM_Stream_Test.h" // Defines Echo_Handler @@ -45,7 +45,18 @@ ACE_RCSID(tests, MEM_Stream_Test, "$Id$") #define NO_OF_ITERATION 100 -static int opt_wfmo_reactor = 1; +// If we don't have winsock2 we can't use WFMO_Reactor. +#if defined (ACE_WIN32) \ + && !defined (ACE_HAS_WINCE) \ + && defined (ACE_HAS_WINSOCK2) \ + && ACE_HAS_WINSOCK2 != 0 +# define TEST_CAN_USE_WFMO_REACTOR +#endif + +#if defined(TEST_CAN_USE_WFMO_REACTOR) +static const int opt_wfmo_reactor = 1; +#endif + static int opt_select_reactor = 1; static ACE_MEM_IO::Signal_Strategy client_strategy = ACE_MEM_IO::Reactive; @@ -188,14 +199,15 @@ create_reactor (void) { ACE_Reactor_Impl *impl = 0; +#if defined (TEST_CAN_USE_WFMO_REACTOR) if (opt_wfmo_reactor) { -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) ACE_NEW (impl, ACE_WFMO_Reactor); -#endif /* ACE_WIN32 */ } - else if (opt_select_reactor) +#endif /* TEST_CAN_USE_WFMO_REACTOR */ + + if (impl == 0 && opt_select_reactor) ACE_NEW (impl, ACE_Select_Reactor); @@ -380,9 +392,10 @@ main (int, ACE_TCHAR *[]) ACE_START_TEST (ACE_TEXT ("MEM_Stream_Test")); ACE_ERROR ((LM_INFO, - ACE_TEXT ("threads not supported on this platform\n"))); + ACE_TEXT ("threads or position independent pointers ") + ACE_TEXT ("not supported on this platform\n"))); ACE_END_TEST; return 0; } -#endif /* ACE_HAS_THREADS */ +#endif /* ACE_HAS_THREADS || ACE_HAS_POSITION_INDENDENT_POINTERS == 1 */ diff --git a/tests/MEM_Stream_Test.h b/tests/MEM_Stream_Test.h index eb13586847d..ccf85b8a5ad 100644 --- a/tests/MEM_Stream_Test.h +++ b/tests/MEM_Stream_Test.h @@ -32,6 +32,8 @@ #include "ace/Svc_Handler.h" #include "ace/Synch.h" +#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) + class Echo_Handler : public ACE_Svc_Handler<ACE_MEM_STREAM, ACE_MT_SYNCH> { // = TITLE @@ -51,4 +53,6 @@ private: u_short connection_; }; +#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ + #endif /* ACE_TESTS_MEM_STREAM_TEST_H */ diff --git a/tests/MM_Shared_Memory_Test.cpp b/tests/MM_Shared_Memory_Test.cpp index eab193fc4fd..163db5ff1de 100644 --- a/tests/MM_Shared_Memory_Test.cpp +++ b/tests/MM_Shared_Memory_Test.cpp @@ -30,6 +30,8 @@ ACE_RCSID(tests, MM_Shared_Memory_Test, "$Id$") +#if !defined (ACE_LACKS_MMAP) + static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; const int SHMSZ = 27; static ACE_TCHAR *shm_key; @@ -183,12 +185,14 @@ spawn (void) #endif /* ACE_HAS_THREADS */ return 0; } +#endif /* !ACE_LACKS_MMAP */ int main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MM_Shared_Memory_Test")); +#if !defined (ACE_LACKS_MMAP) ACE_TCHAR temp_file[MAXPATHLEN + 1]; // Get the temporary directory, @@ -211,7 +215,11 @@ main (int, ACE_TCHAR *[]) 1); spawn (); - +#else /* !ACE_LACKS_MMAP */ + ACE_ERROR ((LM_INFO, + ACE_TEXT ("mmap ") + ACE_TEXT ("is not supported on this platform\n"))); +#endif /* !ACE_LACKS_MMAP */ ACE_END_TEST; return 0; diff --git a/tests/MT_SOCK_Test.cpp b/tests/MT_SOCK_Test.cpp index 00915f1dc4f..7b0bc9ee90d 100644 --- a/tests/MT_SOCK_Test.cpp +++ b/tests/MT_SOCK_Test.cpp @@ -35,6 +35,8 @@ ACE_RCSID(tests, MT_SOCK_Test, "$Id$") static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; +#if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) + static void * client (void *arg) { @@ -44,10 +46,10 @@ client (void *arg) ACE_INET_Addr client_addr; ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; - ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); #if defined (ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS) ACE_Time_Value *timeout = 0; #else + ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); ACE_Time_Value *timeout = &tv; #endif /* ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS */ @@ -173,7 +175,7 @@ server (void *arg) ACE_TEXT ("(%P|%t) client %s connected from %d\n"), cli_addr.get_host_name (), cli_addr.get_port_number ())); - + // Enable non-blocking I/O. if (new_stream.enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, @@ -182,9 +184,9 @@ server (void *arg) 0); handle_set.reset (); handle_set.set_bit (new_stream.get_handle ()); - + // Read data from client (terminate on error). - + for (ssize_t r_bytes; ;) { ACE_DEBUG ((LM_DEBUG, @@ -201,7 +203,7 @@ server (void *arg) ACE_ASSERT (*t == buf[0]); t++; } - + if (r_bytes == 0) { // Handshake back with client. @@ -247,6 +249,8 @@ server (void *arg) ACE_NOTREACHED (return 0); } +#endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ + static void spawn (void) { @@ -276,7 +280,7 @@ spawn (void) case -1: ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "fork failed")); - i = ACE_MAX_CLIENTS; + i = ACE_MAX_CLIENTS; // Break out of 'for' loop. break; case 0: @@ -305,7 +309,8 @@ spawn (void) THR_BOUND | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("spawn failed"))); + ACE_TEXT ("spawn failed"), + 1)); if (ACE_Thread_Manager::instance ()->spawn_n (ACE_MAX_CLIENTS, @@ -314,15 +319,17 @@ spawn (void) THR_BOUND | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("spawn failed"))); + ACE_TEXT ("spawn failed"), + 1)); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), - 1)); -#endif /* !ACE_LACKS_FORK */ + ACE_ERROR ((LM_INFO, + ACE_TEXT ("(%P|%t) ") + ACE_TEXT ("only one thread may be run") + ACE_TEXT (" in a process on this platform\n"))); +#endif /* !ACE_LACKS_FORK */ peer_acceptor.close (); } } diff --git a/tests/Malloc_Test.cpp b/tests/Malloc_Test.cpp index 946ebb74019..143c8e28cdc 100644 --- a/tests/Malloc_Test.cpp +++ b/tests/Malloc_Test.cpp @@ -37,10 +37,12 @@ typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> MALLOC; #define MMAP_FILENAME ACE_TEXT ("test_file") #define MUTEX_NAME ACE_TEXT ("test_lock") -#if !defined (linux) && !(defined (ACE_WIN32) && defined (ghs)) +#if !defined (linux) && \ + !(defined (ACE_WIN32) && (defined (ghs) || defined (__MINGW32__))) #define ACE_TEST_REMAP_ON_FAULT // Linux seems to have problem when calling mmap from the signal handler. // The Green Hills Native x86 compiler does not support structural exceptions. +// Mingw's gcc does not support structural exceptions. // On these plarforms, we make sure the remapping will never occur. #endif /* linux && Win32 GHS*/ @@ -82,7 +84,9 @@ myallocator (const void *base_addr = 0) if (static_allocator.get () == 0) { + ACE_MMAP_Memory_Pool_Options options (base_addr); + #if !defined (ACE_TEST_REMAP_ON_FAULT) options.minimum_bytes_ = 512 * 1024; #endif /* ACE_TEST_REMAP_ON_FAULT */ @@ -273,9 +277,44 @@ child (void) return 0; } +#if defined (ACE_WIN32) \ + && (!defined (ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0)) +// On Win9x/Me, a shared address needs to be on the shared arena, +// betweeen the second and third megabyte in the virtual address space +// of the process. Also, a mapped view of a file is shared on the same +// virtual address on every 32 bit process. +// On WinNT/2k, memory above 2Gb is reserved for the system. +// So, we need to check at runtime (we want an ACE_HAS_WINNT4 == 0 ace +// to run on either). +static void +get_base_addrs() +{ + OSVERSIONINFO vinfo; + vinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if (::GetVersionEx(&vinfo) == 0) + return; + + if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + PARENT_BASE_ADDR = (char*) (64 * 1024*1024); + } + else + { + PARENT_BASE_ADDR = (char*) ((2048UL + 512UL)*(1024UL*1024UL)); + } + + CHILD_BASE_ADDR = 1024*1024 + (char*) PARENT_BASE_ADDR; +} +#endif + int main (int argc, ACE_TCHAR *[]) { +#if defined (ACE_WIN32) \ + && (!defined (ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0)) + get_base_addrs(); +#endif + if (argc == 1) { ACE_START_TEST (ACE_TEXT ("Malloc_Test")); diff --git a/tests/Mem_Map_Test.cpp b/tests/Mem_Map_Test.cpp index fd493aba916..c3a595e2a11 100644 --- a/tests/Mem_Map_Test.cpp +++ b/tests/Mem_Map_Test.cpp @@ -24,6 +24,8 @@ ACE_RCSID(tests, Mem_Map_Test, "$Id$") +#if !defined (ACE_LACKS_MMAP) + static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; static const int LINE_LENGTH = 10; static const int NUM_LINES = 15; @@ -114,16 +116,20 @@ create_test_file (ACE_TCHAR *filename, int line_length, int num_lines) return 0; } +#endif /* !ACE_LACKS_MMAP */ + int main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Mem_Map_Test")); +#if !defined (ACE_LACKS_MMAP) + // = Initialize the temporary variable names - ACE_TCHAR test_file[MAXPATHLEN + 1]; - ACE_TCHAR temp_file1[MAXPATHLEN + 1]; - ACE_TCHAR temp_file2[MAXPATHLEN + 1]; + ACE_TCHAR test_file[MAXPATHLEN + 1]; + ACE_TCHAR temp_file1[MAXPATHLEN + 1]; + ACE_TCHAR temp_file2[MAXPATHLEN + 1]; // Get the temporary directory // - 18 is for the filenames, ace_mem_map_temp_1 is the longest @@ -223,6 +229,13 @@ main (int, ACE_TCHAR *[]) // Delete ACE_TEMP_TEST_FILE_2 temp_mmap2.remove (); +#else /* !ACE_LACKS_MMAP */ + + ACE_ERROR ((LM_INFO, + ACE_TEXT ("mmap is not supported on this platform\n"))); + +#endif /* !ACE_LACKS_MMAP */ + ACE_END_TEST; return 0; } diff --git a/tests/OS_Test.cpp b/tests/OS_Test.cpp index b3dd1785a00..a76a89c1c37 100644 --- a/tests/OS_Test.cpp +++ b/tests/OS_Test.cpp @@ -59,6 +59,11 @@ rename_test (void) } ACE_OS::fclose (f); +#if defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && ACE_HAS_WINNT4 == 0 + // Can't rename if new_file exists already. + ACE_OS::unlink (new_file); +#endif + if (ACE_OS::rename (old_file, new_file) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("rename test 1"))); @@ -125,7 +130,7 @@ rename_test (void) #endif /* ACE_LACKS_RENAME */ } -// +// int string_emulation_test (void) { @@ -136,12 +141,12 @@ string_emulation_test (void) const char *memchr1 = "abcdefghijklmnopqrstuvwxyz"; - ACE_ASSERT (ACE_OS_String::memchr (ACE_static_cast (const void *, NULL), - 'a', + ACE_ASSERT (ACE_OS_String::memchr (ACE_static_cast (const void *, NULL), + 'a', 0) == NULL); ACE_ASSERT (ACE_OS_String::memchr (memchr1, 'a', sizeof (memchr1)) != NULL); ACE_ASSERT (ACE_OS_String::memchr (memchr1, '1', sizeof (memchr1)) == NULL); - + // ======================================================================== // Test strchr ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strchr\n"))); @@ -195,20 +200,20 @@ string_emulation_test (void) char *strtok_r2; - ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (strtok_r1, - " ", + ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (strtok_r1, + " ", &strtok_r2), "A") == 0); - ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (0, - " ", + ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (0, + " ", &strtok_r2), "string") == 0); ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (0, - " ", + " ", &strtok_r2), "of") == 0); ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strtok_r (0, - " ", + " ", &strtok_r2), "tokens") == 0); ACE_ASSERT (ACE_OS_String::strtok_r (0, " ", &strtok_r2) == 0); @@ -229,7 +234,7 @@ string_emulation_test (void) "2a") == 0); } -#if defined (ACE_HAS_WCHAR) +#if defined (ACE_HAS_WCHAR) { // ======================================================================== // Test itoa (wchar_t version) @@ -252,10 +257,10 @@ string_emulation_test (void) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcmp (wchar_t version)\n"))); const wchar_t *strcmp1 = ACE_TEXT_WIDE ("stringf"); - const wchar_t *strcmp2 = ACE_TEXT_WIDE ("stringfe"); - const wchar_t *strcmp3 = ACE_TEXT_WIDE ("stringg"); - const wchar_t *strcmp4 = ACE_TEXT_WIDE ("STRINGF"); - const wchar_t *strcmp5 = ACE_TEXT_WIDE ("stringe"); + const wchar_t *strcmp2 = ACE_TEXT_WIDE ("stringfe"); + const wchar_t *strcmp3 = ACE_TEXT_WIDE ("stringg"); + const wchar_t *strcmp4 = ACE_TEXT_WIDE ("STRINGF"); + const wchar_t *strcmp5 = ACE_TEXT_WIDE ("stringe"); ACE_ASSERT (ACE_OS_String::strcmp (strcmp1, strcmp1) == 0); ACE_ASSERT (ACE_OS_String::strcmp (strcmp1, strcmp2) < 0); @@ -270,7 +275,7 @@ string_emulation_test (void) const wchar_t *strcpy1 = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyz"); wchar_t strcpy2[27]; - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strcpy (strcpy2, strcpy1), strcpy1) == 0); ACE_ASSERT (ACE_OS_String::strcmp (strcpy2, strcpy1) == 0); @@ -283,7 +288,7 @@ string_emulation_test (void) wchar_t strcat2[27] = ACE_TEXT_WIDE ("abcdefghijkl"); const wchar_t *strcat3 = ACE_TEXT_WIDE ("mnopqrstuvwxyz"); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strcat (strcat2, strcat3), strcat1) == 0); ACE_ASSERT (ACE_OS_String::strcmp (strcat2, strcat1) == 0); @@ -296,7 +301,7 @@ string_emulation_test (void) wchar_t strncat2[27] = ACE_TEXT_WIDE ("abcdefghijkl"); const wchar_t *strncat3 = ACE_TEXT_WIDE ("mnopqrstuvwxyzabc"); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strcmp (ACE_OS_String::strncat (strncat2, strncat3, 14), strncat1) == 0); ACE_ASSERT (ACE_OS_String::strcmp (strncat2, strncat1) == 0); @@ -307,9 +312,9 @@ string_emulation_test (void) const wchar_t *strspn1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); - ACE_ASSERT (ACE_OS_String::strspn (strspn1, + ACE_ASSERT (ACE_OS_String::strspn (strspn1, ACE_TEXT_WIDE ("abcdf")) == 4); - ACE_ASSERT (ACE_OS_String::strspn (strspn1, + ACE_ASSERT (ACE_OS_String::strspn (strspn1, ACE_TEXT_WIDE ("mno")) == 0); // ======================================================================== @@ -318,9 +323,9 @@ string_emulation_test (void) const wchar_t *strchr1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); - ACE_ASSERT (*ACE_OS_String::strchr (strchr1, ACE_TEXT_WIDE ('h')) + ACE_ASSERT (*ACE_OS_String::strchr (strchr1, ACE_TEXT_WIDE ('h')) == ACE_TEXT_WIDE ('h')); - ACE_ASSERT (ACE_OS_String::strchr (strchr1, ACE_TEXT_WIDE ('h')) + ACE_ASSERT (ACE_OS_String::strchr (strchr1, ACE_TEXT_WIDE ('h')) == strchr1 + 7); ACE_ASSERT (ACE_OS_String::strchr (strchr1, ACE_TEXT_WIDE ('1')) == NULL); @@ -332,10 +337,10 @@ string_emulation_test (void) ACE_ASSERT (ACE_OS_String::strncmp ( ACE_OS_String::strstr (strstr1, ACE_TEXT_WIDE ("def")), - ACE_TEXT_WIDE ("def"), + ACE_TEXT_WIDE ("def"), 3) == 0); - ACE_ASSERT (ACE_OS_String::strstr (strstr1, + ACE_ASSERT (ACE_OS_String::strstr (strstr1, ACE_TEXT_WIDE ("mno")) == 0); // ======================================================================== @@ -354,9 +359,9 @@ string_emulation_test (void) const wchar_t *strpbrk1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); - ACE_ASSERT (ACE_OS_String::strpbrk (strpbrk1, ACE_TEXT_WIDE ("ijkb")) + ACE_ASSERT (ACE_OS_String::strpbrk (strpbrk1, ACE_TEXT_WIDE ("ijkb")) == strpbrk1 + 1); - ACE_ASSERT (ACE_OS_String::strpbrk (strpbrk1, + ACE_ASSERT (ACE_OS_String::strpbrk (strpbrk1, ACE_TEXT_WIDE ("mno")) == 0); // ======================================================================== @@ -365,11 +370,11 @@ string_emulation_test (void) const wchar_t *strrchr1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); - ACE_ASSERT (*ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) + ACE_ASSERT (*ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) == ACE_TEXT_WIDE ('h')); - ACE_ASSERT (ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) + ACE_ASSERT (ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) == strrchr1 + 18); - ACE_ASSERT (ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('1')) + ACE_ASSERT (ACE_OS_String::strrchr (strrchr1, ACE_TEXT_WIDE ('1')) == NULL); // ======================================================================== @@ -378,9 +383,9 @@ string_emulation_test (void) const wchar_t *strcasecmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strcasecmp2 = ACE_TEXT_WIDE ("stringfe"); - const wchar_t *strcasecmp3 = ACE_TEXT_WIDE ("stringg"); - const wchar_t *strcasecmp4 = ACE_TEXT_WIDE ("STRINGF"); - const wchar_t *strcasecmp5 = ACE_TEXT_WIDE ("stringe"); + const wchar_t *strcasecmp3 = ACE_TEXT_WIDE ("stringg"); + const wchar_t *strcasecmp4 = ACE_TEXT_WIDE ("STRINGF"); + const wchar_t *strcasecmp5 = ACE_TEXT_WIDE ("stringe"); ACE_ASSERT (ACE_OS_String::strcasecmp (strcasecmp1, strcasecmp1) == 0); ACE_ASSERT (ACE_OS_String::strcasecmp (strcasecmp1, strcasecmp2) < 0); @@ -394,19 +399,19 @@ string_emulation_test (void) const wchar_t *strncasecmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strncasecmp2 = ACE_TEXT_WIDE ("stringfe"); - const wchar_t *strncasecmp3 = ACE_TEXT_WIDE ("stringg"); - const wchar_t *strncasecmp4 = ACE_TEXT_WIDE ("STRINGF"); - const wchar_t *strncasecmp5 = ACE_TEXT_WIDE ("stringe"); + const wchar_t *strncasecmp3 = ACE_TEXT_WIDE ("stringg"); + const wchar_t *strncasecmp4 = ACE_TEXT_WIDE ("STRINGF"); + const wchar_t *strncasecmp5 = ACE_TEXT_WIDE ("stringe"); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strncasecmp (strncasecmp1, strncasecmp2, 7) == 0); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strncasecmp (strncasecmp1, strncasecmp2, 8) < 0); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strncasecmp (strncasecmp1, strncasecmp3, 7) < 0); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strncasecmp (strncasecmp1, strncasecmp4, 7) == 0); - ACE_ASSERT + ACE_ASSERT (ACE_OS_String::strncasecmp (strncasecmp1, strncasecmp5, 7) > 0); // ======================================================================== @@ -415,9 +420,9 @@ string_emulation_test (void) const wchar_t *strncmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strncmp2 = ACE_TEXT_WIDE ("stringfe"); - const wchar_t *strncmp3 = ACE_TEXT_WIDE ("stringg"); - const wchar_t *strncmp4 = ACE_TEXT_WIDE ("STRINGF"); - const wchar_t *strncmp5 = ACE_TEXT_WIDE ("stringe"); + const wchar_t *strncmp3 = ACE_TEXT_WIDE ("stringg"); + const wchar_t *strncmp4 = ACE_TEXT_WIDE ("STRINGF"); + const wchar_t *strncmp5 = ACE_TEXT_WIDE ("stringe"); ACE_ASSERT (ACE_OS_String::strncmp (strncmp1, strncmp2, 7) == 0); ACE_ASSERT (ACE_OS_String::strncmp (strncmp1, strncmp2, 8) < 0); @@ -432,9 +437,9 @@ string_emulation_test (void) wchar_t strncpy1[] = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyzabc"); wchar_t strncpy2[27]; - ACE_ASSERT - (ACE_OS_String::strncmp (ACE_OS_String::strncpy (strncpy2, - strncpy1, + ACE_ASSERT + (ACE_OS_String::strncmp (ACE_OS_String::strncpy (strncpy2, + strncpy1, 26), strncpy1, 26) == 0); @@ -449,7 +454,7 @@ string_emulation_test (void) return 0; } -int +int main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("OS_Test")); diff --git a/tests/Priority_Reactor_Test.cpp b/tests/Priority_Reactor_Test.cpp index 64eaaf0c23b..0114a8be880 100644 --- a/tests/Priority_Reactor_Test.cpp +++ b/tests/Priority_Reactor_Test.cpp @@ -179,6 +179,8 @@ Write_Handler::svc (void) return 0; } +#if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) + // Execute the client tests. static void * client (void *arg) @@ -233,6 +235,8 @@ client (void *arg) return 0; } +#endif + int main (int argc, ACE_TCHAR *argv[]) { @@ -324,7 +328,8 @@ main (int argc, ACE_TCHAR *argv[]) THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("thread create failed"))); + ACE_TEXT ("thread create failed"), + 1)); } #elif !defined (ACE_LACKS_FORK) for (i = 0; i < opt_nchildren; ++i) @@ -333,7 +338,9 @@ main (int argc, ACE_TCHAR *argv[]) { case -1: ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("fork failed"))); + ACE_TEXT ("(%P|%t) %p\n%a"), + ACE_TEXT ("fork failed"), + 1)); exit (-1); /* NOTREACHED */ case 0: @@ -347,8 +354,10 @@ main (int argc, ACE_TCHAR *argv[]) } } #else - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); + ACE_ERROR ((LM_INFO, + ACE_TEXT ("(%P|%t) ") + ACE_TEXT ("only one thread may be run ") + ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_Time_Value tv (opt_max_duration); diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp index 947d2de1fb9..29378957c55 100644 --- a/tests/Process_Strategy_Test.cpp +++ b/tests/Process_Strategy_Test.cpp @@ -108,14 +108,6 @@ connection_completed (void) ACE_Reactor::instance()->wakeup_all_threads (); } -// Have all connections been serviced? - -static int -done (void) -{ - return connections == ACE_MAX_ITERATIONS + 1; -} - // Constructor Process_Strategy::Process_Strategy (size_t n_processes, ACE_Event_Handler *acceptor, @@ -500,6 +492,8 @@ Counting_Service::open (void *) return 0; } +#if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) + // Execute the client tests. static void * @@ -617,6 +611,14 @@ client (void *arg) // Performs the server activities. +// Have all connections been serviced? + +static int +done (void) +{ + return connections == ACE_MAX_ITERATIONS + 1; +} + static void * server (void *) { @@ -630,6 +632,8 @@ server (void *) return 0; } +#endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ + int main (int argc, ACE_TCHAR *argv[]) { @@ -705,10 +709,9 @@ main (int argc, ACE_TCHAR *argv[]) // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else - ACE_ERROR ((LM_ERROR, + ACE_ERROR ((LM_INFO, ACE_TEXT ("(%P|%t) only one thread may be run ") - ACE_TEXT ("in a process on this platform\n%a"), - 1)); + ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ } diff --git a/tests/RMCast/RMCast_Fragment_Test.cpp b/tests/RMCast/RMCast_Fragment_Test.cpp index 44f1db8e8f3..66179c47ef0 100644 --- a/tests/RMCast/RMCast_Fragment_Test.cpp +++ b/tests/RMCast/RMCast_Fragment_Test.cpp @@ -11,6 +11,7 @@ // ============================================================================ #include "test_config.h" +#include "ace/Message_Block.h" #include "ace/Task.h" #include "ace/RMCast/RMCast_Fragment.h" @@ -111,20 +112,20 @@ ACE_RMCast_Fragment_Tester::svc (void) const int n = 256; const int size = 512; - ACE_Message_Block small[n]; - small[0].size (size); - small[0].wr_ptr (size); + ACE_Message_Block smallb[n]; + smallb[0].size (size); + smallb[0].wr_ptr (size); for (int i = 1; i != n; ++i) { - small[i].size (size); - small[i].wr_ptr (size); - small[i - 1].cont (&small[i]); + smallb[i].size (size); + smallb[i].wr_ptr (size); + smallb[i - 1].cont (&smallb[i]); } - this->initialize (small); + this->initialize (smallb); ACE_RMCast::Data data; - data.payload = small; + data.payload = smallb; if (this->fragment_.data (data) == -1) return -1; @@ -136,10 +137,10 @@ ACE_RMCast_Fragment_Tester::svc (void) this->received_bytes_, total), -1); - if (this->compare (small) == -1) + if (this->compare (smallb) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Mismatched small chain data\n")), + ACE_TEXT ("Mismatched smallb chain data\n")), -1); } @@ -157,23 +158,23 @@ ACE_RMCast_Fragment_Tester::svc (void) ACE_static_cast(ACE_RANDR_TYPE,ACE_OS::time (0)); int size = 64 + ACE_OS::rand_r(seed) % 128; - ACE_Message_Block small[n]; - small[0].size (size); - small[0].wr_ptr (size); + ACE_Message_Block smallb[n]; + smallb[0].size (size); + smallb[0].wr_ptr (size); total += size; for (int i = 1; i != n; ++i) { size = 64 + ACE_OS::rand_r(seed) % 128; total += size; - small[i].size (size); - small[i].wr_ptr (size); - small[i - 1].cont (&small[i]); + smallb[i].size (size); + smallb[i].wr_ptr (size); + smallb[i - 1].cont (&smallb[i]); } - this->initialize (small); + this->initialize (smallb); ACE_RMCast::Data data; - data.payload = small; + data.payload = smallb; if (this->fragment_.data (data) == -1) return -1; @@ -184,10 +185,10 @@ ACE_RMCast_Fragment_Tester::svc (void) this->received_bytes_, total), -1); - if (this->compare (small) == -1) + if (this->compare (smallb) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("Mismatched small chain data\n")), + ACE_TEXT ("Mismatched smallb chain data\n")), -1); } diff --git a/tests/Reactor_Exceptions_Test.cpp b/tests/Reactor_Exceptions_Test.cpp index a11ca537b43..01346697ed8 100644 --- a/tests/Reactor_Exceptions_Test.cpp +++ b/tests/Reactor_Exceptions_Test.cpp @@ -27,7 +27,7 @@ ACE_RCSID(tests, Reactor_Exceptions_Test, "$Id$") #if defined (ACE_HAS_EXCEPTIONS) -#if defined (ACE_WIN32) +#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) static void throw_exception (void) { @@ -48,7 +48,7 @@ throw_exception (void) ACE_TEXT ("(%P|%t) throw exception\n"))); throw Except (); } -#endif /* ACE_WIN32 */ +#endif /* ACE_WIN32 && ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ class My_Handler : public ACE_Event_Handler, public ACE_SOCK_Dgram { diff --git a/tests/Reactor_Notify_Test.cpp b/tests/Reactor_Notify_Test.cpp index ea56e5683d9..2b56d91bb6e 100644 --- a/tests/Reactor_Notify_Test.cpp +++ b/tests/Reactor_Notify_Test.cpp @@ -434,7 +434,8 @@ main (int, ACE_TCHAR *[]) timeout.set (LONG_TIMEOUT, 0); ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%t) running tests with reactor notification pipe enabled\n") + ACE_TEXT ("(%t) running tests with reactor notification ") + ACE_TEXT ("pipe enabled\n") ACE_TEXT (" and time-out = %d seconds\n"), timeout.sec ())); run_test (0, timeout); diff --git a/tests/SOCK_Send_Recv_Test.cpp b/tests/SOCK_Send_Recv_Test.cpp index 2a44acf30dd..6505bb69f6f 100644 --- a/tests/SOCK_Send_Recv_Test.cpp +++ b/tests/SOCK_Send_Recv_Test.cpp @@ -37,6 +37,8 @@ ACE_RCSID(tests, SOCK_Send_Recv_Test, "$Id$") // Change to non-zero if test fails static int Test_Result = 0; +#if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) + // In test 3, a large amount of data is sent. The purpose is to overflow the // TCP send window, causing the sender to block (it's a send_n). This value // is the amount to send. The assumption is that no implementation has a @@ -139,7 +141,7 @@ client (void *arg) if (len != 255) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p; len is %d, but should be 255!\n"), + ACE_TEXT ("(%P|%t) %p; len is %d, but should be 255!\n"), len)); } ACE_ASSERT (len == 255); @@ -310,6 +312,8 @@ server (void *arg) return 0; } +#endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ + static void spawn (void) { @@ -337,7 +341,8 @@ spawn (void) case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("fork failed"))); + ACE_TEXT ("fork failed"), + 1)); /* NOTREACHED */ case 0: client (&server_addr); @@ -355,7 +360,8 @@ spawn (void) THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("thread create failed"))); + ACE_TEXT ("thread create failed"), + 1)); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), @@ -363,14 +369,16 @@ spawn (void) THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), - ACE_TEXT ("thread create failed"))); + ACE_TEXT ("thread create failed"), + 1)); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), - 1)); + ACE_ERROR ((LM_INFO, + ACE_TEXT ("(%P|%t) ") + ACE_TEXT ("only one thread may be run ") + ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ peer_acceptor.close (); diff --git a/tests/SOCK_Test.cpp b/tests/SOCK_Test.cpp index 2da259365b6..c32cd1d87e1 100644 --- a/tests/SOCK_Test.cpp +++ b/tests/SOCK_Test.cpp @@ -211,7 +211,10 @@ spawn (void) switch (ACE_OS::fork ("child")) { case -1: - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("fork failed"))); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n%a"), + ACE_TEXT ("fork failed"), + 1)); /* NOTREACHED */ case 0: client (&server_addr); @@ -223,17 +226,30 @@ spawn (void) } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn - (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"))); + (ACE_THR_FUNC (server), + (void *) &peer_acceptor, + THR_NEW_LWP | THR_DETACHED) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n%a"), + ACE_TEXT ("thread create failed"), + 1)); if (ACE_Thread_Manager::instance ()->spawn - (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"))); + (ACE_THR_FUNC (client), + (void *) &server_addr, + THR_NEW_LWP | THR_DETACHED) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n%a"), + ACE_TEXT ("thread create failed"), + 1)); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else - ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); + ACE_ERROR ((LM_INFO, + ACE_TEXT ("(%P|%t) ") + ACE_TEXT ("only one thread may be run ") + ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ peer_acceptor.close (); @@ -250,4 +266,3 @@ main (int, ACE_TCHAR *[]) ACE_END_TEST; return 0; } - diff --git a/tests/SPIPE_Test.cpp b/tests/SPIPE_Test.cpp index 70d868a1f99..401d548dbfb 100644 --- a/tests/SPIPE_Test.cpp +++ b/tests/SPIPE_Test.cpp @@ -31,7 +31,13 @@ ACE_RCSID(tests, SPIPE_Test, "$Id$") -#if defined (ACE_HAS_STREAM_PIPES) || defined (ACE_WIN32) +#if defined (ACE_HAS_STREAM_PIPES) \ + || (defined (ACE_WIN32) && defined(ACE_HAS_WINNT4) \ + && (ACE_HAS_WINNT4 !=0)) +# define TEST_HAS_STREAM_PIPES +#endif + +#if defined (TEST_HAS_STREAM_PIPES) static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; @@ -48,7 +54,7 @@ client (void *) ACE_OS::sleep (10); if (con.connect (cli_stream, ACE_SPIPE_Addr (rendezvous)) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), rendezvous)); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), rendezvous, 1)); for (const char *c = ACE_ALPHABET; *c != '\0'; c++) if (cli_stream.send (c, 1) == -1) @@ -76,13 +82,13 @@ server (void *) // Initialize named pipe listener. if (acceptor.open (ACE_SPIPE_Addr (rendezvous)) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open"))); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("open"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for connection\n"))); // Accept a client connection if (acceptor.accept (new_stream, 0) == -1) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("accept"))); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("accept"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Accepted connection\n"))); @@ -96,14 +102,14 @@ server (void *) acceptor.close (); return 0; } -#endif /* ACE_HAS_STREAM_PIPES || ACE_WIN32 */ +#endif /* TEST_HAS_STREAM_PIPES */ int main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SPIPE_Test")); -#if defined (ACE_HAS_STREAM_PIPES) || defined (ACE_WIN32) +#if defined (TEST_HAS_STREAM_PIPES) #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork ()) { @@ -131,7 +137,7 @@ main (int, ACE_TCHAR *[]) #else ACE_DEBUG ((LM_INFO, ACE_TEXT ("SPIPE is not supported on this platform\n"))); -#endif /* ACE_HAS_STREAM_PIPES || ACE_WIN32 */ +#endif /* TEST_HAS_STREAM_PIPES */ ACE_END_TEST; return 0; } diff --git a/tests/Svc_Handler_Test.cpp b/tests/Svc_Handler_Test.cpp index 343be6d7a83..4505059c324 100644 --- a/tests/Svc_Handler_Test.cpp +++ b/tests/Svc_Handler_Test.cpp @@ -54,7 +54,7 @@ run_test (SVC_HANDLER &svc_handler, cb2->copy ("doug\n", ACE_OS::strlen ("doug\n")); cb1->cont (cb2); - + // Note that this is a buffered call! if (svc_handler.put (mb) == -1) ACE_ERROR ((LM_ERROR, @@ -93,17 +93,25 @@ main (int argc, ACE_TCHAR *argv[]) // Open up the temp file. if (connector.connect (file_io, file) == -1) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("connect failed for %p\n"), file.get_path_name ()), 1); + +#if !defined (ACE_WIN32) \ + || (defined (ACE_HAS_WINNT4) && ACE_HAS_WINNT4 == 1) +# define TEST_CAN_UNLINK_IN_ADVANCE +#endif + +#if defined(TEST_CAN_UNLINK_IN_ADVANCE) // Unlink this file right away so that it is automatically removed // when the process exits. - else if (file_io.unlink () == -1) - ACE_ERROR_RETURN ((LM_ERROR, + if (file_io.unlink () == -1) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unlink failed for %p\n"), file.get_path_name ()), 1); +#endif // Create the service handler and assign it <file_io> as its data // sink. @@ -113,10 +121,21 @@ main (int argc, ACE_TCHAR *argv[]) max_buffer_size, 0); svc_handler.peer () = file_io; - + // Run the test. run_test (svc_handler, iterations); + +#if !defined(TEST_CAN_UNLINK_IN_ADVANCE) + file_io.close(); + if (file_io.unlink () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("unlink failed for %p\n"), + file.get_path_name ()), + 1); +#endif + } + ACE_END_TEST; return 0; } diff --git a/tests/run_tests.bat b/tests/run_tests.bat index e01efdbef6b..27ff111342c 100644 --- a/tests/run_tests.bat +++ b/tests/run_tests.bat @@ -1,6 +1,10 @@ @echo off rem run_tests.bat,v 4.71 1999/11/08 05:39:06 nanbor Exp +rem +rem Note this batch file will not work on Win9X. +rem + rem To run this script, the first argument must be either bor rem or msc. This will determine if the borland tests are run, or rem msvc tests are run. diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 3bac5fe9335..4e22a9098ae 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -14,6 +14,15 @@ # 4) Create a symlink to the "log" directory create in step 1) above. # 5) ./run_tests.sh <target_hostname> +if [ -x /bin/rm ]; then + RM=/bin/rm +elif [ -x /usr/bin/rm ]; then + RM=/usr/bin/rm +else + echo "Can't find rm, aborting." 1>&2 + exit 1 +fi + usage="usage: $0 [-p] <target> -p: purify tests" @@ -54,6 +63,7 @@ IFS="|" tmp=/tmp compilation_log="log/compilations.log" shlib_suffix=".so" + LD_LIBRARY_PATH=$ACE_ROOT/ace:${LD_LIBRARY_PATH:-/usr/lib} export LD_LIBRARY_PATH @@ -72,6 +82,10 @@ if [ $sysname = 'AIX' ]; then export LIBPATH fi +if echo $sysname | grep -q CYGWIN; then + shlib_suffix=".dll" +fi + if [ $purify -eq 1 ]; then if echo $PWD | egrep 'gcc|g++'; then purify_with_old_gcc=1 @@ -101,7 +115,7 @@ fi run() { - /bin/rm -f core log/$1.log + $RM -f core log/$1.log if [ ! -f "$1" ]; then echo 1>&2 "Making $1 . . ." @@ -216,7 +230,7 @@ done echo "Finished ACE version $ace_version tests." -/bin/rm -f ace_pipe_name pattern \ +$RM -f ace_pipe_name pattern \ $tmp/ace_temp_file* \ $tmp/ace_test_file \ $tmp/Naming_Test* |