Dep/ACE: Upgrade ACE -library to 5.8.3

--HG--
branch : trunk
This commit is contained in:
click
2010-11-04 05:30:29 +01:00
parent 2604250c3c
commit 9b16ee203f
581 changed files with 10265 additions and 14303 deletions
+46 -69
View File
@@ -1,4 +1,4 @@
// $Id: ACE.cpp 91066 2010-07-12 11:05:04Z johnnyw $
// $Id: ACE.cpp 92298 2010-10-21 11:15:17Z johnnyw $
#include "ace/ACE.h"
@@ -33,18 +33,12 @@ extern "C" int maxFiles;
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
#if defined (ACE_HAS_POLL)
# include "ace/OS_NS_poll.h"
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
ACE_RCSID (ace,
ACE,
"$Id: ACE.cpp 91066 2010-07-12 11:05:04Z johnnyw $")
#endif /* ACE_HAS_POLL */
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE
{
@@ -94,10 +88,6 @@ ACE::out_of_handles (int error)
#elif defined (__OpenBSD__)
// OpenBSD appears to return EBADF.
error == EBADF ||
#elif defined (__sgi) // irix
error == ENOTSUP ||
#elif defined (DIGITAL_UNIX) // osf1
error == ENOTSUP ||
#endif /* ACE_WIN32 */
error == ENFILE)
return 1;
@@ -1768,7 +1758,7 @@ ACE::sendv_n_i (ACE_HANDLE handle,
{
// Try to transfer as much of the remaining data as possible.
ssize_t n = ACE_OS::sendv (handle, iov + s, iovcnt - s);
// Check EOF.
if (n == 0)
return 0;
@@ -2175,28 +2165,29 @@ ACE::handle_ready (ACE_HANDLE handle,
int write_ready,
int exception_ready)
{
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
ACE_UNUSED_ARG (write_ready);
#if defined (ACE_HAS_POLL)
ACE_UNUSED_ARG (exception_ready);
struct pollfd fds;
fds.fd = handle;
fds.events = read_ready ? POLLIN : POLLOUT;
fds.events = read_ready ? POLLIN : 0;
if( write_ready )
{
fds.events |= POLLOUT;
}
fds.revents = 0;
int result = ACE_OS::poll (&fds, 1, timeout);
int const result = ACE_OS::poll (&fds, 1, timeout);
#else
ACE_Handle_Set handle_set;
handle_set.set_bit (handle);
// Wait for data or for the timeout to elapse.
int select_width;
# if defined (ACE_WIN32)
// This arg is ignored on Windows and causes pointer truncation
// warnings on 64-bit compiles.
select_width = 0;
# else
int select_width = 0;
#if !defined (ACE_WIN32)
select_width = int (handle) + 1;
# endif /* ACE_WIN64 */
int result = ACE_OS::select (select_width,
@@ -2205,8 +2196,7 @@ ACE::handle_ready (ACE_HANDLE handle,
exception_ready ? handle_set.fdset () : 0, // exception_fds.
timeout);
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_HAS_POLL */
switch (result)
{
case 0: // Timer expired.
@@ -2227,14 +2217,12 @@ ACE::enter_recv_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int &val)
{
int result = ACE::handle_read_ready (handle,
timeout);
int const result = ACE::handle_read_ready (handle, timeout);
if (result == -1)
return -1;
ACE::record_and_set_non_blocking_mode (handle,
val);
ACE::record_and_set_non_blocking_mode (handle, val);
return result;
}
@@ -2244,21 +2232,18 @@ ACE::enter_send_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int &val)
{
int result = ACE::handle_write_ready (handle,
timeout);
int const result = ACE::handle_write_ready (handle, timeout);
if (result == -1)
return -1;
ACE::record_and_set_non_blocking_mode (handle,
val);
ACE::record_and_set_non_blocking_mode (handle, val);
return result;
}
void
ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle,
int &val)
ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle, int &val)
{
// We need to record whether we are already *in* nonblocking mode,
// so that we can correctly reset the state when we're done.
@@ -2271,11 +2256,9 @@ ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle,
}
void
ACE::restore_non_blocking_mode (ACE_HANDLE handle,
int val)
ACE::restore_non_blocking_mode (ACE_HANDLE handle, int val)
{
if (ACE_BIT_DISABLED (val,
ACE_NONBLOCK))
if (ACE_BIT_DISABLED (val, ACE_NONBLOCK))
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
@@ -2285,11 +2268,9 @@ ACE::restore_non_blocking_mode (ACE_HANDLE handle,
}
}
// Format buffer into printable format. This is useful for debugging.
// Portions taken from mdump by J.P. Knight ([email protected])
// Modifications by Todd Montgomery.
/// Format buffer into printable format. This is useful for debugging.
/// Portions taken from mdump by J.P. Knight ([email protected])
/// Modifications by Todd Montgomery.
size_t
ACE::format_hexdump (const char *buffer,
size_t size,
@@ -2436,7 +2417,7 @@ ACE::timestamp (const ACE_Time_Value& time_value,
ACE_TEXT ("Fri"),
ACE_TEXT ("Sat")
};
static const ACE_TCHAR *month_name[] =
{
ACE_TEXT ("Jan"),
@@ -2452,10 +2433,10 @@ ACE::timestamp (const ACE_Time_Value& time_value,
ACE_TEXT ("Nov"),
ACE_TEXT ("Dec")
};
SYSTEMTIME local;
::GetLocalTime (&local);
ACE_OS::sprintf (date_and_time,
ACE_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"),
day_of_week_name[local.wDayOfWeek],
@@ -2470,8 +2451,8 @@ ACE::timestamp (const ACE_Time_Value& time_value,
}
#endif /* WIN32 */
ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page.
ACE_Time_Value cur_time =
(time_value == ACE_Time_Value::zero) ?
ACE_Time_Value cur_time =
(time_value == ACE_Time_Value::zero) ?
ACE_Time_Value (ACE_OS::gettimeofday ()) : time_value;
time_t secs = cur_time.sec ();
@@ -2534,7 +2515,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
{
ACE_TRACE ("ACE::handle_timed_complete");
#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL)
struct pollfd fds;
@@ -2547,7 +2528,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
ACE_Handle_Set wr_handles;
rd_handles.set_bit (h);
wr_handles.set_bit (h);
#endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* !ACE_WIN32 && ACE_HAS_POLL */
#if defined (ACE_WIN32)
// Winsock is different - it sets the exception bit for failed connect,
@@ -2567,7 +2548,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
ex_handles,
timeout);
#else
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
# if defined (ACE_HAS_POLL)
int n = ACE_OS::poll (&fds, 1, timeout);
@@ -2585,7 +2566,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
wr_handles,
0,
timeout);
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
# endif /* ACE_HAS_POLL */
#endif /* ACE_WIN32 */
// If we failed to connect within the time period allocated by the
@@ -2619,18 +2600,18 @@ ACE::handle_timed_complete (ACE_HANDLE h,
}
#else
if (is_tli)
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
# if defined (ACE_HAS_POLL)
need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT);
# else
need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h);
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
# endif /* ACE_HAS_POLL */
else
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
# if defined (ACE_HAS_POLL)
need_to_check = (fds.revents & POLLIN);
# else
need_to_check = true;
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
# endif /* ACE_HAS_POLL */
#endif /* ACE_WIN32 */
if (need_to_check)
@@ -2692,7 +2673,7 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
if (listener == ACE_INVALID_HANDLE)
return -1;
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
#if defined (ACE_HAS_POLL)
struct pollfd fds;
@@ -2704,29 +2685,25 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
// Use the select() implementation rather than poll().
ACE_Handle_Set rd_handle;
rd_handle.set_bit (listener);
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_HAS_POLL */
// We need a loop here if <restart> is enabled.
for (;;)
{
#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
#if defined (ACE_HAS_POLL)
int n = ACE_OS::poll (&fds, 1, timeout);
#else
int select_width;
# if defined (ACE_WIN32)
// This arg is ignored on Windows and causes pointer truncation
// warnings on 64-bit compiles.
select_width = 0;
# else
int select_width = 0;
# if !defined (ACE_WIN32)
select_width = int (listener) + 1;
# endif /* ACE_WIN32 */
int n = ACE_OS::select (select_width,
rd_handle, 0, 0,
timeout);
#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_HAS_POLL */
switch (n)
{