summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2006-02-25 23:02:13 +0000
committerSteve Huston <shuston@riverace.com>2006-02-25 23:02:13 +0000
commitda2bf0662ae0d38e889dc1677ded151dbe337479 (patch)
treef17f479d7533c56441701458efd01c65725f5f15
parent379d6d3086f0e4fcc791d4ad261c9ce5b1096781 (diff)
downloadATCD-da2bf0662ae0d38e889dc1677ded151dbe337479.tar.gz
ChangeLogTag:Sat Feb 25 22:57:32 UTC 2006 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog14
-rw-r--r--ace/SOCK_IO.cpp19
-rw-r--r--ace/SOCK_IO.h12
-rw-r--r--ace/SOCK_IO.inl5
-rw-r--r--tests/Process_Manual_Event_Test.cpp15
5 files changed, 52 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index a6d023e472b..6628616101c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Sat Feb 25 22:57:32 UTC 2006 Steve Huston <shuston@riverace.com>
+
+ * tests/Process_Manual_Event_Test.cpp: On Windows, use a complete
+ path name to spawn the child process with, else it doesn't work when
+ the test is in a subdir of ACE_wrappers/tests, as it is with
+ Win XP64 and WinCE.
+
+ * ace/SOCK_IO.h: Clarify that on recvv() and sendv(), the number of
+ iovecs handled will be limited to the maximum value of an int.
+ * ace/SOCK_IO.inl (sendv, recvv): ACE_Truncate the 'n' number of
+ iovecs passed down to the ACE level.
+ * ace/SOCK_IO.cpp (send, recv): Reduce the size_t n iovec count to an
+ int range after dividing by 2 to fit it into the ACE_OS level.
+
Sat Feb 25 12:45:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
* bin/tao_other_tests.lst:
diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp
index bf70db6d1ee..74d9b5c13e1 100644
--- a/ace/SOCK_IO.cpp
+++ b/ace/SOCK_IO.cpp
@@ -6,6 +6,7 @@
#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_Memory.h"
+#include "ace/Truncate.h"
#if !defined (__ACE_INLINE__)
#include "ace/SOCK_IO.inl"
@@ -79,9 +80,15 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
ACE_NEW_RETURN (io_vec->iov_base,
char[inlen],
-1);
- io_vec->iov_len = this->recv (io_vec->iov_base,
- inlen);
- return io_vec->iov_len;
+ // It's ok to blindly cast this value since 'inlen' is an int and, thus,
+ // we can't get more than that back. Besides, if the recv() fails, we
+ // don't want that value cast to unsigned and returned.
+ ssize_t recv_len = this->recv (io_vec->iov_base, inlen);
+ if (recv_len > 0)
+ // u_long is the Windows type; size_t is everyone else's. A u_long
+ // should go into a size_t anywhere without an issue.
+ io_vec->iov_len = static_cast<u_long> (recv_len);
+ return recv_len;
}
else
return 0;
@@ -103,7 +110,7 @@ ACE_SOCK_IO::send (size_t n, ...) const
ACE_TRACE ("ACE_SOCK_IO::send");
va_list argp;
- size_t total_tuples = n / 2;
+ int total_tuples = ACE_Truncate<size_t> (n / 2);
iovec *iovp = 0;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
@@ -115,7 +122,7 @@ ACE_SOCK_IO::send (size_t n, ...) const
va_start (argp, n);
- for (size_t i = 0; i < total_tuples; i++)
+ for (int i = 0; i < total_tuples; i++)
{
iovp[i].iov_base = va_arg (argp, char *);
iovp[i].iov_len = va_arg (argp, int);
@@ -143,7 +150,7 @@ ACE_SOCK_IO::recv (size_t n, ...) const
ACE_TRACE ("ACE_SOCK_IO::recv");
va_list argp;
- size_t total_tuples = n / 2;
+ int total_tuples = ACE_Truncate<size_t> (n / 2);
iovec *iovp;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
diff --git a/ace/SOCK_IO.h b/ace/SOCK_IO.h
index 6353a823b72..746a414f6a2 100644
--- a/ace/SOCK_IO.h
+++ b/ace/SOCK_IO.h
@@ -70,6 +70,12 @@ public:
const ACE_Time_Value *timeout = 0) const;
/// Recv an <iovec> of size <n> from the connected socket.
+ /**
+ * @note The value of @a n will be silently reduced to the maximum
+ * value an @c int can hold if needed. This is due to the underlying
+ * system calls on many OSes limiting the number of @c iovec structures
+ * that can be passed in one call.
+ */
ssize_t recvv (iovec iov[],
size_t n,
const ACE_Time_Value *timeout = 0) const;
@@ -115,6 +121,12 @@ public:
const ACE_Time_Value *timeout = 0) const;
/// Send an <iovec> of size <n> to the connected socket.
+ /**
+ * @note The value of @a n will be silently reduced to the maximum
+ * value an @c int can hold if needed. This is due to the underlying
+ * system calls on many OSes limiting the number of @c iovec structures
+ * that can be passed in one call.
+ */
ssize_t sendv (const iovec iov[],
size_t n,
const ACE_Time_Value *timeout = 0) const;
diff --git a/ace/SOCK_IO.inl b/ace/SOCK_IO.inl
index 697cc5e84dc..78f24dec9da 100644
--- a/ace/SOCK_IO.inl
+++ b/ace/SOCK_IO.inl
@@ -3,6 +3,7 @@
// $Id$
#include "ace/OS_NS_unistd.h"
+#include "ace/Truncate.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -54,7 +55,7 @@ ACE_SOCK_IO::recvv (iovec iov[],
ACE_TRACE ("ACE_SOCK_IO::recvv");
return ACE::recvv (this->get_handle (),
iov,
- n,
+ ACE_Truncate<size_t> (n),
timeout);
}
@@ -124,7 +125,7 @@ ACE_SOCK_IO::sendv (const iovec iov[],
ACE_TRACE ("ACE_SOCK_IO::sendv");
return ACE::sendv (this->get_handle (),
iov,
- n,
+ ACE_Truncate<size_t> (n),
timeout);
}
diff --git a/tests/Process_Manual_Event_Test.cpp b/tests/Process_Manual_Event_Test.cpp
index 1de54720139..b697743273b 100644
--- a/tests/Process_Manual_Event_Test.cpp
+++ b/tests/Process_Manual_Event_Test.cpp
@@ -187,13 +187,18 @@ run_main (int argc, ACE_TCHAR *argv[])
else
{
ACE_START_TEST (ACE_TEXT ("Process_Manual_Event_Test"));
+#if defined (ACE_WIN32)
+ const ACE_TCHAR *cmdline_format = ACE_TEXT("\"%s\" -c -i %d");
+#elif !defined (ACE_USES_WCHAR)
+const ACE_TCHAR *cmdline_format = ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT("%s -c -i %d");
+#else
+const ACE_TCHAR *cmdline_format = ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT("%ls -c -i %d");
+#endif
+
ACE_Process_Options options;
- options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
- ACE_TEXT ("Process_Manual_Event_Test")
- ACE_PLATFORM_EXE_SUFFIX
- ACE_TEXT (" -c -i %d"),
+ options.command_line (cmdline_format,
+ argv[0],
iterations);
-
// Spawn a child process that will contend for the
// lock.
ACE_Process child;