summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-02-16 04:58:45 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-02-16 04:58:45 +0000
commit156eeb190c9006bd9f829c9df0baf9dfad06ed5b (patch)
treeb14548001390ba594bc81d52feecc7c193aa28a2
parent007152fac08efe3ba9c637731aa076132cdb21e4 (diff)
downloadATCD-156eeb190c9006bd9f829c9df0baf9dfad06ed5b.tar.gz
ChangeLogTag:Tue Feb 15 22:57:59 2000 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLogs/ChangeLog-02a7
-rw-r--r--ChangeLogs/ChangeLog-03a7
-rw-r--r--ace/MEM_IO.cpp43
-rw-r--r--ace/MEM_IO.h8
5 files changed, 71 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ee5293f2c5..7c77cc00121 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Feb 15 22:57:59 2000 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/MEM_IO.h:
+ * ace/MEM_IO.cpp (send): Added a new method that sends a chain of
+ Message_Block. This function aggregates the data in
+ Message_Block and copies them directly into shared memory.
+
Tue Feb 15 21:26:00 2000 David L. Levine <levine@cs.wustl.edu>
* examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp,CPP-unserver.cpp (main),
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 1ee5293f2c5..7c77cc00121 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,10 @@
+Tue Feb 15 22:57:59 2000 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/MEM_IO.h:
+ * ace/MEM_IO.cpp (send): Added a new method that sends a chain of
+ Message_Block. This function aggregates the data in
+ Message_Block and copies them directly into shared memory.
+
Tue Feb 15 21:26:00 2000 David L. Levine <levine@cs.wustl.edu>
* examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp,CPP-unserver.cpp (main),
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 1ee5293f2c5..7c77cc00121 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,10 @@
+Tue Feb 15 22:57:59 2000 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/MEM_IO.h:
+ * ace/MEM_IO.cpp (send): Added a new method that sends a chain of
+ Message_Block. This function aggregates the data in
+ Message_Block and copies them directly into shared memory.
+
Tue Feb 15 21:26:00 2000 David L. Levine <levine@cs.wustl.edu>
* examples/IPC_SAP/SOCK_SAP/FD-unserver.cpp,CPP-unserver.cpp (main),
diff --git a/ace/MEM_IO.cpp b/ace/MEM_IO.cpp
index 3b0b8867043..7d6d5361aa8 100644
--- a/ace/MEM_IO.cpp
+++ b/ace/MEM_IO.cpp
@@ -24,6 +24,49 @@ ACE_MEM_IO::dump (void) const
// socket, allocates a buffer of this size, reads in the data, and
// returns the number of bytes read.
+ssize_t
+ACE_MEM_IO::send (const ACE_Message_Block *message_block,
+ const ACE_Time_Value *timeout)
+{
+ ACE_TRACE ("ACE_MEM_IO::send");
+
+ ssize_t len = message_block->total_length ();
+
+ if (len != 0)
+ {
+ char *buf = ACE_static_cast (char *, this->acquire_buffer (len));
+ ssize_t n = 0;
+ while (message_block != 0)
+ {
+ ACE_OS::memcpy (buf + n,
+ message_block->rd_ptr (),
+ message_block->length ());
+ n += message_block->length ();
+
+ if (message_block->cont ())
+ message_block = message_block->cont ();
+ else
+ message_block = message_block->next ();
+ }
+
+ off_t offset = this->set_buf_len (buf, len);
+ if (ACE::send (this->get_handle (),
+ (const char *) &offset,
+ sizeof (offset),
+ 0,
+ timeout) != sizeof (offset))
+ {
+ // unsucessful send, release the memory in the shared-memory.
+ this->release_buffer (buf);
+
+ return -1;
+ }
+ return len;
+ }
+ return 0;
+}
+
+
#if 0
ssize_t
ACE_MEM_IO::recvv (iovec *io_vec,
diff --git a/ace/MEM_IO.h b/ace/MEM_IO.h
index 9780f2c4701..71d4e39f71a 100644
--- a/ace/MEM_IO.h
+++ b/ace/MEM_IO.h
@@ -20,7 +20,7 @@
#include "ace/SOCK.h"
#include "ace/MEM_SAP.h"
#include "ace/Memory_Pool.h"
-#include "ace/Malloc_T.h"
+#include "ace/Message_Block.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -96,6 +96,12 @@ public:
// out a -1 is returned with <errno == ETIME>. If it succeeds the
// number of bytes received is returned.
+ ssize_t send (const ACE_Message_Block *message_block,
+ const ACE_Time_Value *timeout);
+ // Wait to to <timeout> amount of time to send the <message_block>.
+ // If <send> times out a -1 is returned with <errno == ETIME>. If
+ // it succeeds the number of bytes sent is returned.
+
void dump (void) const;
// Dump the state of an object.