summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2006-04-19 12:01:10 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2006-04-19 12:01:10 +0000
commit1bc1800251214eca8b33411762c3238eed63ebe7 (patch)
tree5853da7ff14b0710770979f17c320ac7e4e02bcf
parente6a70f64431bab9ca9dbebdaaac2d226f43a5671 (diff)
downloadATCD-1bc1800251214eca8b33411762c3238eed63ebe7.tar.gz
ChangeLogTag: Wed Apr 19 11:39:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--ChangeLog48
-rw-r--r--TAO/performance-tests/Throughput/Receiver.cpp2
-rw-r--r--TAO/performance-tests/Throughput/Receiver_Factory.cpp2
-rw-r--r--TAO/performance-tests/Throughput/Throughput.mpc4
-rwxr-xr-xTAO/performance-tests/Throughput/run_test.pl7
-rwxr-xr-xTAO/tests/Big_Oneways/run_test.pl6
-rwxr-xr-xTAO/tests/Hello/run_test.pl7
-rw-r--r--ace/Activation_Queue.cpp6
-rw-r--r--ace/Caching_Utility_T.cpp9
-rw-r--r--ace/Cleanup.cpp4
-rw-r--r--ace/Hash_Map_Manager_T.h4
-rw-r--r--ace/IO_Cntl_Msg.cpp2
-rw-r--r--ace/Local_Name_Space_T.cpp2
-rw-r--r--ace/MMAP_Memory_Pool.cpp12
-rw-r--r--ace/MMAP_Memory_Pool.h14
-rw-r--r--ace/MMAP_Memory_Pool.inl21
-rw-r--r--ace/Malloc.cpp6
-rw-r--r--ace/Malloc_Base.h14
-rw-r--r--ace/Malloc_T.cpp18
-rw-r--r--ace/Malloc_T.inl2
-rw-r--r--ace/Map_Manager.h4
-rw-r--r--ace/Mem_Map.cpp8
-rw-r--r--ace/Message_Block.cpp9
-rw-r--r--ace/Message_Block_T.cpp2
-rw-r--r--ace/Message_Queue.cpp12
-rw-r--r--ace/Message_Queue_T.cpp44
-rw-r--r--ace/Metrics_Cache_T.cpp15
-rw-r--r--ace/Msg_WFMO_Reactor.cpp2
-rw-r--r--ace/Multihomed_INET_Addr.cpp14
-rw-r--r--ace/OS_NS_sys_sendfile.cpp37
-rw-r--r--ace/OS_NS_sys_sendfile.h64
-rw-r--r--ace/OS_NS_sys_sendfile.inl20
-rw-r--r--ace/PI_Malloc.h5
-rw-r--r--ace/SSL/SSL_Asynch_BIO.cpp16
-rw-r--r--ace/SSL/SSL_Context.cpp13
-rw-r--r--ace/TLI_Stream.h4
-rw-r--r--ace/TLI_Stream.inl2
-rw-r--r--ace/Thread_Manager.cpp24
-rw-r--r--ace/Timeprobe_T.cpp10
-rw-r--r--ace/Timer_Hash_T.cpp10
-rw-r--r--ace/Timer_Queue_T.cpp2
-rw-r--r--ace/Token.cpp8
-rw-r--r--ace/WFMO_Reactor.cpp2
-rw-r--r--ace/WFMO_Reactor.inl8
-rw-r--r--ace/WIN32_Asynch_IO.cpp8
-rw-r--r--ace/XTI_ATM_Mcast.cpp3
-rw-r--r--ace/XtReactor.cpp10
-rw-r--r--ace/ace.mpc1
-rw-r--r--ace/config-linux-common.h3
-rw-r--r--ace/config-sunos5.8.h2
50 files changed, 376 insertions, 176 deletions
diff --git a/ChangeLog b/ChangeLog
index b1d6786345c..26c8a9a738a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,53 @@
+Wed Apr 19 11:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ Merged ACE changes from sendfile branch. Also made a lot of const
+ improvements throughout ACE.
+
+ Tue Apr 4 10:20:36 2006 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * ace/Mem_Map.cpp (open):
+
+ Only copy the filename to the ACE_Mem_Map::filename_ member
+ if the call to open() succeeds.
+
+ * ace/PI_Malloc.h (ACE_Malloc_Header):
+
+ Added missing private and undefined copy constructor. The
+ corresponding assignment operator was already there.
+
+ Wed Mar 29 14:51:12 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-sunos5.8.h:
+ Solaris 8 and newer also support sendfile. It seems HPUX also
+ supports it but with a different signature and semantics, so just
+ don't try it there yet.
+
+ Wed Mar 29 13:06:12 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/MMAP_Memory_Pool.{h,cpp,inl}:
+ Added new .inl file to implement the new mmap accessors, include
+ this new file in the header and implementation file
+
+ Wed Mar 29 08:00:12 2006 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * ace/OS_NS_sys_sendfile.cpp
+ * ace/OS_NS_sys_sendfile.h
+ * ace/OS_NS_sys_sendfile.inl
+ New sendfile wrapper
+
+ * ace/MMAP_Memory_Pool.h:
+ Added accessors for mmap
+
+ * ace/ace.mpc
+ Added OS_NS_sys_sendfile
+
+ * ace/config-linux-common.h
+ Added ACE_HAS_SENDFILE
+
Wed Apr 19 07:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+ Merged ACE changes from sequpdate3 branch
+
* ace/config-osf1-3.2.h:
Removed, very old
diff --git a/TAO/performance-tests/Throughput/Receiver.cpp b/TAO/performance-tests/Throughput/Receiver.cpp
index 79ac824f5d4..f4a90012325 100644
--- a/TAO/performance-tests/Throughput/Receiver.cpp
+++ b/TAO/performance-tests/Throughput/Receiver.cpp
@@ -39,7 +39,7 @@ Receiver::receive_data (const Test::Message &the_message
}
this->last_message_id_ = the_message.message_id;
}
- this->message_count_++;
+ ++this->message_count_;
this->byte_count_ += the_message.the_payload.length ();
this->last_message_time_ = now;
}
diff --git a/TAO/performance-tests/Throughput/Receiver_Factory.cpp b/TAO/performance-tests/Throughput/Receiver_Factory.cpp
index c804588b9b6..c101aeee34e 100644
--- a/TAO/performance-tests/Throughput/Receiver_Factory.cpp
+++ b/TAO/performance-tests/Throughput/Receiver_Factory.cpp
@@ -15,7 +15,7 @@ Test::Receiver_ptr
Receiver_Factory::create_receiver (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- Receiver *receiver_impl;
+ Receiver *receiver_impl = 0;
ACE_NEW_THROW_EX (receiver_impl,
Receiver,
CORBA::NO_MEMORY ());
diff --git a/TAO/performance-tests/Throughput/Throughput.mpc b/TAO/performance-tests/Throughput/Throughput.mpc
index fbf91754ef9..ca5e5b74cac 100644
--- a/TAO/performance-tests/Throughput/Throughput.mpc
+++ b/TAO/performance-tests/Throughput/Throughput.mpc
@@ -8,7 +8,7 @@ project(*idl): taoidldefaults {
custom_only = 1
}
-project(*server): taoexe, portableserver, strategies {
+project(*server): taoserver, strategies {
after += *idl
Source_Files {
Receiver_Factory.cpp
@@ -21,7 +21,7 @@ project(*server): taoexe, portableserver, strategies {
}
}
-project(*client):taoexe, strategies {
+project(*client): taoclient, strategies {
after += *idl
Source_Files {
TestC.cpp
diff --git a/TAO/performance-tests/Throughput/run_test.pl b/TAO/performance-tests/Throughput/run_test.pl
index 216081e452d..38adfa5b275 100755
--- a/TAO/performance-tests/Throughput/run_test.pl
+++ b/TAO/performance-tests/Throughput/run_test.pl
@@ -23,7 +23,12 @@ $CL = new PerlACE::Process ("client",
" -ORBSvcConf $svc_conf -ORBNoDelay 1"
. " -x");
-$SV->Spawn ();
+$server = $SV->Spawn ();
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ exit 1;
+}
if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
print STDERR "ERROR: cannot find file <$iorfile>\n";
diff --git a/TAO/tests/Big_Oneways/run_test.pl b/TAO/tests/Big_Oneways/run_test.pl
index bfafef483b6..45175d43e98 100755
--- a/TAO/tests/Big_Oneways/run_test.pl
+++ b/TAO/tests/Big_Oneways/run_test.pl
@@ -38,8 +38,12 @@ $CL1 = new PerlACE::Process ("client", " -k file://$iorfile");
$CL2 = new PerlACE::Process ("client", " -k file://$iorfile");
$CL3 = new PerlACE::Process ("client", " -k file://$iorfile");
+$server = $SV->Spawn ();
-$SV->Spawn ();
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ exit 1;
+}
if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
print STDERR "ERROR: cannot find file <$iorfile>\n";
diff --git a/TAO/tests/Hello/run_test.pl b/TAO/tests/Hello/run_test.pl
index 5d02e3606f1..cb77b93fe3e 100755
--- a/TAO/tests/Hello/run_test.pl
+++ b/TAO/tests/Hello/run_test.pl
@@ -21,7 +21,12 @@ else {
}
$CL = new PerlACE::Process ("client", " -k file://$iorfile");
-$SV->Spawn ();
+$server = $SV->Spawn ();
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ exit 1;
+}
if (PerlACE::waitforfile_timed ($iorfile,
$PerlACE::wait_interval_for_process_creation) == -1) {
diff --git a/ace/Activation_Queue.cpp b/ace/Activation_Queue.cpp
index 20a1c48df47..28b91b82bd9 100644
--- a/ace/Activation_Queue.cpp
+++ b/ace/Activation_Queue.cpp
@@ -61,7 +61,7 @@ ACE_Activation_Queue::~ACE_Activation_Queue (void)
ACE_Method_Request *
ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
{
- ACE_Message_Block *mb;
+ ACE_Message_Block *mb = 0;
// Dequeue the message.
if (this->queue_->dequeue_head (mb, tv) != -1)
@@ -81,7 +81,7 @@ int
ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
ACE_Time_Value *tv)
{
- ACE_Message_Block *mb;
+ ACE_Message_Block *mb = 0;
// We pass sizeof (*mr) here so that flow control will work
// correctly. Since we also pass <mr> note that no unnecessary
@@ -102,7 +102,7 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
-1);
// Enqueue in priority order.
- int result = this->queue_->enqueue_prio (mb, tv);
+ int const result = this->queue_->enqueue_prio (mb, tv);
// Free ACE_Message_Block if enqueue_prio failed.
if (result == -1)
diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp
index c1b5e52993a..e7f81882af9 100644
--- a/ace/Caching_Utility_T.cpp
+++ b/ace/Caching_Utility_T.cpp
@@ -56,7 +56,7 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cac
// Calculate the no of entries to remove from the cache depending
// upon the <purge_percent>.
- size_t entries_to_remove
+ size_t const entries_to_remove
= ACE_MAX (static_cast<size_t> (1),
static_cast<size_t> (static_cast<double> (purge_percent)
/ 100 * current_map_size));
@@ -156,7 +156,7 @@ ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUT
// Calculate the no of entries to remove from the cache depending
// upon the <purge_percent>.
- size_t entries_to_remove
+ size_t const entries_to_remove
= ACE_MAX (static_cast<size_t> (1),
static_cast<size_t> (static_cast<double> (purge_percent)
/ 100 * current_map_size));
@@ -266,7 +266,8 @@ ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATO
return 0;
// Get the number of entries in the container which can be considered for purging.
- size_t available_entries = container.current_size () - this->marked_as_closed_entries_;
+ size_t const available_entries =
+ container.current_size () - this->marked_as_closed_entries_;
// Also whether the number of entries in the cache zero.
// Oops! then there is no way out but exiting.
@@ -275,7 +276,7 @@ ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATO
// Calculate the no of entries to remove from the cache depending
// upon the <purge_percent>.
- size_t entries_to_remove
+ size_t const entries_to_remove
= ACE_MAX (static_cast<size_t> (1),
static_cast<size_t> (static_cast<double> (purge_percent)
/ 100 * available_entries));
diff --git a/ace/Cleanup.cpp b/ace/Cleanup.cpp
index 7bc3c29e523..a2b67825e72 100644
--- a/ace/Cleanup.cpp
+++ b/ace/Cleanup.cpp
@@ -101,7 +101,7 @@ ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void)
ACE_Cleanup_Info_Node *
ACE_Cleanup_Info_Node::insert (const ACE_Cleanup_Info &new_info)
{
- ACE_Cleanup_Info_Node *new_node;
+ ACE_Cleanup_Info_Node *new_node = 0;
ACE_NEW_RETURN (new_node,
ACE_Cleanup_Info_Node (new_info, this),
@@ -136,7 +136,7 @@ ACE_OS_Exit_Info::at_exit_i (void *object,
// Return -1 and sets errno if unable to allocate storage. Enqueue
// at the head and dequeue from the head to get LIFO ordering.
- ACE_Cleanup_Info_Node *new_node;
+ ACE_Cleanup_Info_Node *new_node = 0;
if ((new_node = registered_objects_->insert (new_info)) == 0)
return -1;
diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h
index 34533e1d311..903284099d6 100644
--- a/ace/Hash_Map_Manager_T.h
+++ b/ace/Hash_Map_Manager_T.h
@@ -103,9 +103,9 @@ class ACE_Allocator;
* This implementation of a map uses a hash table. Key hashing
* is achieved through the HASH_KEY object and key comparison is
* achieved through the COMPARE_KEYS object.
- * This class uses an <ACE_Allocator> to allocate memory. The
+ * This class uses an ACE_Allocator to allocate memory. The
* user can make this a persistent class by providing an
- * <ACE_Allocator> with a persistable memory pool.
+ * ACE_Allocator with a persistable memory pool.
*/
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Manager_Ex
diff --git a/ace/IO_Cntl_Msg.cpp b/ace/IO_Cntl_Msg.cpp
index aab5bd3c124..9d64f05dd66 100644
--- a/ace/IO_Cntl_Msg.cpp
+++ b/ace/IO_Cntl_Msg.cpp
@@ -36,7 +36,7 @@ public:
ACE_Module *lower (void) { return this->mod_lower_; }
void lower (ACE_Module *l) { this->mod_lower_ = l; }
- int count (void) { return this->count_; }
+ int count (void) const { return this->count_; }
void count (int c) { this->count_ = c; }
private:
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp
index 1523370d947..b626f990dbb 100644
--- a/ace/Local_Name_Space_T.cpp
+++ b/ace/Local_Name_Space_T.cpp
@@ -330,7 +330,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (
size_t len = ACE_OS::strlen (ns_internal.type ());
// Makes a copy here. Caller needs to call delete to free up
// memory.
- char *new_type;
+ char *new_type = 0;
ACE_NEW_RETURN (new_type,
char [len + 1],
-1);
diff --git a/ace/MMAP_Memory_Pool.cpp b/ace/MMAP_Memory_Pool.cpp
index 6ddec5d7621..4cce9fff7d3 100644
--- a/ace/MMAP_Memory_Pool.cpp
+++ b/ace/MMAP_Memory_Pool.cpp
@@ -13,7 +13,13 @@
#include "ace/Based_Pointer_Repository.h"
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
-ACE_RCSID(ace, MMAP_Memory_Pool, "$Id$")
+#if !defined (__ACE_INLINE__)
+#include "ace/MMAP_Memory_Pool.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(ace,
+ MMAP_Memory_Pool,
+ "$Id$")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -222,7 +228,7 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
#endif
// Increment by one to put us at the beginning of the next chunk...
- map_size++;
+ ++map_size;
#endif /* CHORUS */
return 0;
}
@@ -473,7 +479,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
if (guess_on_fault_)
{
// Check if the current mapping is up to date.
- off_t current_map_size = ACE_OS::filesize (this->mmap_.handle ());
+ off_t const current_map_size = ACE_OS::filesize (this->mmap_.handle ());
if (static_cast<size_t> (current_map_size) == this->mmap_.size ())
{
diff --git a/ace/MMAP_Memory_Pool.h b/ace/MMAP_Memory_Pool.h
index 0b81e015896..91162b5863c 100644
--- a/ace/MMAP_Memory_Pool.h
+++ b/ace/MMAP_Memory_Pool.h
@@ -201,6 +201,12 @@ public:
/// Dump the state of an object.
virtual void dump (void) const;
+ /// Get reference to underlying ACE_Mem_Map object.
+ ACE_Mem_Map const & mmap (void) const;
+
+ /// Get reference to underlying ACE_Mem_Map object.
+ ACE_Mem_Map & mmap (void);
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
@@ -267,10 +273,10 @@ protected:
/**
* @class ACE_Lite_MMAP_Memory_Pool
*
- * @brief Make a ``lighter-weight'' memory pool based <ACE_Mem_Map>.
+ * @brief Make a ``lighter-weight'' memory pool based ACE_Mem_Map.
*
* This implementation allows memory to be shared between
- * processes. However, unlike the <ACE_MMAP_Memory_Pool>
+ * processes. However, unlike the ACE_MMAP_Memory_Pool
* the <sync> methods are no-ops, which means that we don't pay
* for the price of flushing the memory to the backing store on
* every update. Naturally, this trades off increased
@@ -295,5 +301,9 @@ public:
ACE_END_VERSIONED_NAMESPACE_DECL
+#if defined (__ACE_INLINE__)
+#include "ace/MMAP_Memory_Pool.inl"
+#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_MMAP_MEMORY_POOL_H */
diff --git a/ace/MMAP_Memory_Pool.inl b/ace/MMAP_Memory_Pool.inl
new file mode 100644
index 00000000000..db3f5a7ba0f
--- /dev/null
+++ b/ace/MMAP_Memory_Pool.inl
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+//
+// $Id$
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+ACE_Mem_Map const &
+ACE_MMAP_Memory_Pool::mmap (void) const
+{
+ return mmap_;
+}
+
+ACE_INLINE
+ACE_Mem_Map &
+ACE_MMAP_Memory_Pool::mmap (void)
+{
+ return mmap_;
+}
+
+ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp
index 644f8543a4c..acee3942367 100644
--- a/ace/Malloc.cpp
+++ b/ace/Malloc.cpp
@@ -171,9 +171,9 @@ ACE_Malloc_Stats::dump (void) const
ACE_TRACE ("ACE_Malloc_Stats::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- int nblocks = this->nblocks_.value ();
- int ninuse = this->ninuse_.value ();
- int nchunks = this->nchunks_.value ();
+ int const nblocks = this->nblocks_.value ();
+ int const ninuse = this->ninuse_.value ();
+ int const nchunks = this->nchunks_.value ();
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("nblocks = %d"), nblocks));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("\nninuse = %d"), ninuse));
diff --git a/ace/Malloc_Base.h b/ace/Malloc_Base.h
index 491e832d59a..048123ad13f 100644
--- a/ace/Malloc_Base.h
+++ b/ace/Malloc_Base.h
@@ -41,10 +41,10 @@ class ACE_Export ACE_Allocator
public:
// = Memory Management
- /// Get pointer to a default <ACE_Allocator>.
+ /// Get pointer to a default ACE_Allocator.
static ACE_Allocator *instance (void);
- /// Set pointer to a process-wide <ACE_Allocator> and return existing
+ /// Set pointer to a process-wide ACE_Allocator and return existing
/// pointer.
static ACE_Allocator *instance (ACE_Allocator *);
@@ -119,14 +119,14 @@ public:
// backing store).
/**
- * Sync <len> bytes of the memory region to the backing store
- * starting at <this->base_addr_>. If <len> == -1 then sync the
+ * Sync @a len bytes of the memory region to the backing store
+ * starting at @c this->base_addr_. If @a len == -1 then sync the
* whole region.
*/
virtual int sync (ssize_t len = -1, int flags = MS_SYNC) = 0;
- /// Sync <len> bytes of the memory region to the backing store
- /// starting at <addr_>.
+ /// Sync @a len bytes of the memory region to the backing store
+ /// starting at @a addr.
virtual int sync (void *addr, size_t len, int flags = MS_SYNC) = 0;
/**
@@ -151,7 +151,7 @@ private:
// DO NOT ADD ANY STATE (DATA MEMBERS) TO THIS CLASS!!!! See the
// <ACE_Allocator::instance> implementation for explanation.
- /// Pointer to a process-wide <ACE_Allocator> instance.
+ /// Pointer to a process-wide ACE_Allocator instance.
static ACE_Allocator *allocator_;
/// Must delete the <allocator_> if non-0.
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index 63e33324201..d59436ac2b6 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -474,7 +474,8 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open (void)
template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name)
- : memory_pool_ (pool_name),
+ : cb_ptr_ (0),
+ memory_pool_ (pool_name),
bad_flag_ (0)
{
ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
@@ -496,7 +497,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name,
const ACE_TCHAR *lock_name,
const ACE_MEM_POOL_OPTIONS *options)
- : memory_pool_ (pool_name, options),
+ : cb_ptr_ (0),
+ memory_pool_ (pool_name, options),
bad_flag_ (0)
{
ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T");
@@ -520,7 +522,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name,
const ACE_MEM_POOL_OPTIONS *options,
ACE_LOCK *lock)
- : memory_pool_ (pool_name, options),
+ : cb_ptr_ (0),
+ memory_pool_ (pool_name, options),
lock_ (lock),
delete_lock_ (0),
bad_flag_ (0)
@@ -546,7 +549,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name,
const ACE_TCHAR *lock_name,
const void *options)
- : memory_pool_ (pool_name,
+ : cb_ptr_ (0),
+ memory_pool_ (pool_name,
(const ACE_MEM_POOL_OPTIONS *) options),
bad_flag_ (0)
{
@@ -584,7 +588,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void)
{
ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove");
// ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P|%t) destroying ACE_Malloc_T\n")));
- int result = 0;
#if defined (ACE_HAS_MALLOC_STATS)
this->print_stats ();
@@ -595,7 +598,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void)
this->lock_->remove ();
// Give the memory pool a chance to release its resources.
- result = this->memory_pool_.release ();
+ int const result = this->memory_pool_.release ();
// Reset this->cb_ptr_ as it is no longer valid.
// There's also no need to keep the reference counter as the
@@ -621,7 +624,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc (size_t nbytes)
return 0;
// Round up request to a multiple of the MALLOC_HEADER size.
- size_t nunits =
+ size_t const nunits =
(nbytes + sizeof (MALLOC_HEADER) - 1) / sizeof (MALLOC_HEADER)
+ 1; // Add one for the <MALLOC_HEADER> itself.
@@ -778,7 +781,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free (void *ap)
if (ap == 0 || this->cb_ptr_ == 0)
return;
-
// Adjust AP to point to the block MALLOC_HEADER
MALLOC_HEADER *blockp = ((MALLOC_HEADER *) ap) - 1;
MALLOC_HEADER *currp = this->cb_ptr_->freep_;
diff --git a/ace/Malloc_T.inl b/ace/Malloc_T.inl
index 2de748456af..dee20160cb2 100644
--- a/ace/Malloc_T.inl
+++ b/ace/Malloc_T.inl
@@ -61,7 +61,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::release (int close)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
if (this->cb_ptr_ != 0)
{
- int retv = --this->cb_ptr_->ref_counter_;
+ int const retv = --this->cb_ptr_->ref_counter_;
#if 0
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P) ACE_Malloc_T::release ->%d\n"),
diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h
index e4f52edc099..847c7167e2c 100644
--- a/ace/Map_Manager.h
+++ b/ace/Map_Manager.h
@@ -116,9 +116,9 @@ class ACE_Map_Reverse_Iterator;
* The <EXT_ID> must support <operator==>. This constraint can
* be alleviated via template specialization, as shown in the
* $ACE_ROOT/tests/Conn_Test.cpp test.
- * This class uses an <ACE_Allocator> to allocate memory. The
+ * This class uses an ACE_Allocator to allocate memory. The
* user can make this a persistant class by providing an
- * <ACE_Allocator> with a persistable memory pool.
+ * ACE_Allocator with a persistable memory pool.
* This implementation of a map uses an array, which is searched
* linearly. For more efficient searching you should use the
* <ACE_Hash_Map_Manager>.
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp
index 3202d04bc06..32fd2161d60 100644
--- a/ace/Mem_Map.cpp
+++ b/ace/Mem_Map.cpp
@@ -248,10 +248,6 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
{
ACE_TRACE ("ACE_Mem_Map::open");
- ACE_OS::strsncpy (this->filename_,
- file_name,
- MAXPATHLEN);
-
#if defined (CHORUS) || defined(INTEGRITY) || defined (__QNXNTO__)
this->handle_ = ACE_OS::shm_open (file_name, flags, mode, sa);
#elif defined (ACE_OPENVMS)
@@ -264,6 +260,10 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name,
return -1;
else
{
+ ACE_OS::strsncpy (this->filename_,
+ file_name,
+ MAXPATHLEN);
+
this->close_handle_ = 1;
return 0;
}
diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp
index dc1bfd8f6c7..6e73653de2a 100644
--- a/ace/Message_Block.cpp
+++ b/ace/Message_Block.cpp
@@ -637,7 +637,7 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
// Actual offset for the incoming message block assuming that it
// is also aligned to the same "align" byte
- size_t wr_offset = mb.wr_ptr_ - (start - mb.base ());
+ size_t const wr_offset = mb.wr_ptr_ - (start - mb.base ());
// Copy wr_offset amount of data in to <this->data_block>
(void) ACE_OS::memcpy (this->wr_ptr (),
@@ -753,7 +753,7 @@ ACE_Data_Block::release_i (void)
ACE_Data_Block *result = 0;
// decrement reference count
- this->reference_count_--;
+ --this->reference_count_;
if (this->reference_count_ == 0)
// this will cause deletion of this
@@ -965,10 +965,10 @@ ACE_Data_Block::duplicate (void)
{
// We need to acquire the lock before incrementing the count.
ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->locking_strategy_, 0);
- this->reference_count_++;
+ ++this->reference_count_;
}
else
- this->reference_count_++;
+ ++this->reference_count_;
return this;
}
@@ -1220,6 +1220,7 @@ ACE_Data_Block::base (char *msg_data,
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
this->allocator_strategy_->free (this->base_);
+
this->max_size_ = msg_length;
this->cur_size_ = msg_length;
this->base_ = msg_data;
diff --git a/ace/Message_Block_T.cpp b/ace/Message_Block_T.cpp
index 4c20ed48a6b..d2cf9464ab0 100644
--- a/ace/Message_Block_T.cpp
+++ b/ace/Message_Block_T.cpp
@@ -28,7 +28,7 @@ ACE_Locked_Data_Block<ACE_LOCK>::clone_nocopy (ACE_Message_Block::Message_Flags
const ACE_Message_Block::Message_Flags always_clear =
ACE_Message_Block::DONT_DELETE;
- ACE_Locked_Data_Block<ACE_LOCK> *nb;
+ ACE_Locked_Data_Block<ACE_LOCK> *nb = 0;
ACE_NEW_MALLOC_RETURN (nb,
static_cast<ACE_Locked_Data_Block<ACE_LOCK>*> (
diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp
index fcdee0e14d2..599f5e6b05e 100644
--- a/ace/Message_Queue.cpp
+++ b/ace/Message_Queue.cpp
@@ -253,7 +253,7 @@ ACE_Message_Queue_Vx::enqueue_tail_i (ACE_Message_Block *new_item)
// Don't try to send a composite message!!!! Only the first
// block will be sent.
- this->cur_count_++;
+ ++this->cur_count_;
// Always use this method to actually send a message on the queue.
if (::msgQSend (msgq (),
@@ -428,8 +428,8 @@ ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item,
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
if (this->state_ != ACE_Message_Queue_Base::DEACTIVATED)
{
- size_t msize = new_item->total_size ();
- size_t mlength = new_item->total_length ();
+ size_t const msize = new_item->total_size ();
+ size_t const mlength = new_item->total_length ();
// Note - we send ACTIVATED in the 3rd arg to tell the completion
// routine it's _NOT_ being woken up because of deactivate().
ULONG_PTR state_to_post;
@@ -504,7 +504,7 @@ ACE_Message_Queue_NT::deactivate (void)
ACE_TRACE ("ACE_Message_Queue_NT::deactivate");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
- int previous_state = this->state_;
+ int const previous_state = this->state_;
if (previous_state != ACE_Message_Queue_Base::DEACTIVATED)
{
this->state_ = ACE_Message_Queue_Base::DEACTIVATED;
@@ -527,7 +527,7 @@ ACE_Message_Queue_NT::activate (void)
{
ACE_TRACE ("ACE_Message_Queue_NT::activate");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
- int previous_status = this->state_;
+ int const previous_status = this->state_;
this->state_ = ACE_Message_Queue_Base::ACTIVATED;
return previous_status;
}
@@ -538,7 +538,7 @@ ACE_Message_Queue_NT::pulse (void)
ACE_TRACE ("ACE_Message_Queue_NT::pulse");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
- int previous_state = this->state_;
+ int const previous_state = this->state_;
if (previous_state != ACE_Message_Queue_Base::DEACTIVATED)
{
this->state_ = ACE_Message_Queue_Base::PULSED;
diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp
index 9bfcd5cc5f2..859e8b64e68 100644
--- a/ace/Message_Queue_T.cpp
+++ b/ace/Message_Queue_T.cpp
@@ -112,7 +112,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::peek_dequeue_head (ACE_ME
ACE_Message_Block *mb = 0;
- int cur_count = this->queue_.peek_dequeue_head (mb, timeout);
+ int const cur_count = this->queue_.peek_dequeue_head (mb, timeout);
if (cur_count != -1)
first_item = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ());
@@ -134,7 +134,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head (ACE_MESSAGE
ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY),
-1);
- int result = this->queue_.enqueue_head (mb, timeout);
+ int const result = this->queue_.enqueue_head (mb, timeout);
if (result == -1)
// Zap the message.
mb->release ();
@@ -168,7 +168,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_prio (ACE_MESSAGE
ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY),
-1);
- int result = this->queue_.enqueue_prio (mb, timeout);
+ int const result = this->queue_.enqueue_prio (mb, timeout);
if (result == -1)
// Zap the message.
mb->release ();
@@ -190,7 +190,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_deadline (ACE_MES
ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY ),
-1);
- int result = this->queue_.enqueue_deadline (mb, timeout);
+ int const result = this->queue_.enqueue_deadline (mb, timeout);
if (result == -1)
// Zap the message.
mb->release ();
@@ -215,7 +215,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail (ACE_MESSAGE
ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY),
-1);
- int result = this->queue_.enqueue_tail (mb, timeout);
+ int const result = this->queue_.enqueue_tail (mb, timeout);
if (result == -1)
// Zap the message.
mb->release ();
@@ -234,7 +234,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE
ACE_Message_Block *mb = 0;
- int cur_count = this->queue_.dequeue_head (mb, timeout);
+ int const cur_count = this->queue_.dequeue_head (mb, timeout);
// Dequeue the message.
if (cur_count != -1)
@@ -242,10 +242,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE
first_item = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ());
// Delete the message block.
mb->release ();
- return cur_count;
}
- else
- return -1;
+
+ return cur_count;
}
// Remove the item with the lowest priority from the queue. If timeout == 0
@@ -260,7 +259,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE
ACE_Message_Block *mb = 0;
- int cur_count = this->queue_.dequeue_prio (mb, timeout);
+ int const cur_count = this->queue_.dequeue_prio (mb, timeout);
// Dequeue the message.
if (cur_count != -1)
@@ -268,10 +267,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE
dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ());
// Delete the message block.
mb->release ();
- return cur_count;
}
- else
- return -1;
+
+ return cur_count;
}
// Remove an item from the end of the queue. If timeout == 0 block
@@ -286,7 +284,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE
ACE_Message_Block *mb = 0;
- int cur_count = this->queue_.dequeue_tail (mb, timeout);
+ int const cur_count = this->queue_.dequeue_tail (mb, timeout);
// Dequeue the message.
if (cur_count != -1)
@@ -294,10 +292,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE
dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ());
// Delete the message block.
mb->release ();
- return cur_count;
}
- else
- return -1;
+
+ return cur_count;
}
// Remove an item with the lowest deadline time. If timeout == 0 block
@@ -312,7 +309,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MES
ACE_Message_Block *mb = 0;
- int cur_count = this->queue_.dequeue_deadline (mb, timeout);
+ int const cur_count = this->queue_.dequeue_deadline (mb, timeout);
// Dequeue the message.
if (cur_count != -1)
@@ -320,10 +317,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MES
dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ());
// Delete the message block.
mb->release ();
- return cur_count;
}
- else
- return -1;
+
+ return cur_count;
}
template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int
@@ -899,7 +895,7 @@ template <ACE_SYNCH_DECL> int
ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i (int pulse)
{
ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i");
- int previous_state = this->state_;
+ int const previous_state = this->state_;
if (previous_state != ACE_Message_Queue_Base::DEACTIVATED)
{
@@ -919,7 +915,7 @@ template <ACE_SYNCH_DECL> int
ACE_Message_Queue<ACE_SYNCH_USE>::activate_i (void)
{
ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::activate_i");
- int previous_state = this->state_;
+ int const previous_state = this->state_;
this->state_ = ACE_Message_Queue_Base::ACTIVATED;
return previous_state;
}
@@ -942,7 +938,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::close (void)
ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::close");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1);
- int result = this->deactivate_i ();
+ int const result = this->deactivate_i ();
// Free up the remaining messages on the queue.
this->flush_i ();
diff --git a/ace/Metrics_Cache_T.cpp b/ace/Metrics_Cache_T.cpp
index 3868df80269..a3850eb2237 100644
--- a/ace/Metrics_Cache_T.cpp
+++ b/ace/Metrics_Cache_T.cpp
@@ -45,7 +45,7 @@ ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::ACE_Metrics_Timeprobe (u_int id,
name = "";
}
- char * name_tmp;
+ char * name_tmp = 0;
ACE_NEW_MALLOC_ARRAY (name_tmp,
(char *) this->allocator ()->malloc (strlen(name)+1),
char,
@@ -73,9 +73,8 @@ ACE_Metrics_Timeprobe (ALLOCATOR *alloc,
name = "";
}
- char * name_tmp;
+ char * name_tmp = 0;
ACE_NEW_MALLOC_ARRAY (name_tmp,
-// (char *) this->allocator ()->malloc (strlen(name)+1),
(char *) alloc->malloc(strlen(name)+1),
char,
strlen(name)+1);
@@ -101,11 +100,11 @@ ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::~ACE_Metrics_Timeprobe ()
template <class ACE_LOCK, class ALLOCATOR>
int
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::is_event (const ACE_Metrics_Timeprobe<ACE_LOCK,
- ALLOCATOR>::
- ACE_METRICS_TIMEPROBE_DATA_TYPE &t,
+ ALLOCATOR>::
+ ACE_METRICS_TIMEPROBE_DATA_TYPE &t,
ACE_Metrics_Timeprobe<ACE_LOCK,
- ALLOCATOR>::
- event_id id)
+ ALLOCATOR>::
+ event_id id)
{
return (t.event_.event_number_ == (u_long) id) ? 1 : 0;
}
@@ -121,7 +120,7 @@ template <class ACE_LOCK, class ALLOCATOR>
void
ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::probe_name (char * name)
{
- char * name_tmp;
+ char * name_tmp = 0;
ACE_NEW_MALLOC_ARRAY (name_tmp,
(char *) this->allocator ()->malloc (strlen(name)+1),
char,
diff --git a/ace/Msg_WFMO_Reactor.cpp b/ace/Msg_WFMO_Reactor.cpp
index ee6fe44c144..aaedb391b51 100644
--- a/ace/Msg_WFMO_Reactor.cpp
+++ b/ace/Msg_WFMO_Reactor.cpp
@@ -73,7 +73,7 @@ ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
}
::DispatchMessage (&msg);
- number_of_messages++;
+ ++number_of_messages;
}
return number_of_messages;
diff --git a/ace/Multihomed_INET_Addr.cpp b/ace/Multihomed_INET_Addr.cpp
index 33430262e9d..b8d84679e35 100644
--- a/ace/Multihomed_INET_Addr.cpp
+++ b/ace/Multihomed_INET_Addr.cpp
@@ -119,9 +119,9 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
size_t next_empty_slot = 0;
for (size_t i = 0; i < size; ++i) {
- int ret = this->secondaries_[next_empty_slot].set(port_number,
- secondary_ip_addrs[i],
- encode);
+ int const ret = this->secondaries_[next_empty_slot].set(port_number,
+ secondary_ip_addrs[i],
+ encode);
if (ret) {
ACE_DEBUG ((LM_DEBUG,
@@ -150,10 +150,10 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
for (size_t i = 0; i < size; ++i) {
- int ret = this->secondaries_[i].set(port_number,
- secondary_host_names[i],
- encode,
- address_family);
+ int const ret = this->secondaries_[i].set(port_number,
+ secondary_host_names[i],
+ encode,
+ address_family);
if (ret) {
return ret;
}
diff --git a/ace/OS_NS_sys_sendfile.cpp b/ace/OS_NS_sys_sendfile.cpp
new file mode 100644
index 00000000000..ba731a71acd
--- /dev/null
+++ b/ace/OS_NS_sys_sendfile.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "ace/OS_NS_sys_sendfile.h"
+#include "ace/OS_NS_sys_mman.h"
+#include "ace/OS_NS_unistd.h"
+
+#ifndef ACE_HAS_INLINED_OSCALLS
+# include "ace/OS_NS_sys_sendfile.inl"
+#endif /* ACE_HAS_INLINED_OS_CALLS */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#ifndef ACE_HAS_SENDFILE
+ssize_t
+ACE_OS::sendfile_emulation (ACE_HANDLE out_fd,
+ ACE_HANDLE in_fd,
+ ACE_LOFF_T * offset,
+ size_t count)
+{
+ // @@ We may want set up a signal lease (or oplock) if supported by
+ // the platform so that we don't get a bus error if the mmap()ed
+ // file is truncated.
+ void * const buf =
+ ACE_OS::mmap (0, count, PROT_READ, MAP_PRIVATE, in_fd, *offset);
+
+ ssize_t const r = ACE_OS::write (out_fd, buf, count);
+
+ (void) ACE_OS::munmap (buf, count);
+
+ if (r > 0)
+ *offset += static_cast<ACE_LOFF_T> (r);
+
+ return r;
+}
+#endif /* !ACE_HAS_SENDFILE */
+
+ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_sys_sendfile.h b/ace/OS_NS_sys_sendfile.h
new file mode 100644
index 00000000000..3f89c64f2d5
--- /dev/null
+++ b/ace/OS_NS_sys_sendfile.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file OS_NS_sys_sendfile.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef ACE_OS_NS_SYS_SENDFILE_H
+#define ACE_OS_NS_SYS_SENDFILE_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/ACE_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Basic_Types.h" /* For ssize_t and off_t. */
+
+#if defined (ACE_EXPORT_MACRO)
+# undef ACE_EXPORT_MACRO
+#endif
+#define ACE_EXPORT_MACRO ACE_Export
+
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace ACE_OS
+{
+ /// Finds the length of a string (char version).
+ ACE_NAMESPACE_INLINE_FUNCTION
+ ssize_t sendfile (ACE_HANDLE out_fd,
+ ACE_HANDLE in_fd,
+ ACE_LOFF_T * offset,
+ size_t count);
+
+#ifndef ACE_HAS_SENDFILE
+ extern ssize_t sendfile_emulation (ACE_HANDLE out_fd,
+ ACE_HANDLE in_fd,
+ ACE_LOFF_T * offset,
+ size_t count);
+#endif /* !ACE_HAS_SENDFILE */
+
+}
+
+ACE_END_VERSIONED_NAMESPACE_DECL
+
+# if defined (ACE_HAS_INLINED_OSCALLS)
+# if defined (ACE_INLINE)
+# undef ACE_INLINE
+# endif /* ACE_INLINE */
+# define ACE_INLINE inline
+# include "ace/OS_NS_sys_sendfile.inl"
+# endif /* ACE_HAS_INLINED_OSCALLS */
+
+#include /**/ "ace/post.h"
+
+#endif /* ACE_OS_NS_SYS_SENDFILE_H */
diff --git a/ace/OS_NS_sys_sendfile.inl b/ace/OS_NS_sys_sendfile.inl
new file mode 100644
index 00000000000..3a1a03b32da
--- /dev/null
+++ b/ace/OS_NS_sys_sendfile.inl
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//
+// $Id$
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE ssize_t
+ACE_OS::sendfile (ACE_HANDLE out_fd,
+ ACE_HANDLE in_fd,
+ ACE_LOFF_T * offset,
+ size_t count)
+{
+#ifdef ACE_HAS_SENDFILE
+ return sendfile (out_fd, in_fd, offset, count);
+#else
+ return ACE_OS::sendfile_emulation (out_fd, in_fd, offset, count);
+#endif /* ACE_HAS_SENDFILE */
+}
+
+ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/PI_Malloc.h b/ace/PI_Malloc.h
index b3937a7ff85..07b830e3607 100644
--- a/ace/PI_Malloc.h
+++ b/ace/PI_Malloc.h
@@ -84,8 +84,9 @@ public:
private:
- // Disallow assignment.
- void operator= (const ACE_Malloc_Header &);
+ // Disallow copy construction and assignment.
+ ACE_Malloc_Header (ACE_Malloc_Header const &);
+ void operator= (ACE_Malloc_Header const &);
};
diff --git a/ace/SSL/SSL_Asynch_BIO.cpp b/ace/SSL/SSL_Asynch_BIO.cpp
index 9d4c75ad930..972a20e441b 100644
--- a/ace/SSL/SSL_Asynch_BIO.cpp
+++ b/ace/SSL/SSL_Asynch_BIO.cpp
@@ -13,27 +13,13 @@ ACE_RCSID (ACE_SSL,
"$Id$")
-#if (defined (ACE_HAS_VERSIONED_NAMESPACE) \
- && ACE_HAS_VERSIONED_NAMESPACE == 1) \
- && !(defined (_MSC_VER) && _MSC_VER <= 1200)
-// MSVC++ 6's preprocessor can't handle macro expansions required by
-// the versioned namespace support. *sigh*
-
+#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# define ACE_ASYNCH_BIO_WRITE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_write)
# define ACE_ASYNCH_BIO_READ_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_read)
# define ACE_ASYNCH_BIO_PUTS_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_puts)
# define ACE_ASYNCH_BIO_CTRL_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_ctrl)
# define ACE_ASYNCH_BIO_NEW_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_new)
# define ACE_ASYNCH_BIO_FREE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_free)
-#else
-
-# define ACE_ASYNCH_BIO_WRITE_NAME ACE_Asynch_BIO_write
-# define ACE_ASYNCH_BIO_READ_NAME ACE_Asynch_BIO_read
-# define ACE_ASYNCH_BIO_PUTS_NAME ACE_Asynch_BIO_puts
-# define ACE_ASYNCH_BIO_CTRL_NAME ACE_Asynch_BIO_ctrl
-# define ACE_ASYNCH_BIO_NEW_NAME ACE_Asynch_BIO_new
-# define ACE_ASYNCH_BIO_FREE_NAME ACE_Asynch_BIO_free
-
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp
index 54ce70a6d2c..f99d97dc017 100644
--- a/ace/SSL/SSL_Context.cpp
+++ b/ace/SSL/SSL_Context.cpp
@@ -49,20 +49,9 @@ namespace
#ifdef ACE_HAS_THREADS
-# if (defined (ACE_HAS_VERSIONED_NAMESPACE) \
- && ACE_HAS_VERSIONED_NAMESPACE == 1) \
- && !(defined (_MSC_VER) && _MSC_VER <= 1200)
-// MSVC++ 6's preprocessor can't handle macro expansions required by
-// the versioned namespace support. *sigh*
-
+# if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_locking_callback)
# define ACE_SSL_THREAD_ID_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_thread_id)
-
-# else
-
-# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_SSL_locking_callback
-# define ACE_SSL_THREAD_ID_NAME ACE_SSL_thread_id
-
# endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
diff --git a/ace/TLI_Stream.h b/ace/TLI_Stream.h
index fc1c93107f4..fe54f76f30b 100644
--- a/ace/TLI_Stream.h
+++ b/ace/TLI_Stream.h
@@ -124,10 +124,10 @@ private:
int rwflag_;
/// Get rwflag
- int get_rwflag (void);
+ int get_rwflag (void) const;
/// Set rwflag
- void set_rwflag (int);
+ void set_rwflag (int value);
};
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/TLI_Stream.inl b/ace/TLI_Stream.inl
index a0d03db13c6..8ef7265f8cd 100644
--- a/ace/TLI_Stream.inl
+++ b/ace/TLI_Stream.inl
@@ -16,7 +16,7 @@ ACE_TLI_Stream::set_rwflag (int value)
ACE_INLINE
int
-ACE_TLI_Stream::get_rwflag (void)
+ACE_TLI_Stream::get_rwflag (void) const
{
ACE_TRACE ("ACE_TLI_Stream::get_rwflag");
return this->rwflag_;
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index c0b86bef841..46631d312a6 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -638,15 +638,15 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
// removing this Thread Descriptor before it gets put into our
// thread table.
- int result = ACE_Thread::spawn (func,
- args,
- flags,
- t_id,
- &thr_handle,
- priority,
- stack,
- stack_size,
- thread_args);
+ int const result = ACE_Thread::spawn (func,
+ args,
+ flags,
+ t_id,
+ &thr_handle,
+ priority,
+ stack,
+ stack_size,
+ thread_args);
if (result != 0)
{
@@ -1031,7 +1031,7 @@ ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int)
{
ACE_TRACE ("ACE_Thread_Manager::suspend_thr");
- int result = ACE_Thread::suspend (td->thr_handle_);
+ int const result = ACE_Thread::suspend (td->thr_handle_);
if (result == -1) {
if (errno != ENOTSUP)
this->thr_to_be_removed_.enqueue_tail (td);
@@ -1048,7 +1048,7 @@ ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int)
{
ACE_TRACE ("ACE_Thread_Manager::resume_thr");
- int result = ACE_Thread::resume (td->thr_handle_);
+ int const result = ACE_Thread::resume (td->thr_handle_);
if (result == -1) {
if (errno != ENOTSUP)
this->thr_to_be_removed_.enqueue_tail (td);
@@ -1087,7 +1087,7 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum)
tid += tid[0] == ACE_THR_ID_ALLOCATED ? 1 : 0;
#endif /* VXWORKS */
- int result = ACE_Thread::kill (tid, signum);
+ int const result = ACE_Thread::kill (tid, signum);
if (result != 0)
{
diff --git a/ace/Timeprobe_T.cpp b/ace/Timeprobe_T.cpp
index c9d971602ff..c148d3acdb9 100644
--- a/ace/Timeprobe_T.cpp
+++ b/ace/Timeprobe_T.cpp
@@ -47,7 +47,7 @@ ACE_Timeprobe_Ex (ALLOCATOR *allocator,
report_buffer_full_ (0),
allocator_ (allocator)
{
- ACE_timeprobe_t *temp;
+ ACE_timeprobe_t *temp = 0;
ACE_NEW_MALLOC_ARRAY (temp,
(ACE_timeprobe_t *) this->allocator ()->
malloc (this->max_size_*sizeof(ACE_timeprobe_t)),
@@ -99,7 +99,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::timeprobe (u_long event)
this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
- this->current_size_++;
+ ++this->current_size_;
}
@@ -115,7 +115,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::timeprobe (const char *event)
this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
- this->current_size_++;
+ ++this->current_size_;
}
template <class ACE_LOCK, class ALLOCATOR> void
@@ -134,7 +134,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::increase_size (u_long size)
if (size > this->max_size_)
{
- ACE_timeprobe_t *temp;
+ ACE_timeprobe_t *temp = 0;
ACE_NEW_MALLOC_ARRAY (temp,
(ACE_timeprobe_t *) this->allocator ()->
malloc (this->max_size_
@@ -341,7 +341,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::find_description_i (u_long i)
iterator++, j++)
{
EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator;
- next_event_descriptions++;
+ ++next_event_descriptions;
if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_)
break;
diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp
index c0f147cd09e..9f5d51fb8d6 100644
--- a/ace/Timer_Hash_T.cpp
+++ b/ace/Timer_Hash_T.cpp
@@ -514,9 +514,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id,
reinterpret_cast<Hash_Token<TYPE> *> (timer_id);
#endif /* ACE_WIN64 */
- int result = this->table_[h->pos_]->cancel (h->orig_id_,
- 0,
- dont_call);
+ int const result = this->table_[h->pos_]->cancel (h->orig_id_,
+ 0,
+ dont_call);
if (result == 1)
{
@@ -591,7 +591,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type,
for (i = 0; i < pos; ++i)
{
- int result =
+ int const result =
this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_,
0,
dont_call);
@@ -678,7 +678,7 @@ template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int
ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dispatch_info_i (const ACE_Time_Value &cur_time,
ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
{
- int result =
+ int const result =
ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::dispatch_info_i (cur_time,
info);
diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp
index 749a4e09be8..82030315aab 100644
--- a/ace/Timer_Queue_T.cpp
+++ b/ace/Timer_Queue_T.cpp
@@ -222,7 +222,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type,
ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1));
// Schedule the timer.
- long result =
+ long const result =
this->schedule_i (type,
act,
future_time,
diff --git a/ace/Token.cpp b/ace/Token.cpp
index e373a078027..1d4a3b3fe9d 100644
--- a/ace/Token.cpp
+++ b/ace/Token.cpp
@@ -2,12 +2,12 @@
#include "ace/Token.h"
-ACE_RCSID(ace, Token, "$Id$")
-
#if !defined (__ACE_INLINE__)
#include "ace/Token.inl"
#endif /* __ACE_INLINE__ */
+ACE_RCSID(ace, Token, "$Id$")
+
#if defined (ACE_HAS_THREADS)
#include "ace/Thread.h"
@@ -395,7 +395,7 @@ ACE_Token::renew (int requeue_position,
++this->waiters_;
// Remember nesting level...
- int save_nesting_level_ = this->nesting_level_;
+ int const save_nesting_level_ = this->nesting_level_;
// Reset state for new owner.
this->nesting_level_ = 0;
@@ -525,7 +525,7 @@ ACE_Token::wakeup_next_waiter (void)
}
// Wakeup next waiter.
- ACE_Token_Queue *queue;
+ ACE_Token_Queue *queue = 0;
// Writer threads get priority to run first.
if (this->writers_.head_ != 0)
diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp
index 7ccd0c254f2..ac4d9f88023 100644
--- a/ace/WFMO_Reactor.cpp
+++ b/ace/WFMO_Reactor.cpp
@@ -194,7 +194,7 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
// Remember this value; only if it changes do we need to wakeup
// the other threads
- size_t original_handle_count = this->handles_to_be_deleted_;
+ size_t const original_handle_count = this->handles_to_be_deleted_;
int result = 0;
size_t i;
diff --git a/ace/WFMO_Reactor.inl b/ace/WFMO_Reactor.inl
index adf8ca96634..bbfdcef7deb 100644
--- a/ace/WFMO_Reactor.inl
+++ b/ace/WFMO_Reactor.inl
@@ -432,9 +432,9 @@ ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1);
int changes_required = 0;
- int result = this->unbind_i (handle,
- mask,
- changes_required);
+ int const result = this->unbind_i (handle,
+ mask,
+ changes_required);
if (changes_required)
// Wake up all threads in WaitForMultipleObjects so that they can
@@ -685,7 +685,7 @@ ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle)
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
int changes_required = 0;
- int result =
+ int const result =
this->handler_rep_.suspend_handler_i (handle,
changes_required);
diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp
index d638761d121..55486591de1 100644
--- a/ace/WIN32_Asynch_IO.cpp
+++ b/ace/WIN32_Asynch_IO.cpp
@@ -177,7 +177,7 @@ ACE_WIN32_Asynch_Operation::cancel (void)
// @@ This API returns 0 on failure. So, I am returning -1 in that
// case. Is that right? (Alex).
- int result = (int) ::CancelIo (this->handle_);
+ int const result = (int) ::CancelIo (this->handle_);
if (result == 0)
// Couldnt cancel the operations.
@@ -413,7 +413,7 @@ ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
-1);
// Shared read
- int return_val = this->shared_read (result);
+ int const return_val = this->shared_read (result);
// Upon errors
if (return_val == -1)
@@ -470,7 +470,7 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block,
// Increment iovec counter if there's more to do.
if (msg_space > 0)
- iovcnt++;
+ ++iovcnt;
}
if (msg_space > 0) // Ran out of iovecs before msg_space exhausted
{
@@ -595,7 +595,7 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *
ACE_OS::set_errno_to_last_error ();
switch (errno)
{
- case ERROR_IO_PENDING:
+ case ERROR_IO_PENDING:
/* FALLTHRU */
case ERROR_MORE_DATA:
// The IO will complete proactively: the OVERLAPPED will still
diff --git a/ace/XTI_ATM_Mcast.cpp b/ace/XTI_ATM_Mcast.cpp
index 3ab9dcdad3a..854e2a36489 100644
--- a/ace/XTI_ATM_Mcast.cpp
+++ b/ace/XTI_ATM_Mcast.cpp
@@ -49,8 +49,7 @@ ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream &current_stream,
// Check for asynchronous event
if (t_errno == TLOOK)
{
- int event;
- event = ACE_OS::t_look(current_stream.get_handle());
+ int const event = ACE_OS::t_look(current_stream.get_handle());
if (event != TNODATA && event != T_DATA)
return -1;
else
diff --git a/ace/XtReactor.cpp b/ace/XtReactor.cpp
index d1ed38af310..ab4612c9472 100644
--- a/ace/XtReactor.cpp
+++ b/ace/XtReactor.cpp
@@ -378,7 +378,7 @@ ACE_XtReactor::reset_timer_interval
ACE_TRACE ("ACE_XtReactor::reset_timer_interval");
ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
- int result = ACE_Select_Reactor::timer_queue_->reset_interval
+ int const result = ACE_Select_Reactor::timer_queue_->reset_interval
(timer_id,
interval);
@@ -400,10 +400,10 @@ ACE_XtReactor::schedule_timer (ACE_Event_Handler *event_handler,
ACE_TRACE ("ACE_XtReactor::schedule_timer");
ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1));
- long result = ACE_Select_Reactor::schedule_timer (event_handler,
- arg,
- delay,
- interval);
+ long const result = ACE_Select_Reactor::schedule_timer (event_handler,
+ arg,
+ delay,
+ interval);
if (result == -1)
return -1;
else
diff --git a/ace/ace.mpc b/ace/ace.mpc
index 88b399626f7..4d10b8f77d5 100644
--- a/ace/ace.mpc
+++ b/ace/ace.mpc
@@ -155,6 +155,7 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache
OS_NS_sys_msg.cpp
OS_NS_sys_resource.cpp
OS_NS_sys_select.cpp
+ OS_NS_sys_sendfile.cpp
OS_NS_sys_shm.cpp
OS_NS_sys_socket.cpp
OS_NS_sys_stat.cpp
diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h
index 0352d866371..a0f91d1f175 100644
--- a/ace/config-linux-common.h
+++ b/ace/config-linux-common.h
@@ -397,6 +397,9 @@
// Platform has POSIX terminal interface.
#define ACE_HAS_TERMIOS
+// Linux implements sendfile().
+#define ACE_HAS_SENDFILE
+
#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO)
// Detect if getsockname() and getpeername() returns random values in
// the sockaddr_in::sin_zero field by evaluation of the kernel
diff --git a/ace/config-sunos5.8.h b/ace/config-sunos5.8.h
index 423fb1de7c4..3d87e08d32b 100644
--- a/ace/config-sunos5.8.h
+++ b/ace/config-sunos5.8.h
@@ -19,6 +19,8 @@
# define ACE_HAS_TIMEZONE
#endif
+#define ACE_HAS_SENDFILE
+
// The range of thread priorities for 5.8 differs from 5.7 in the
// minimum priority for the SCHED_OTHER policy (i.e.,
// ACE_THR_PRI_OTHER_MIN)