summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ACE-INSTALL.html34
-rw-r--r--ChangeLog57
-rw-r--r--ChangeLogs/ChangeLog-03a57
-rw-r--r--ace/ACE.cpp3
-rw-r--r--ace/OS.h9
-rw-r--r--ace/OS.i12
-rw-r--r--ace/POSIX_Proactor.cpp17
-rw-r--r--ace/POSIX_Proactor.h17
-rw-r--r--ace/README14
-rw-r--r--ace/Sock_Connect.cpp87
-rw-r--r--ace/config-openbsd-pthread.h206
-rw-r--r--ace/config-openbsd.h164
-rw-r--r--include/makeinclude/platform_openbsd.GNU48
-rw-r--r--include/makeinclude/platform_openbsd_pthread.GNU8
-rw-r--r--tests/Malloc_Test.cpp4
-rw-r--r--tests/Reactor_Dispatch_Order_Test.cpp8
16 files changed, 703 insertions, 42 deletions
diff --git a/ACE-INSTALL.html b/ACE-INSTALL.html
index 74a91242566..5f153e22251 100644
--- a/ACE-INSTALL.html
+++ b/ACE-INSTALL.html
@@ -123,8 +123,8 @@ For information on TAO's platform coverage and support, please also see
Digital UNIX (Compaq Tru64) 4.0 and 5.0;
IRIX 6.x; UnixWare 7.1.0; SunOS 4.x and Solaris with SunC++ 4.x;
Linux on Alpha and PPC; OpenMVS;
- Tandem; SCO; FreeBSD; NetBSD
- Chorus, OS/9, PharLap TNT Embedded ToolSuite 9.1,
+ Tandem; SCO; FreeBSD; NetBSD; OpenBSD;
+ Chorus; OS/9; PharLap TNT Embedded ToolSuite 9.1;
QNX RTP and Neutrino 2.0; VxWorks; LynxOS; RTEMS
</td>
<td></td>
@@ -518,6 +518,26 @@ make: *** [libACE.so] Error 8
Like older FreeBSD, NetBSD's <code>ld.so</code> also requires
versioned .so files.<p>
+ <li><b>OpenBSD</b><p>
+
+ ACE has been ported to OpenBSD 3.1 and GNU g++ 2.95.3.<P>
+
+ As with FreeBSD and NetBSD, OpenBSD requires versioned .so
+ files. This is currently handled by the build files and no
+ additional work is needed.<P>
+
+ ACE has been ported to OpenBSD with and without pthreads
+ enabled. When using pthreads, though, C++ exceptions must be
+ disabled. This is a known problem with the current release of
+ OpenBSD (see www.openbsd.org, bug #1750). ACE emulated
+ exceptions work fine.<P>
+
+ Compiling TAO may require the user data segment size
+ restrictions and possibly other options to be increased. This
+ is done by modifying the default user class in /etc/login.conf
+ or by adding a new class and modifying the master passwer file
+ accordingly.<P>
+
<LI><B> UnixWare </B> <P>
Steve Huston &lt<A
@@ -2386,15 +2406,15 @@ below.</p>
<font face="Courier New, Courier, mono">platform_macros.GNU</font>
file:
<P><table width="75%" border="0" align="center">
- <tr>
+ <tr>
<td><font face="Courier New, Courier, mono">PLATFORM_SSL_CPPFLAGS</font></td>
<td>Platform preprocessor options for OpenSSL (e.g. -I...)</td>
</tr>
- <tr>
+ <tr>
<td><font face="Courier New, Courier, mono">PLATFORM_SSL_LDFLAGS</font></td>
<td>Platform linker options for OpenSSL (e.g. -L...)</td>
</tr>
- <tr>
+ <tr>
<td><font face="Courier New, Courier, mono">PLATFORM_SSL_LIBS</font></td>
<td>Platform libraries required with OpenSSL (e.g. -lssl -lcrypto)</td>
</tr>
@@ -2734,10 +2754,10 @@ debug Enable debugging; see DCFLAGS and DCCFLAGS.
exceptions Enable exception handling (not supported by all platforms).
include_env Support old-style ACE_TRY_ENV declarations in methods.
This switch is necessary for compiling TAO applications
- in the native exception configuration that were written
+ in the native exception configuration that were written
for TAO versions before 1.2.2.
In TAO 1.2.2, new macros were introduced that supercede
- the direct ACE_TRY_ENV declarations. These are the
+ the direct ACE_TRY_ENV declarations. These are the
ACE_ENV_ARG macros that are defined in ace/CORBA_macros.h
and are documented in docs/exceptions.html.
This switch only affects the exceptions=1 configuration.
diff --git a/ChangeLog b/ChangeLog
index 391aef08e85..f585604ad44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,48 @@
-Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
+Mon Oct 14 19:20:35 2002 Frank Hunleth <frank@hunleth.com>
+
+ * ACE-INSTALL.html: Added installation notes for the OpenBSD port.
+
+ * ace/config-openbsd.h:
+ * ace/config-openbsd-pthread.h:
+ * include/makeinclude/platform_openbsd.GNU:
+ * include/makeinclude/platform_openbsd_pthread.GNU: Configuration
+ files for OpenBSD.
+
+ * ace/ACE.cpp: Added OpenBSD-specific error code to ACE::out_of_handles
+
+ * ace/OS.h: Added #define for OpenBSD-specific path to siginfo.h and
+ ACE_LACKS_CLEARERR guards around clearerr() for OpenBSD.
+
+ * ace/OS.i: Added support for getifaddrs() with ACE_HAS_GETIFADDRS
+ and fix for segfault when calling dlsym with a null handle. Added
+ guards on clearerr using ACE_LACKS_CLEARERR. (All only affect
+ OpenBSD.)
+
+ * ace/POSIX_Proactor.cpp:
+ * ace/POSIX_Proactor.h: Added SystemType family for OpenBSD.
+
+ * ace/README: Added new ACE #defines to support OpenBSD. These include:
+ ACE_HAS_GETIFADDRS - for support of the getifaddrs() system call
+ ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE - add check to dlsym call
+ to protect against NULL. OpenBSD 3.1 needs this.
+ ACE_LACKS_CLEARERR - #define to remove clearerr definition due
+ to bogus syntax error on OpenBSD.
+
+ * ace/Sock_Connect.cpp: Added code to get_ip_interfaces to use
+ getifaddrs() if it is supported. OpenBSD is the only platform to
+ use this currently. Under OpenBSD, the code to parse the return
+ values from the corresponding ioctl calls gets confused when IPv6
+ interfaces are present.
+
+ * tests/Malloc_Test.cpp: Added OpenBSD to the list of platforms that
+ can't handle the remap of fault part of the test.
+
+ * tests/Reactor_Dispatch_Order_Test.cpp: Added code for OpenBSD to
+ clear the write mask after handle_output is called, since OpenBSD
+ calls handle_output more than once before the data is received
+ over the pipe.
+
+Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
* ace/OS.h: Added FILE_FLAG_WRITE_THROUGH defines for
non-supporting operating systems and added various PIPE_*
@@ -12,7 +56,7 @@ Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
* ace/SPIPE_Acceptor.{h.cpp}: Added support to enable the
selection of whether bytestream or message mode is used on
- Windows.
+ Windows.
Mon Oct 14 20:19:51 2002 Steve Huston <shuston@riverace.com>
@@ -33,10 +77,15 @@ Mon Oct 14 17:23:43 2002 Balachandran Natarajan <bala@isis-server.isis.vanderb
performed in "Tue Mar 12 17:43:32 2002 Balachandran Natarajan
<bala@cs.wustl.edu>". This optimizations created problems for
CORBA::Any implementation which assumes that the data is totally
- contained within the Any. Using the optimization created problems
- for Any's that are copied between different threads. Thanks to
+ contained within the Any. Using the optimization created problems
+ for Any's that are copied between different threads. Thanks to
Chen Jian <jchen@huawei.com> for reporting this problem.
+<<<<<<< ChangeLog
+ * THANKS: Added Chen Jian <jchen@huawei.com> to the hall of fame.
+
+=======
+>>>>>>> 4.4188
Mon Oct 14 10:12:31 2002 Steve Huston <shuston@riverace.com>
Fix for Bugzilla # 1316:
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 391aef08e85..f585604ad44 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,4 +1,48 @@
-Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
+Mon Oct 14 19:20:35 2002 Frank Hunleth <frank@hunleth.com>
+
+ * ACE-INSTALL.html: Added installation notes for the OpenBSD port.
+
+ * ace/config-openbsd.h:
+ * ace/config-openbsd-pthread.h:
+ * include/makeinclude/platform_openbsd.GNU:
+ * include/makeinclude/platform_openbsd_pthread.GNU: Configuration
+ files for OpenBSD.
+
+ * ace/ACE.cpp: Added OpenBSD-specific error code to ACE::out_of_handles
+
+ * ace/OS.h: Added #define for OpenBSD-specific path to siginfo.h and
+ ACE_LACKS_CLEARERR guards around clearerr() for OpenBSD.
+
+ * ace/OS.i: Added support for getifaddrs() with ACE_HAS_GETIFADDRS
+ and fix for segfault when calling dlsym with a null handle. Added
+ guards on clearerr using ACE_LACKS_CLEARERR. (All only affect
+ OpenBSD.)
+
+ * ace/POSIX_Proactor.cpp:
+ * ace/POSIX_Proactor.h: Added SystemType family for OpenBSD.
+
+ * ace/README: Added new ACE #defines to support OpenBSD. These include:
+ ACE_HAS_GETIFADDRS - for support of the getifaddrs() system call
+ ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE - add check to dlsym call
+ to protect against NULL. OpenBSD 3.1 needs this.
+ ACE_LACKS_CLEARERR - #define to remove clearerr definition due
+ to bogus syntax error on OpenBSD.
+
+ * ace/Sock_Connect.cpp: Added code to get_ip_interfaces to use
+ getifaddrs() if it is supported. OpenBSD is the only platform to
+ use this currently. Under OpenBSD, the code to parse the return
+ values from the corresponding ioctl calls gets confused when IPv6
+ interfaces are present.
+
+ * tests/Malloc_Test.cpp: Added OpenBSD to the list of platforms that
+ can't handle the remap of fault part of the test.
+
+ * tests/Reactor_Dispatch_Order_Test.cpp: Added code for OpenBSD to
+ clear the write mask after handle_output is called, since OpenBSD
+ calls handle_output more than once before the data is received
+ over the pipe.
+
+Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
* ace/OS.h: Added FILE_FLAG_WRITE_THROUGH defines for
non-supporting operating systems and added various PIPE_*
@@ -12,7 +56,7 @@ Mon Oct 14 18:21:40 2002 Patrick J. McNerthney <ace@mcnerthney.com>
* ace/SPIPE_Acceptor.{h.cpp}: Added support to enable the
selection of whether bytestream or message mode is used on
- Windows.
+ Windows.
Mon Oct 14 20:19:51 2002 Steve Huston <shuston@riverace.com>
@@ -33,10 +77,15 @@ Mon Oct 14 17:23:43 2002 Balachandran Natarajan <bala@isis-server.isis.vanderb
performed in "Tue Mar 12 17:43:32 2002 Balachandran Natarajan
<bala@cs.wustl.edu>". This optimizations created problems for
CORBA::Any implementation which assumes that the data is totally
- contained within the Any. Using the optimization created problems
- for Any's that are copied between different threads. Thanks to
+ contained within the Any. Using the optimization created problems
+ for Any's that are copied between different threads. Thanks to
Chen Jian <jchen@huawei.com> for reporting this problem.
+<<<<<<< ChangeLog
+ * THANKS: Added Chen Jian <jchen@huawei.com> to the hall of fame.
+
+=======
+>>>>>>> 4.4188
Mon Oct 14 10:12:31 2002 Steve Huston <shuston@riverace.com>
Fix for Bugzilla # 1316:
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 371f0c9a360..8801f82f6e3 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -57,6 +57,9 @@ ACE::out_of_handles (int error)
// ENOSYS (libc_r threads) also.
error == EOPNOTSUPP ||
error == ENOSYS ||
+#elif defined (__OpenBSD__)
+ // OpenBSD appears to return EBADF.
+ error == EBADF ||
#elif defined (__sgi) // irix
error == ENOTSUP ||
#elif defined (DIGITAL_UNIX) // osf1
diff --git a/ace/OS.h b/ace/OS.h
index c119c54305d..e886b1b6edf 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -3360,13 +3360,13 @@ extern "C"
# if defined (ACE_HAS_SIGINFO_T)
# if !defined (ACE_LACKS_SIGINFO_H)
-# if defined (__QNX__)
+# if defined (__QNX__) || defined (__OpenBSD__)
# include /**/ <sys/siginfo.h>
# elif defined(__rtems__)
# include /**/ <signal.h>
-# else /* ! __QNX__ */
+# else /* __QNX__ || __OpenBSD__ */
# include /**/ <siginfo.h>
-# endif /* ! __QNX__ */
+# endif /* __QNX__ || __OpenBSD__ */
# endif /* ACE_LACKS_SIGINFO_H */
# if !defined (ACE_LACKS_UCONTEXT_H)
# include /**/ <ucontext.h>
@@ -4787,7 +4787,10 @@ public:
FILE *fp);
static int fgetc (FILE* fp);
+
+#if !defined (ACE_LACKS_CLEARERR)
static void clearerr (FILE* fp);
+#endif /* !ACE_LACKS_CLEARERR */
#if defined (ACE_HAS_WCHAR)
static wint_t fgetwc (FILE* fp);
diff --git a/ace/OS.i b/ace/OS.i
index 8624507aaca..2a6cb761c4e 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -287,6 +287,10 @@ extern "C" char *mktemp (char *);
# include /**/ <ctype.h>
# endif /* UNIXWARE */
+# if defined (ACE_HAS_GETIFADDRS)
+# include /**/ <ifaddrs.h>
+# endif /* ACE_HAS_GETIFADDRS */
+
// Adapt the weird threading and synchronization routines (which
// return errno rather than -1) so that they return -1 and set errno.
// This is more consistent with the rest of ACE_OS and enables use to
@@ -8024,6 +8028,12 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
{
ACE_OS_TRACE ("ACE_OS::dlsym");
+#if defined (ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE)
+ // Check if the handle is valid before making any calls using it.
+ if (handle == ACE_SHLIB_INVALID_HANDLE)
+ return 0;
+#endif /* ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE */
+
// Get the correct OS type.
#if defined (ACE_HAS_WINCE)
const wchar_t *symbolname = sname;
@@ -9891,11 +9901,13 @@ ACE_OS::fgetc (FILE* fp)
ACE_OSCALL_RETURN (::fgetc (fp), int, -1);
}
+#if !defined (ACE_LACKS_CLEARERR)
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
{
::clearerr(fp);
}
+#endif /* !ACE_LACKS_CLEARERR */
#if defined (ACE_HAS_WCHAR)
diff --git a/ace/POSIX_Proactor.cpp b/ace/POSIX_Proactor.cpp
index b8123b4167f..4fc723e56fa 100644
--- a/ace/POSIX_Proactor.cpp
+++ b/ace/POSIX_Proactor.cpp
@@ -74,6 +74,11 @@ ACE_POSIX_Proactor::ACE_POSIX_Proactor (void)
#elif defined(__sgi)
os_id_ = OS_IRIX; // set family
+
+#elif defined(__OpenBSD)
+
+ os_id_ = OS_OPENBSD; // set family
+
// do the same
//#else defined (LINUX, __FreeBSD__ ...)
@@ -865,12 +870,12 @@ void ACE_POSIX_AIOCB_Proactor::check_max_aio_num ()
ACE_LIB_TEXT( "SGI IRIX specific: aio_init!\n")));
//typedef struct aioinit {
-// int aio_threads; /* The number of aio threads to start (5) */
-// int aio_locks; /* Initial number of preallocated locks (3) */
-// int aio_num; /* estimated total simultanious aiobc structs (1000) */
-// int aio_usedba; /* Try to use DBA for raw I/O in lio_listio (0) */
-// int aio_debug; /* turn on debugging (0) */
-// int aio_numusers; /* max number of user sprocs making aio_* calls (5) */
+// int aio_threads; /* The number of aio threads to start (5) */
+// int aio_locks; /* Initial number of preallocated locks (3) */
+// int aio_num; /* estimated total simultanious aiobc structs (1000) */
+// int aio_usedba; /* Try to use DBA for raw I/O in lio_listio (0) */
+// int aio_debug; /* turn on debugging (0) */
+// int aio_numusers; /* max number of user sprocs making aio_* calls (5) */
// int aio_reserved[3];
//} aioinit_t;
diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h
index 0aa730d9180..168b6fcd8c2 100644
--- a/ace/POSIX_Proactor.h
+++ b/ace/POSIX_Proactor.h
@@ -87,7 +87,8 @@ public:
OS_HPUX_11 = OS_HPUX | 0x0001,
OS_LINUX = 0x0800, // Linux family
OS_FREEBSD = 0x1000, // FreeBSD family
- OS_IRIX = 0x2000 // SGI IRIX family
+ OS_IRIX = 0x2000, // SGI IRIX family
+ OS_OPENBSD = 0x4000 // OpenBSD familty
};
virtual Proactor_Type get_impl_type (void);
@@ -100,7 +101,7 @@ public:
/// This function is a no-op function for Unix systems. Returns 0.
virtual int register_handle (ACE_HANDLE handle,
- const void *completion_key);
+ const void *completion_key);
/**
* Post a result to the completion port of the Proactor. If errors
@@ -240,9 +241,9 @@ protected:
* POSIX Proators.
*/
void application_specific_code (ACE_POSIX_Asynch_Result *asynch_result,
- size_t bytes_transferred,
- const void *completion_key,
- u_long error);
+ size_t bytes_transferred,
+ const void *completion_key,
+ u_long error);
/**
* Post <how_many> completions to the completion port so that all
@@ -394,9 +395,9 @@ protected:
/// We will call the base class's application_specific_code from
/// here.
void application_specific_code (ACE_POSIX_Asynch_Result *asynch_result,
- size_t bytes_transferred,
- const void *completion_key,
- u_long error);
+ size_t bytes_transferred,
+ const void *completion_key,
+ u_long error);
virtual int register_and_start_aio (ACE_POSIX_Asynch_Result *result,
int op);
diff --git a/ace/README b/ace/README
index 92c7cbe88bc..eb577f2b485 100644
--- a/ace/README
+++ b/ace/README
@@ -290,7 +290,7 @@ ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS Compiler does not call
exception specification is
thrown. In particular, the
exception specification is not
- respected.
+ respected.
ACE_HAS_EXPLICIT_KEYWORD Compiler support explicit constructors.
ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION Compiler's template
instantiation mechanism
@@ -329,6 +329,12 @@ ACE_HAS_GNU_CSTRING_H Denotes that GNU has cstring.h
memchr()
ACE_HAS_GPERF The GPERF utility is compiled
for this platform
+ACE_HAS_GETIFADDRS This platform has ifaddrs.h and
+ the getifaddrs() function. This
+ is used in preference to
+ the SIOCGIFCONF ioctl call, since
+ it is much simpler and supports
+ IPv6 and non-IP interfaces better.
ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT Optimize
ACE_Handle_Set::count_bits for
select() operations (common
@@ -477,6 +483,10 @@ ACE_HAS_XPG4_MULTIBYTE_CHAR Platform has support for
classification.
ACE_HAS_REGEX Platform supports the POSIX
regular expression library
+ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE For OpenBSD: The dlsym call
+ segfaults when passed an invalid
+ handle. Other platforms handle
+ this more gracefully.
ACE_HAS_SELECT_H Platform has special header for select().
ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL For Win32: Use Select_Reactor
as default implementation of
@@ -670,6 +680,8 @@ ACE_LACKS_AUTO_MMAP_REPLACEMENT No system support for replacing any
ACE_LACKS_BSEARCH Compiler/platform lacks the
standard C library bsearch()
function
+ACE_LACKS_CLEARERR Platform lacks the clearerr system
+ call.
ACE_LACKS_CMSG_DATA_MACRO Platform has
ACE_HAS_4_4BSD_SENDMSG_RECVMSG but does
not define CMSG_DATA (cmsg) macro.
diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp
index f0b324be301..57df9178d7a 100644
--- a/ace/Sock_Connect.cpp
+++ b/ace/Sock_Connect.cpp
@@ -918,6 +918,57 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count,
# endif /* ACE_HAS_PHARLAP */
# endif /* Winsock 2 && MSVC 5 or later */
+#elif defined (ACE_HAS_GETIFADDRS)
+ // Take advantage of the BSD getifaddrs function that simplifies
+ // access to connected interfaces.
+ struct ifaddrs *ifap;
+ struct ifaddrs *p_if;
+
+ if (::getifaddrs (&ifap) != 0)
+ return -1;
+
+ // Count number of interfaces.
+ size_t num_ifs = 0;
+ for (p_if = ifap; p_if != 0; p_if = p_if->ifa_next)
+ ++num_ifs;
+
+ // Now create and initialize output array.
+ ACE_NEW_RETURN (addrs,
+ ACE_INET_Addr[num_ifs],
+ -1); // caller must free
+
+ // Pull the address out of each INET interface. Not every interface
+ // is for IP, so be careful to count properly. When setting the
+ // INET_Addr, note that the 3rd arg (0) says to leave the byte order
+ // (already in net byte order from the interface structure) as is.
+ count = 0;
+
+ for (p_if = ifap;
+ p_if != 0;
+ p_if = p_if->ifa_next)
+ {
+ if (p_if->ifa_addr &&
+ p_if->ifa_addr->sa_family == AF_INET)
+ {
+ struct sockaddr_in *addr =
+ ACE_reinterpret_cast(sockaddr_in *, p_if->ifa_addr);
+
+ // Sometimes the kernel returns 0.0.0.0 as the interface
+ // address, skip those...
+ if (addr->sin_addr.s_addr != 0)
+ {
+ addrs[count].set ((u_short) 0,
+ addr->sin_addr.s_addr,
+ 0);
+ count++;
+ }
+ }
+ }
+
+ ::freeifaddrs (ifap);
+
+ return 0;
+
#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || defined (__MACOSX__)
// COMMON (SVR4 and BSD) UNIX CODE
@@ -1058,22 +1109,22 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count,
// Now create and initialize output array.
ACE_NEW_RETURN (addrs,
- ACE_INET_Addr[count],
+ ACE_INET_Addr[count],
-1); // caller must free
count = 0;
for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next)
- {
+ {
struct ifnet* ifp = ia->ia_ifa.ifa_ifp;
- if (ifp != 0)
+ if (ifp != 0)
{
// Get the current interface name
char interface[64];
ACE_OS::sprintf(interface, "%s%d", ifp->if_name, ifp->if_unit);
-
+
// Get the address for the current interface
char address [INET_ADDR_LEN];
STATUS status = ifAddrGet(interface, address);
-
+
if (status == OK)
{
// Concatenate a ':' at the end. This is because in
@@ -1085,10 +1136,10 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count,
addrs[count].set (address);
}
else
- {
+ {
ACE_ERROR_RETURN ((LM_ERROR,
ACE_LIB_TEXT ("ACE::get_ip_interface failed\n"),
- ACE_LIB_TEXT ("Couldnt get the IP Address\n")),
+ ACE_LIB_TEXT ("Couldnt get the IP Address\n")),
-1);
}
++count;
@@ -1120,6 +1171,24 @@ ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many)
-1);
how_many = (size_t) tmp_how_many;
return 0;
+#elif defined (ACE_HAS_GETIFADDRS)
+ ACE_UNUSED_ARG (handle);
+
+ struct ifaddrs *ifap;
+ struct ifaddrs *p_if;
+
+ if (::getifaddrs (&ifap) != 0)
+ return -1;
+
+ // Count number of interfaces.
+ size_t num_ifs = 0;
+ for (p_if = ifap; p_if != 0; p_if = p_if->ifa_next)
+ ++num_ifs;
+
+ ::freeifaddrs (ifap);
+
+ how_many = num_ifs;
+ return 0;
#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || defined (__MACOSX__)
// Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX,
// AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of
@@ -1175,7 +1244,9 @@ ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many)
i < num_ifs;
i++)
{
- if (p_ifs->ifr_name[0] == '\0')
+ /* In OpenBSD, the length of the list is returned. */
+ ifcfg.ifc_len -= sizeof (struct ifreq);
+ if (ifcfg.ifc_len < 0)
break;
if_count++;
diff --git a/ace/config-openbsd-pthread.h b/ace/config-openbsd-pthread.h
new file mode 100644
index 00000000000..f355ed0feba
--- /dev/null
+++ b/ace/config-openbsd-pthread.h
@@ -0,0 +1,206 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ***** This configuration file is still under testing. *****
+
+// The following configuration file is designed to work for OpenBSD
+// platforms using GNU C++ and the POSIX (pthread) threads package.
+
+#ifndef ACE_CONFIG_H
+#define ACE_CONFIG_H
+#include "ace/pre.h"
+
+#if ! defined (__ACE_INLINE__)
+#define __ACE_INLINE__
+#endif /* ! __ACE_INLINE__ */
+
+#define ACE_SIZEOF_LONG_DOUBLE 12
+
+#if defined (__GNUG__)
+# include "ace/config-g++-common.h"
+#endif /* __GNUG__ */
+
+// Platform specific directives
+// gcc defines __OpenBSD__ automatically for us.
+#if !defined (_THREAD_SAFE)
+#define _THREAD_SAFE
+#endif /* _THREAD_SAFE */
+
+// Check if pthreads and native exceptions are being used together.
+// This causes SEGVs to tbe thrown somewhat randomly for some
+// reason. According to newsgroup postings, it appears to be an
+// OpenBSD or gcc bug.
+#if defined (ACE_USES_NATIVE_EXCEPTIONS)
+#error "OpenBSD pthreads and native exceptions currently do not work. See OpenBSD bug #1750"
+#endif /* ACE_USES_NATIVE_EXCEPTIONS */
+
+#define ACE_HAS_GPERF
+
+/* Are the following true? */
+#define ACE_LACKS_GETPGID
+#define ACE_LACKS_SETPGID
+#define ACE_LACKS_SETREGID
+#define ACE_LACKS_SETREUID
+
+#define ACE_HAS_ALT_CUSERID
+#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS
+
+#define ACE_LACKS_RWLOCK_T
+#define ACE_HAS_SIG_MACROS
+#define ACE_HAS_CHARPTR_DL
+#define ACE_HAS_DIRENT
+#define ACE_USES_ASM_SYMBOL_IN_DLSYM
+
+#define ACE_LACKS_UCONTEXT_H
+
+
+// OpenBSD has sigwait defined
+#define ACE_HAS_SIGWAIT
+#define ACE_HAS_SIGINFO_T
+
+#define ACE_HAS_REENTRANT_FUNCTIONS
+#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS
+#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS
+#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS
+#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
+
+#define ACE_HAS_SOCKLEN_T
+
+#define ACE_HAS_POLL
+
+// Use of <malloc.h> is deprecated.
+#define ACE_LACKS_MALLOC_H
+
+// NetBSD appears to have a sigset_t type.
+// #define ACE_LACKS_SIGSET
+
+// Platform supports POSIX timers via struct timespec.
+#define ACE_HAS_POSIX_TIME
+#define ACE_HAS_UALARM
+
+// Platform defines struct timespec but not timespec_t
+#define ACE_LACKS_TIMESPEC_T
+
+#define ACE_LACKS_SYSTIME_H
+
+#define ACE_LACKS_STRRECVFD
+
+#define ACE_HAS_SIN_LEN
+
+// Platform supports System V IPC (most versions of UNIX, but not Win32)
+#define ACE_HAS_SYSV_IPC
+
+// Compiler/platform contains the <sys/syscall.h> file.
+#define ACE_HAS_SYSCALL_H
+
+// OpenBSD supports the getifaddrs interface
+#define ACE_HAS_GETIFADDRS
+
+// Compiler/platform supports SVR4 signal typedef
+#define ACE_HAS_SVR4_SIGNAL_T
+#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
+// Compiler/platform supports alloca().
+#define ACE_HAS_ALLOCA
+
+// Compiler/platform supports SVR4 dynamic linking semantics..
+#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
+// Compiler/platform correctly calls init()/fini() for shared libraries.
+#define ACE_HAS_AUTOMATIC_INIT_FINI
+
+// Explicit dynamic linking permits "lazy" symbol resolution
+#define ACE_HAS_RTLD_LAZY_V
+
+// platform supports POSIX O_NONBLOCK semantics
+#define ACE_HAS_POSIX_NONBLOCK
+
+// platform supports IP multicast
+#define ACE_HAS_IP_MULTICAST
+
+// Compiler/platform has <alloca.h>
+//#define ACE_HAS_ALLOCA_H
+
+// Compiler/platform has the getrusage() system call.
+#define ACE_HAS_GETRUSAGE
+
+// Compiler/platform defines the sig_atomic_t typedef.
+#define ACE_HAS_SIG_ATOMIC_T
+
+// Compiler/platform supports sys_siglist array.
+// *** This refers to (_sys_siglist) instead of (sys_siglist)
+// #define ACE_HAS_SYS_SIGLIST
+
+// Compiler/platform defines a union semun for SysV shared memory.
+#define ACE_HAS_SEMUN
+
+// Compiler supports the ssize_t typedef.
+#define ACE_HAS_SSIZE_T
+
+// Compiler/platform supports strerror ().
+#define ACE_HAS_STRERROR
+
+// Compiler/platform provides the sockio.h file.
+#define ACE_HAS_SOCKIO_H
+
+// Defines the page size of the system.
+#define ACE_PAGE_SIZE 4096
+
+// Platform provides <sys/filio.h> header.
+#define ACE_HAS_SYS_FILIO_H
+
+// Compiler/platform supports SVR4 gettimeofday() prototype
+#define ACE_HAS_SUNOS4_GETTIMEOFDAY
+// #define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
+//#define ACE_HAS_SIG_C_FUNC
+
+// OpenBSD's dlsym call segfaults when passed an invalid handle.
+// It seems as if most other OSs detect this and just report an
+// error.
+#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE
+
+// Turns off the tracing feature.
+#if !defined (ACE_NTRACE)
+#define ACE_NTRACE 1
+#endif /* ACE_NTRACE */
+
+#define ACE_HAS_MSG
+#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+#define ACE_HAS_NONCONST_MSGSND
+
+#define ACE_HAS_SIGWAIT
+
+// Optimize ACE_Handle_Set for select().
+#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
+// Thread specific settings
+// Yes, we do have threads.
+#define ACE_HAS_THREADS
+// And they're even POSIX pthreads
+#if !defined (ACE_MT_SAFE)
+# define ACE_MT_SAFE 1
+#endif /* ! ACE_MT_SAFE */
+#define ACE_HAS_PTHREADS
+#define ACE_HAS_PTHREADS_STD
+//#define ACE_LACKS_SETSCHED
+//#define ACE_LACKS_PTHREAD_CANCEL
+#define ACE_LACKS_THREAD_PROCESS_SCOPING
+//#define ACE_LACKS_PTHREAD_THR_SIGSETMASK
+#define ACE_LACKS_CONDATTR_PSHARED
+#define ACE_LACKS_MUTEXATTR_PSHARED
+#define ACE_HAS_THREAD_SPECIFIC_STORAGE
+#define ACE_HAS_DIRENT
+
+#define ACE_HAS_TERM_IOCTLS
+#define ACE_USES_NEW_TERMIOS_STRUCT
+#define TCGETS TIOCGETA
+#define TCSETS TIOCSETA
+
+// OpenBSD actually has the clearerr call, but it causes a
+// bogus compiler syntax error.
+#define ACE_LACKS_CLEARERR
+
+#include "ace/post.h"
+#endif /* ACE_CONFIG_H */
diff --git a/ace/config-openbsd.h b/ace/config-openbsd.h
new file mode 100644
index 00000000000..cdd4a04fb52
--- /dev/null
+++ b/ace/config-openbsd.h
@@ -0,0 +1,164 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ***** This configuration file is still under testing. *****
+
+// The following configuration file is designed to work for OpenBSD
+// platforms using GNU g++.
+
+#ifndef ACE_CONFIG_H
+#define ACE_CONFIG_H
+#include "ace/pre.h"
+
+#if ! defined (__ACE_INLINE__)
+#define __ACE_INLINE__
+#endif /* ! __ACE_INLINE__ */
+
+#define ACE_SIZEOF_LONG_DOUBLE 12
+
+#if defined (__GNUG__)
+# include "ace/config-g++-common.h"
+#endif /* __GNUG__ */
+
+#define ACE_HAS_GPERF
+
+// Platform specific directives
+#define ACE_LACKS_GETPGID
+#define ACE_LACKS_SETPGID
+#define ACE_LACKS_SETREGID
+#define ACE_LACKS_SETREUID
+#define ACE_LACKS_RWLOCK_T
+#define ACE_HAS_SIG_MACROS
+#define ACE_HAS_CHARPTR_DL
+#define ACE_HAS_DIRENT
+#define ACE_USES_ASM_SYMBOL_IN_DLSYM
+
+#define ACE_LACKS_UCONTEXT_H
+
+
+// OpenBSD has sigwait defined
+#define ACE_HAS_SIGWAIT
+#define ACE_HAS_SIGINFO_T
+
+#define ACE_HAS_SOCKLEN_T
+
+#define ACE_HAS_POLL
+
+// Use of <malloc.h> is deprecated.
+#define ACE_LACKS_MALLOC_H
+
+// NetBSD appears to have a sigset_t type.
+// #define ACE_LACKS_SIGSET
+
+// Platform supports POSIX timers via struct timespec.
+#define ACE_HAS_POSIX_TIME
+#define ACE_HAS_UALARM
+
+// Platform defines struct timespec but not timespec_t
+#define ACE_LACKS_TIMESPEC_T
+
+#define ACE_LACKS_SYSTIME_H
+
+#define ACE_LACKS_STRRECVFD
+
+#define ACE_HAS_SIN_LEN
+
+// Platform supports System V IPC (most versions of UNIX, but not Win32)
+#define ACE_HAS_SYSV_IPC
+
+// Compiler/platform contains the <sys/syscall.h> file.
+#define ACE_HAS_SYSCALL_H
+
+// OpenBSD supports the getifaddrs interface
+#define ACE_HAS_GETIFADDRS
+
+// Compiler/platform supports SVR4 signal typedef
+#define ACE_HAS_SVR4_SIGNAL_T
+#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+
+// Compiler/platform supports alloca().
+#define ACE_HAS_ALLOCA
+
+// Compiler/platform supports SVR4 dynamic linking semantics..
+#define ACE_HAS_SVR4_DYNAMIC_LINKING
+
+// Compiler/platform correctly calls init()/fini() for shared libraries.
+#define ACE_HAS_AUTOMATIC_INIT_FINI
+
+// Explicit dynamic linking permits "lazy" symbol resolution
+#define ACE_HAS_RTLD_LAZY_V
+
+// platform supports POSIX O_NONBLOCK semantics
+#define ACE_HAS_POSIX_NONBLOCK
+
+// platform supports IP multicast
+#define ACE_HAS_IP_MULTICAST
+
+// Compiler/platform has <alloca.h>
+//#define ACE_HAS_ALLOCA_H
+
+// Compiler/platform has the getrusage() system call.
+#define ACE_HAS_GETRUSAGE
+
+// Compiler/platform defines the sig_atomic_t typedef.
+#define ACE_HAS_SIG_ATOMIC_T
+
+// Compiler/platform supports sys_siglist array.
+// *** This refers to (_sys_siglist) instead of (sys_siglist)
+// #define ACE_HAS_SYS_SIGLIST
+
+// Compiler/platform defines a union semun for SysV shared memory.
+#define ACE_HAS_SEMUN
+
+// Compiler supports the ssize_t typedef.
+#define ACE_HAS_SSIZE_T
+
+// Compiler/platform supports strerror ().
+#define ACE_HAS_STRERROR
+
+// Compiler/platform provides the sockio.h file.
+#define ACE_HAS_SOCKIO_H
+
+// Defines the page size of the system.
+#define ACE_PAGE_SIZE 4096
+
+// Platform provides <sys/filio.h> header.
+#define ACE_HAS_SYS_FILIO_H
+
+// Compiler/platform supports SVR4 gettimeofday() prototype
+#define ACE_HAS_SUNOS4_GETTIMEOFDAY
+// #define ACE_HAS_TIMEZONE_GETTIMEOFDAY
+
+//#define ACE_HAS_SIG_C_FUNC
+
+// OpenBSD's dlsym call segfaults when passed an invalid handle.
+// It seems as if most other OSs detect this and just report an
+// error.
+#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE
+
+// Turns off the tracing feature.
+#if !defined (ACE_NTRACE)
+#define ACE_NTRACE 1
+#endif /* ACE_NTRACE */
+
+#define ACE_HAS_MSG
+#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG
+#define ACE_HAS_NONCONST_MSGSND
+
+#define ACE_HAS_SIGWAIT
+
+// Optimize ACE_Handle_Set for select().
+#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
+#define ACE_HAS_NONCONST_SELECT_TIMEVAL
+
+#define ACE_HAS_TERM_IOCTLS
+#define ACE_USES_NEW_TERMIOS_STRUCT
+#define TCGETS TIOCGETA
+#define TCSETS TIOCSETA
+
+// OpenBSD actually has the clearerr call, but it causes a
+// bogus compiler syntax error.
+#define ACE_LACKS_CLEARERR
+
+#include "ace/post.h"
+#endif /* ACE_CONFIG_H */
diff --git a/include/makeinclude/platform_openbsd.GNU b/include/makeinclude/platform_openbsd.GNU
new file mode 100644
index 00000000000..2922bdbaf9e
--- /dev/null
+++ b/include/makeinclude/platform_openbsd.GNU
@@ -0,0 +1,48 @@
+# $Id$
+
+# platform_openbsd.GNU
+
+# ***** Notice: This file is still under testing. *****
+# To be used on an OpenBSD platform without pthread support.
+
+versioned_so = 1
+
+ifndef exceptions
+ exceptions = 1
+endif
+
+ifeq (,$(debug))
+ debug = 1
+endif
+
+ifeq (,$(optimize))
+ optimize = 1
+endif
+
+CC = gcc
+CXX = g++
+
+# Setting the internal name and version of shared libraries isn't supported
+# by OpenBSD. In fact, the -h option gives an error and interestingly
+# enough, the -soname option doesn't but just ignores its parameter.
+SONAME =
+
+include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU
+
+CFLAGS += -W -Wall -Wpointer-arith -pipe
+CCFLAGS += $(CFLAGS) $(TEMPLATES_FLAG)
+DCFLAGS += -g
+LDFLAGS += -Wl,-rpath $(ACE_ROOT)/ace
+DLD = $(CXX)
+LD = $(CXX)
+LIBS += -lstdc++
+OCFLAGS += -O2
+PIC = -fpic
+AR = ar
+ARFLAGS = ruv
+RANLIB = ranlib
+
+#SOFLAGS += -Bshareable -x /usr/lib/c++rt0.o
+SOFLAGS += $(CPPFLAGS) -shared
+SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<
+PRELIB = @echo
diff --git a/include/makeinclude/platform_openbsd_pthread.GNU b/include/makeinclude/platform_openbsd_pthread.GNU
new file mode 100644
index 00000000000..5a297431549
--- /dev/null
+++ b/include/makeinclude/platform_openbsd_pthread.GNU
@@ -0,0 +1,8 @@
+# $Id$
+
+# platform_openbsd_pthread.GNU
+
+include $(ACE_ROOT)/include/makeinclude/platform_openbsd.GNU
+
+LDFLAGS += -pthread
+CFLAGS += -D_THREAD_SAFE
diff --git a/tests/Malloc_Test.cpp b/tests/Malloc_Test.cpp
index e6a95cbf7db..cbd295da3a5 100644
--- a/tests/Malloc_Test.cpp
+++ b/tests/Malloc_Test.cpp
@@ -41,12 +41,14 @@ typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> MALLOC;
&& !(defined (ACE_WIN32) \
&& (defined (ghs) \
|| defined (__MINGW32__) \
- || (!defined(ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0))))
+ || (!defined(ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0)))) \
+ && !(defined (__OpenBSD__) && defined (ACE_HAS_PTHREADS))
#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.
// Win9x doesn't support remaps.
+// OpenBSD causes this test to hang in the child when pthreads are enabled.
// On these plarforms, we make sure the remapping will never occur.
#endif /* linux && Win32 GHS*/
diff --git a/tests/Reactor_Dispatch_Order_Test.cpp b/tests/Reactor_Dispatch_Order_Test.cpp
index 585c72fa6ac..f150990d61c 100644
--- a/tests/Reactor_Dispatch_Order_Test.cpp
+++ b/tests/Reactor_Dispatch_Order_Test.cpp
@@ -93,6 +93,14 @@ Handler::handle_output (ACE_HANDLE)
ACE_DEBUG ((LM_DEBUG,
"Handler::handle_output\n"));
+#if defined (__OpenBSD__)
+ // All that we need written has been written, so don't
+ // call handle_output again.
+ this->reactor ()->mask_ops (this->pipe_.read_handle (),
+ ACE_Event_Handler::WRITE_MASK,
+ ACE_Reactor::CLR_MASK);
+#endif /* __OpenBSD__ */
+
return 0;
}