summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2007-08-22 18:18:46 +0000
committerSteve Huston <shuston@riverace.com>2007-08-22 18:18:46 +0000
commit7aa2de2ea6d6586a75ba0496422335e106c89876 (patch)
tree89cca23dfe794ae355f63f676ed31eacaed2d47b
parenta50ac37ec500db44d4dd15df3166512704a250be (diff)
downloadATCD-7aa2de2ea6d6586a75ba0496422335e106c89876.tar.gz
ChangeLogTag:Wed Aug 22 18:10:09 UTC 2007 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog16
-rw-r--r--ACE/ace/Hash_Map_Manager_T.h48
-rw-r--r--ACE/ace/Hash_Map_Manager_T.inl3
-rw-r--r--ACE/ace/Local_Name_Space_T.cpp6
-rw-r--r--ACE/ace/MMAP_Memory_Pool.cpp25
5 files changed, 61 insertions, 37 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 0504a829bd5..01f66565f4f 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,19 @@
+Wed Aug 22 18:10:09 UTC 2007 Steve Huston <shuston@riverace.com>
+
+ * ace/Hash_Map_Manager_T.inl (open): If open fails, include the
+ error reason in the logged message.
+
+ * ace/Hash_Map_Manager_T.h: Documentation improvements.
+
+ * ace/Local_Name_Space_T.cpp: Corrected logging of pointers to use
+ %@ instead of %d or %u.
+
+ * ace/MMAP_Memory_Pool.cpp (map_file): When remapping a previous
+ mapping, try to use MAP_FIXED unless the memory pool option
+ NEVER_FIXED is also set. Resolves a problem of mapping to a
+ different region when remapping an existing area on RHEL 4 x64.
+ Also fixed logging of pointers and size_t to use %@ and %B.
+
Wed Aug 22 18:09:45 UTC 2007 Steve Huston <shuston@riverace.com>
* m4/compiler.m4: For AIX xlC and Solaris CC 4.2, always turn on
diff --git a/ACE/ace/Hash_Map_Manager_T.h b/ACE/ace/Hash_Map_Manager_T.h
index 32e6e8da4ee..fe74f8a9795 100644
--- a/ACE/ace/Hash_Map_Manager_T.h
+++ b/ACE/ace/Hash_Map_Manager_T.h
@@ -104,11 +104,11 @@ class ACE_Allocator;
* @class ACE_Hash_Map_Manager_Ex
*
* @brief Define a map abstraction that efficiently associates
- * <EXT_ID>s with <INT_ID>s.
+ * @c EXT_ID type objects with @c INT_ID type objects.
*
* 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.
+ * is achieved through the @c HASH_KEY object and key comparison is
+ * achieved through the @c COMPARE_KEYS object.
* 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.
@@ -163,44 +163,46 @@ public:
// = Initialization and termination methods.
/**
- * Initialize a @c Hash_Map_Manager_Ex with default size elements.
+ * Initialize an ACE_Hash_Map_Manager_Ex with a default number of elements.
+ *
* @param table_alloc is a pointer to a memory allocator used for
* table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>).
+ * If @a table_alloc is 0 it defaults to ACE_Allocator::instance().
* @param entry_alloc is a pointer to an additional allocator for
* entries, so it should be able to allocate 'size' / chunks
* of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each.
- * If @c table_alloc is 0 it defaults to @c ACE_Allocator::instance().
- * If @c entry_alloc is 0 then it defaults to the same allocator as
- * @c table_alloc.
+ * If @a entry_alloc is 0 it defaults to the same allocator as
+ * @a table_alloc.
*/
ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
/**
- * Initialize a @c Hash_Map_Manager_Ex with @c size elements.
+ * Initialize an ACE_Hash_Map_Manager_Ex with @a size elements.
+ *
* @param table_alloc is a pointer to a memory allocator used for
* table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>).
+ * If @a table_alloc is 0 it defaults to ACE_Allocator::instance().
* @param entry_alloc is a pointer to an additional allocator for
* entries, so it should be able to allocate 'size' / chunks
* of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each.
- * If @c table_alloc is 0 it defaults to @c ACE_Allocator::instance().
- * If @c entry_alloc is 0 then it defaults to the same allocator as
- * @c table_alloc.
+ * If @a entry_alloc is 0 it defaults to the same allocator as
+ * @a table_alloc.
*/
ACE_Hash_Map_Manager_Ex (size_t size,
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
/**
- * Initialize a @c Hash_Map_Manager_Ex with @c size elements.
+ * Initialize an ACE_Hash_Map_Manager_Ex with @a size elements.
* @param table_alloc is a pointer to a memory allocator used for
* table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>).
+ * If @a table_alloc is 0 it defaults to ACE_Allocator::instance().
* @param entry_alloc is a pointer to an additional allocator for
* entries, so it should be able to allocate 'size' / chunks
* of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each.
- * If @c table_alloc is 0 it defaults to @c ACE_Allocator::instance().
- * If @c entry_alloc is 0 then it defaults to the same allocator as
- * @c table_alloc.
+ * If @a entry_alloc is 0 then it defaults to the same allocator as
+ * @a table_alloc.
* @return -1 on failure, 0 on success
*/
@@ -208,21 +210,23 @@ public:
ACE_Allocator *table_alloc = 0,
ACE_Allocator *entry_alloc = 0);
- /// Close down a <Hash_Map_Manager_Ex> and release dynamically allocated
+ /// Close down the ACE_Hash_Map_Manager_Ex and release dynamically allocated
/// resources.
int close (void);
- /// Removes all the entries in <Map_Manager_Ex>.
+ /// Removes all the entries in the ACE_Hash_Map_Manager_Ex.
int unbind_all (void);
- /// Cleanup the <Hash_Map_Manager_Ex>.
+ /// Cleanup the ACE_Hash_Map_Manager_Ex.
~ACE_Hash_Map_Manager_Ex (void);
/**
- * Associate @a ext_id with @a int_id. If @a ext_id is already in the
- * map then the <ACE_Hash_Map_Entry> is not changed. Returns 0 if a
- * new entry is bound successfully, returns 1 if an attempt is made
- * to bind an existing entry, and returns -1 if failures occur.
+ * Associate @a item with @a int_id. If @a item is already in the
+ * map then the map is not changed.
+ *
+ * @retval 0 if a new entry is bound successfully.
+ * @retval 1 if an attempt is made to bind an existing entry.
+ * @retval -1 if a failure occurs; check @c errno for more information.
*/
int bind (const EXT_ID &item,
const INT_ID &int_id);
diff --git a/ACE/ace/Hash_Map_Manager_T.inl b/ACE/ace/Hash_Map_Manager_T.inl
index 1f515e58603..cf749ae8a7a 100644
--- a/ACE/ace/Hash_Map_Manager_T.inl
+++ b/ACE/ace/Hash_Map_Manager_T.inl
@@ -30,7 +30,8 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_H
cur_size_ (0)
{
if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1)
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Map_Manager_Ex\n")));
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
+ ACE_LIB_TEXT ("ACE_Hash_Map_Manager_Ex open")));
}
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
diff --git a/ACE/ace/Local_Name_Space_T.cpp b/ACE/ace/Local_Name_Space_T.cpp
index 43feaf3fe81..e59756dcb80 100644
--- a/ACE/ace/Local_Name_Space_T.cpp
+++ b/ACE/ace/Local_Name_Space_T.cpp
@@ -494,7 +494,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void)
this->name_space_map_ = (ACE_Name_Space_Map <ALLOCATOR> *) ns_map;
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
+ ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"),
this->name_space_map_, ns_map));
}
@@ -511,7 +511,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void)
this->name_space_map_ = (ACE_Name_Space_Map <ALLOCATOR> *) ns_map;
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
+ ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"),
this->name_space_map_, ns_map));
}
else
@@ -530,7 +530,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::create_manager_i (void)
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
+ ACE_TEXT ("name_space_map_ = %@, ns_map = %@\n"),
this->name_space_map_, ns_map));
}
diff --git a/ACE/ace/MMAP_Memory_Pool.cpp b/ACE/ace/MMAP_Memory_Pool.cpp
index e43e3a47b73..1a8c93079fd 100644
--- a/ACE/ace/MMAP_Memory_Pool.cpp
+++ b/ACE/ace/MMAP_Memory_Pool.cpp
@@ -271,14 +271,17 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size)
this->mmap_.unmap ();
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
- if(use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::NEVER_FIXED)
+ if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::NEVER_FIXED)
this->base_addr_ = 0;
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
- // Remap the file.
+ // Remap the file; try to stay at the same location as a previous mapping.
+ int flags = this->flags_;
+ if (this->base_addr_ != 0)
+ flags |= MAP_FIXED;
if (this->mmap_.map (map_size,
PROT_RDWR,
- this->flags_,
+ flags,
this->base_addr_,
0,
this->sa_) == -1
@@ -291,7 +294,7 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size)
{
#if 0
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%P|%t) addr = %u, base_addr = %u, map_size = %u, %p\n"),
+ ACE_TEXT ("(%P|%t) addr = %@, base_addr = %@, map_size = %B, %p\n"),
this->mmap_.addr (),
this->base_addr_,
map_size,
@@ -324,7 +327,7 @@ ACE_MMAP_Memory_Pool::acquire (size_t nbytes,
rounded_bytes = this->round_up (nbytes);
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquiring more chunks, nbytes =
- // %d, rounded_bytes = %d\n", nbytes, rounded_bytes));
+ // %B, rounded_bytes = %B\n", nbytes, rounded_bytes));
size_t map_size;
@@ -334,8 +337,8 @@ ACE_MMAP_Memory_Pool::acquire (size_t nbytes,
else if (this->map_file (map_size) == -1)
return 0;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquired more chunks, nbytes = %d,
- // rounded_bytes = %d, map_size = %d\n", nbytes, rounded_bytes,
+ // ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquired more chunks, nbytes = %B,
+ // rounded_bytes = %B, map_size = %B\n", nbytes, rounded_bytes,
// map_size));
return (void *) ((char *) this->mmap_.addr () + (this->mmap_.size () - rounded_bytes));
@@ -419,7 +422,7 @@ int
ACE_MMAP_Memory_Pool::remap (void *addr)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::remap");
- // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Remapping with fault address at: %X\n"), addr));
+ // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Remapping with fault address at: %@\n"), addr));
size_t const current_map_size =
ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
// ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
@@ -477,7 +480,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
else
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) received %S\n"), signum));
#endif
- // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) new mapping address = %u\n"), (char *) this->base_addr_ + current_map_size));
+ // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) new mapping address = %@\n"), (char *) this->base_addr_ + current_map_size));
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)
// Make sure that the pointer causing the problem is within the
@@ -485,10 +488,10 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
if (siginfo != 0)
{
- // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %u\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
+ // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %@\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
if (this->remap ((void *) siginfo->si_addr) == -1)
return -1;
- // ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %u out of range\n",
+ // ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %@ out of range\n",
// siginfo->si_addr), -1);
return 0;
}