summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-97a40
-rw-r--r--ace/Malloc.h6
-rw-r--r--ace/OS.cpp35
-rw-r--r--ace/OS.h6
-rw-r--r--ace/OS.i5
-rw-r--r--ace/SOCK_Dgram.cpp21
-rw-r--r--examples/Reactor/Misc/test_demuxing.cpp3
7 files changed, 79 insertions, 37 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a
index 2bfadc2cec1..d14fb1020b6 100644
--- a/ChangeLog-97a
+++ b/ChangeLog-97a
@@ -1,3 +1,23 @@
+Mon Mar 24 14:08:48 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu>
+
+ * ace/SOCK_Dgram.cpp (recv): Added a check to make sure that we
+ don't try to copy more into the recv buffer than we've really
+ got. Thanks to Alan_Cabrera@fp.cibc.com for this fix.
+
+ * ace/OS.cpp (readv): Added a check to make sure that we don't try
+ to copy more into the recv buffer than we've really got. Thanks
+ to Alan_Cabrera@fp.cibc.com for this fix.
+
+ * ace/Malloc.h: Modified the alignment strategy to define
+ ACE_MALLOC_ALIGN to a number of bytes. (it gets rounded to a
+ number of long's). This makes it easier to work with more
+ complex buffer alignment strategies (e.g., DMA). Thanks to Fred
+ LaBar <flabar@fallschurch.esys.com> for this.
+
+ * ace/OS.cpp (readv): Added several more changes for the readv()
+ emulation. Thanks to Alan Cabrera <Alan_Cabrera@fp.cibc.com>
+ and Adam Porter <aporter@cs.umd.edu> for these fixes.
+
Mon Mar 24 14:22:17 1997 David L. Levine <levine@cs.wustl.edu>
* ace/OS.cpp (thr_create): For VxWorks, fixed call to ::taskSpawn ().
@@ -5,17 +25,6 @@ Mon Mar 24 14:22:17 1997 David L. Levine <levine@cs.wustl.edu>
Also, set flags to VX_FP_TASK if it's 0, to match behavior
of ::sp ().
-Mon Mar 24 13:21:31 1997 Tim H. Harrison <harrison@lambada.cs.wustl.edu>
-
- * ace/High_Res_Timer.cpp (elapsed_time): Added an
- ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanosecond)
- method that returns the number of elapsed nanoseconds. This is
- accomplished even with the scale factors converting to
- microseconds. It also does not use floating point
- calculations.
-
-Mon Mar 24 08:20:45 1997 David L. Levine <levine@cs.wustl.edu>
-
* netsvcs/lib/TS_Clerk_Handler.cpp (handle_close): added
ACE_UNUSED_ARG (mask). Also, added template specializations.
@@ -26,6 +35,15 @@ Mon Mar 24 08:20:45 1997 David L. Levine <levine@cs.wustl.edu>
client/iostream_client.cpp:
added template specializations.
+Mon Mar 24 13:21:31 1997 Tim H. Harrison <harrison@lambada.cs.wustl.edu>
+
+ * ace/High_Res_Timer.cpp (elapsed_time): Added an
+ ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanosecond)
+ method that returns the number of elapsed nanoseconds. This is
+ accomplished even with the scale factors converting to
+ microseconds. It also does not use floating point
+ calculations.
+
Sun Mar 23 13:25:39 1997 Tim H. Harrison <harrison@lambada.cs.wustl.edu>
* ace/High_Res_Timer.h: Removed <scale_factor> from the
diff --git a/ace/Malloc.h b/ace/Malloc.h
index 791e9ec9650..f4e0c9f14e3 100644
--- a/ace/Malloc.h
+++ b/ace/Malloc.h
@@ -124,7 +124,7 @@ union ACE_Export ACE_Malloc_Header
// Size of this block.
} s_;
- ACE_MALLOC_ALIGN x_;
+ long align_[ACE_MALLOC_ALIGN/sizeof (long)];
// Force alignment.
};
@@ -174,6 +174,10 @@ public:
ACE_Malloc_Stats malloc_stats_;
#endif /* ACE_MALLOC_STATS */
+ long align_[(ACE_MALLOC_ALIGN/sizeof (long)) -
+ ((sizeof (ACE_Name_Node *)
+ + sizeof (ACE_Malloc_Header *) + MAXNAMELEN) / sizeof (long))];
+
ACE_Malloc_Header base_;
// Dummy node used to anchor the freelist.
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 0f207bdb41c..21baad49171 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -1127,7 +1127,15 @@ ACE_TSS_Cleanup::exit (void *status)
CWinThread *pThread = ::AfxGetThread ();
if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ())
#endif /* ACE_HAS_MFC */
- ::_endthreadex ((DWORD) status);
+ {
+#if 0
+ ACE_hthread_t thr;
+ ACE_OS::thr_self (thr);
+ if (thr)
+ ACE_OS::close (thr);
+#endif
+ ::_endthreadex ((DWORD) status);
+ }
#if 0
::ExitThread ((DWORD) status);
#endif
@@ -2008,9 +2016,9 @@ writev (ACE_HANDLE handle, ACE_WRITEV_TYPE iov[], int n)
char *buf;
#if defined (ACE_HAS_ALLOCA)
- buf = alloca (length);
+ buf = (char *) alloca (length);
#else
- ACE_NEW_RETURN (buf, length, -1);
+ ACE_NEW_RETURN (buf, char[length], -1);
#endif /* !defined (ACE_HAS_ALLOCA) */
char *ptr = buf;
@@ -2021,7 +2029,7 @@ writev (ACE_HANDLE handle, ACE_WRITEV_TYPE iov[], int n)
ptr += iov[i].iov_len;
}
- ssize_t result = ACE_SOCK_Dgram::send_n (handle, buf, length);
+ ssize_t result = ACE::send_n (handle, buf, length);
#if !defined (ACE_HAS_ALLOCA)
delete [] buf;
#endif /* !defined (ACE_HAS_ALLOCA) */
@@ -2034,7 +2042,7 @@ writev (ACE_HANDLE handle, ACE_WRITEV_TYPE iov[], int n)
// "Fake" readv for sites without it. Note that this is thread-safe.
extern "C" int
-readv (ACE_HANDLE handle, struct iovec *vp, int vpcount)
+readv (ACE_HANDLE handle, struct iovec *iov, int n)
{
// ACE_TRACE ("::readv");
@@ -2049,21 +2057,26 @@ readv (ACE_HANDLE handle, struct iovec *vp, int vpcount)
char *buf;
#if defined (ACE_HAS_ALLOCA)
- buf = alloca (length);
+ buf = (char *) alloca (length);
#else
- ACE_NEW_RETURN (buf, length, -1);
+ ACE_NEW_RETURN (buf, char[length], -1);
#endif /* !defined (ACE_HAS_ALLOCA) */
- length = ACE_SOCK_Dgram::recv_n (buf, length);
+ length = ACE::recv_n (handle, buf, length);
if (length != -1)
{
char *ptr = buf;
-
- for (i = 0; i < n; i++)
+ int copyn = length;
+
+ for (i = 0;
+ i < n && copyn > 0;
+ i++)
{
- ACE_OS::memcpy (iov[i].iov_base, ptr, iov[i].iov_len);
+ ACE_OS::memcpy (iov[i].iov_base, ptr,
+ copyn > iov[i].iov_len ? iov[i].iov_len : copyn);
ptr += iov[i].iov_len;
+ copyn -= iov[i].iov_len;
}
}
diff --git a/ace/OS.h b/ace/OS.h
index 48483d9e686..ee627316be4 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1098,7 +1098,7 @@ typedef SEM_ID ACE_mutex_t;
typedef ACE_mutex_t ACE_thread_mutex_t;
#if !defined (ACE_HAS_POSIX_SEM)
// although ACE_HAS_POSIX_SEM is assumed for VxWorks
-typedef semaphore * ACE_sema_t;
+typedef semaphore *ACE_sema_t;
#endif /* !ACE_HAS_POSIX_SEM */
typedef char * ACE_thread_t;
typedef int ACE_hthread_t;
@@ -1159,8 +1159,8 @@ private:
#if defined (VXWORKS)
ACE_sema_t waiters_done_;
- // A semaphore used by the broadcast/signal thread to wait
- // for the waiting thread(s) to wake up and get a chance at the
+ // A semaphore used by the broadcast/signal thread to wait for all
+ // the waiting thread(s) to wake up and be released from the
// semaphore.
#elif defined (ACE_WIN32)
HANDLE waiters_done_;
diff --git a/ace/OS.i b/ace/OS.i
index b38db5407a5..facf7ccba95 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1437,6 +1437,8 @@ ACE_OS::cond_wait (ACE_cond_t *cv,
if (result != -1)
{
+ // If we're the last waiter thread during this particular
+ // broadcast then let all the other threads proceed.
if (cv->was_broadcast_ && cv->waiters_ == 0)
#if defined (VXWORKS)
ACE_OS::sema_post (&cv->waiters_done_);
@@ -3203,7 +3205,6 @@ ACE_OS::sema_post (ACE_sema_t *s)
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::sema_post (s), ace_result_), int, -1);
#elif defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS)
int result = -1;
- int count_was_zero;
if (ACE_OS::mutex_lock (&s->lock_) == 0)
{
@@ -3323,7 +3324,7 @@ ACE_OS::sema_wait (ACE_sema_t *s)
break;
}
- s->waiters_--;
+ --s->waiters_;
}
if (result == 0)
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index df84064e61d..74bd75a20d9 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -1,7 +1,6 @@
// SOCK_Dgram.cpp
// $Id$
-
#define ACE_BUILD_DLL
#include "ace/SOCK_Dgram.h"
#include "ace/Synch.h"
@@ -47,10 +46,10 @@ ACE_SOCK_Dgram::recv (iovec *io_vec, ACE_Addr &addr, int flags) const
else
return 0;
#else
- flags = flags;
- addr = addr;
- io_vec = io_vec;
- ACE_NOTSUP_RETURN (-1);
+ ACE_UNUSED_ARG (flags);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (io_vec);
+ ACE_NOTSUP_RETURN (-1);
#endif /* FIONREAD */
}
@@ -90,6 +89,7 @@ ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
: ACE_SOCK (SOCK_DGRAM, protocol_family, protocol, reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram");
+
if (this->shared_open (local, protocol_family) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_SOCK_Dgram"));
}
@@ -244,11 +244,16 @@ ACE_SOCK_Dgram::recv (iovec iov[],
if (length != -1)
{
char *ptr = buf;
-
- for (i = 0; i < n; i++)
+ int copyn = length;
+
+ for (i = 0;
+ i < n && copyn > 0;
+ i++)
{
- ACE_OS::memcpy (iov[i].iov_base, ptr, iov[i].iov_len);
+ ACE_OS::memcpy (iov[i].iov_base, ptr,
+ copyn > iov[i].iov_len ? iov[i].iov_len : copyn);
ptr += iov[i].iov_len;
+ copyn -= iov[i].iov_len;
}
}
diff --git a/examples/Reactor/Misc/test_demuxing.cpp b/examples/Reactor/Misc/test_demuxing.cpp
index 5b2527cf5b2..235d8fbd1df 100644
--- a/examples/Reactor/Misc/test_demuxing.cpp
+++ b/examples/Reactor/Misc/test_demuxing.cpp
@@ -118,7 +118,8 @@ Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *)
case SIGINT:
// Tell the ACE_Reactor to enable the ready bit for
// this->handle_. The ACE_Reactor will subsequently call the
- // Sig_Handler::handle_input method from within its event loop.
+ // <Sig_Handler::handle_input> method from within its event
+ // loop.
return ACE_Service_Config::reactor ()->ready_ops
(this->handle_, ACE_Event_Handler::READ_MASK, ACE_Reactor::ADD_MASK);
case SIGQUIT: