summaryrefslogtreecommitdiff
path: root/ace/Memory_Pool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Memory_Pool.cpp')
-rw-r--r--ace/Memory_Pool.cpp275
1 files changed, 92 insertions, 183 deletions
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index 1d07027de11..b8a3567fa6d 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -10,10 +10,6 @@
#include "ace/Auto_Ptr.h"
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
-#include "ace/Based_Pointer_T.h"
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-
ACE_RCSID(ace, Memory_Pool, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_Local_Memory_Pool)
@@ -37,17 +33,16 @@ ACE_Local_Memory_Pool::acquire (size_t nbytes,
ACE_TRACE ("ACE_Local_Memory_Pool::acquire");
rounded_bytes = this->round_up (nbytes);
- char *temp = 0;
- ACE_NEW_RETURN (temp,
- char[rounded_bytes],
- 0);
-
- ACE_Auto_Basic_Array_Ptr<char> cp (temp);
+ ACE_Auto_Basic_Array_Ptr<char> cp (new char[rounded_bytes]);
- if (this->allocated_chunks_.insert (cp.get ()) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) insertion into set failed\n")),
- 0);
+ if (cp.get () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) new failed \n")), 0);
+ else
+ {
+ int result = this->allocated_chunks_.insert (cp.get ());
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) insertion into set failed\n")), 0);
+ }
return cp.release ();
}
@@ -61,7 +56,9 @@ ACE_Local_Memory_Pool::release (void)
for (ACE_Unbounded_Set<char *>::iterator i = this->allocated_chunks_.begin ();
i != this->allocated_chunks_.end ();
++i)
- delete [] *i;
+ {
+ delete[] *i;
+ }
return 0;
}
@@ -78,12 +75,6 @@ int
ACE_MMAP_Memory_Pool::release (void)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::release");
-
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- ACE_POSITION_INDEPENDENT_REPOSITORY::instance ()->unbind (this->mmap_.addr (),
- this->mmap_.size ());
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-
this->mmap_.remove ();
return 0;
}
@@ -184,21 +175,20 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (LPCTSTR backing_store_name,
#if !defined (ACE_WIN32) && !defined (CHORUS)
if (this->signal_handler_.register_handler (SIGSEGV, this) == -1)
- ACE_ERROR ((LM_ERROR,
- "%p\n", this->backing_store_name_));
+ ACE_ERROR ((LM_ERROR, "%p\n", this->backing_store_name_));
#endif /* ACE_WIN32 */
}
-// Compute the new map_size of the backing store and commit the
+// Compute the new file_offset of the backing store and commit the
// memory.
int
ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
- off_t &map_size)
+ off_t &file_offset)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::commit_backing_store_name");
#if defined (CHORUS)
- map_size = rounded_bytes;
+ file_offset = rounded_bytes;
#else
size_t seek_len;
@@ -218,9 +208,9 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
cur_block < rounded_bytes;
cur_block += seek_len)
{
- map_size = ACE_OS::lseek (this->mmap_.handle () , seek_len - 1, SEEK_END);
+ file_offset = ACE_OS::lseek (this->mmap_.handle () , seek_len - 1, SEEK_END);
- if (map_size == -1 || ACE_OS::write (this->mmap_.handle (), "", 1) == -1)
+ if (file_offset == -1 || ACE_OS::write (this->mmap_.handle (), "", 1) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("(%P|%t) %p\n"),
this->backing_store_name_),
@@ -228,15 +218,15 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
}
// Increment by one to put us at the beginning of the next chunk...
- map_size++;
+ file_offset++;
#endif /* CHORUS */
return 0;
}
-// Memory map the file up to <map_size> bytes.
+// Memory map the file up to <file_offset> bytes.
int
-ACE_MMAP_Memory_Pool::map_file (off_t map_size)
+ACE_MMAP_Memory_Pool::map_file (off_t file_offset)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::map_file");
@@ -244,32 +234,16 @@ ACE_MMAP_Memory_Pool::map_file (off_t map_size)
this->mmap_.unmap ();
// Remap the file.
- if (this->mmap_.map (map_size,
- PROT_RDWR,
- this->flags_,
- this->base_addr_,
- 0,
- this->sa_) == -1
+ if (this->mmap_.map (file_offset, PROT_RDWR,
+ this->flags_, this->base_addr_, 0, this->sa_) == -1
|| this->base_addr_ != 0 && this->mmap_.addr () != this->base_addr_)
- {
-#if 0
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) addr = %u, base_addr = %u, map_size = %u, %p\n"),
- this->mmap_.addr (),
- this->base_addr_,
- map_size,
- this->backing_store_name_));
-#endif /* 0 */
- return -1;
- }
- else
- {
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- ACE_POSITION_INDEPENDENT_REPOSITORY::instance ()->bind (this->base_addr_,
- map_size);
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
- return 0;
- }
+ return -1;
+ // ACE_ERROR_RETURN ((LM_ERROR,
+ // ASYS_TEXT ("(%P|%t) addr = %u, base_addr = %u, file_offset = %u, %p\n"),
+ // this->mmap_.addr (), this->base_addr_,
+ // file_offset, this->backing_store_name_), -1);
+
+ return 0;
}
// Ask operating system for more shared memory, increasing the mapping
@@ -286,17 +260,18 @@ ACE_MMAP_Memory_Pool::acquire (size_t nbytes,
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquiring more chunks, nbytes =
// %d, rounded_bytes = %d\n", nbytes, rounded_bytes));
- off_t map_size;
+ off_t file_offset;
if (this->commit_backing_store_name (rounded_bytes,
- map_size) == -1)
+ file_offset) == -1)
return 0;
- else if (this->map_file (map_size) == -1)
+
+ if (this->map_file (file_offset) == -1)
return 0;
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) acquired more chunks, nbytes = %d,
- // rounded_bytes = %d, map_size = %d\n", nbytes, rounded_bytes,
- // map_size));
+ // rounded_bytes = %d, file_offset = %d\n", nbytes, rounded_bytes,
+ // file_offset));
return (void *) ((char *) this->mmap_.addr () + (this->mmap_.size () - rounded_bytes));
}
@@ -340,18 +315,12 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
this->base_addr_,
0,
this->sa_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("open")),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("open")), 0);
return this->mmap_.addr ();
}
else
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("open")),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("open")), 0);
}
int
@@ -359,15 +328,15 @@ ACE_MMAP_Memory_Pool::remap (void *addr)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::remap");
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Remapping with fault address at: %X\n"), addr));
- off_t current_map_size = ACE_OS::filesize (this->mmap_.handle ());
+ off_t current_file_offset = ACE_OS::filesize (this->mmap_.handle ());
// ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
- if (!(addr < (void *) ((char *) this->mmap_.addr () + current_map_size)
+ if (!(addr < (void *) ((char *) this->mmap_.addr () + current_file_offset)
&& addr >= this->mmap_.addr ()))
return -1;
// Extend the mapping to cover the size of the backing store.
- return this->map_file (current_map_size);
+ return this->map_file (current_file_offset);
}
ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (void *base_addr,
@@ -388,9 +357,9 @@ ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (void *base_addr,
ACE_TRACE ("ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options");
// HP-UX 11, 64-bit bug workaround.
#if defined (__hpux) && defined (__LP64__)
- long temp = ACE_DEFAULT_BASE_ADDRL;
- base_addr_ = (void *) temp;
-#endif /* defined (__hpux) && defined (__LP64__) */
+long temp = ACE_DEFAULT_BASE_ADDRL;
+base_addr_ = (void *)temp;
+#endif
}
// Handle SIGSEGV and SIGBUS signals to remap memory properly. When a
@@ -411,7 +380,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
else
; // ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) received %S\n"), signum));
- // ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) new mapping address = %u\n"), (char *) this->base_addr_ + current_map_size));
+ // ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) new mapping address = %u\n"), (char *) this->base_addr_ + current_file_offset));
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR)
// Make sure that the pointer causing the problem is within the
@@ -438,16 +407,16 @@ 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 current_file_offset = ACE_OS::filesize (this->mmap_.handle ());
- if (ACE_static_cast(size_t, current_map_size) == this->mmap_.size())
+ if (ACE_static_cast(size_t, current_file_offset) == this->mmap_.size())
{
// It is up to date so this is a bad address.
return -1;
}
// Extend the mapping to cover the size of the backing store.
- return this->map_file (current_map_size);
+ return this->map_file (current_file_offset);
}
else
return -1;
@@ -491,10 +460,7 @@ ACE_Sbrk_Memory_Pool::acquire (size_t nbytes,
void *cp = ACE_OS::sbrk (rounded_bytes);
if (cp == MAP_FAILED)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) cp = %u\n",
- cp),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) cp = %u\n", cp), 0);
else
// ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d, new break = %u\n"), nbytes, rounded_bytes, cp));
return cp;
@@ -519,20 +485,18 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_Pool)
ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (char *base_addr,
size_t max_segments,
size_t file_perms,
- off_t minimum_bytes,
- size_t segment_size)
+ off_t minimum_bytes)
: base_addr_ (base_addr),
max_segments_ (max_segments),
minimum_bytes_ (minimum_bytes),
- file_perms_ (file_perms),
- segment_size_ (segment_size)
+ file_perms_ (file_perms)
{
ACE_TRACE ("ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options");
- // HP-UX 11, 64-bit bug workaround
-#if defined (__hpux) && defined (__LP64__)
- long temp = ACE_DEFAULT_BASE_ADDRL;
- base_addr_ = (char *) temp;
-#endif /* defined (__hpux) && defined (__LP64__) */
+// HP-UX 11, 64-bit bug workaround
+#if defined (__hpux) && defined(__LP64__)
+long temp = ACE_DEFAULT_BASE_ADDRL;
+base_addr_ = (char *)temp;
+#endif
}
void
@@ -546,8 +510,7 @@ ACE_Shared_Memory_Pool::in_use (off_t &offset,
size_t &counter)
{
offset = 0;
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
shmid_ds buf;
for (counter = 0;
@@ -555,10 +518,7 @@ ACE_Shared_Memory_Pool::in_use (off_t &offset,
counter++)
{
if (ACE_OS::shmctl (st[counter].shmid_, IPC_STAT, &buf) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("shmctl")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("shmctl")), -1);
offset += buf.shm_segsz;
// ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) segment size = %d, offset = %d\n"), buf.shm_segsz, offset));
}
@@ -572,8 +532,7 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
size_t &counter)
{
offset = 0;
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
shmid_ds buf;
for (counter = 0;
@@ -582,10 +541,7 @@ ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr,
counter++)
{
if (ACE_OS::shmctl (st[counter].shmid_, IPC_STAT, &buf) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("shmctl")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("shmctl")), -1);
offset += buf.shm_segsz;
// If segment 'counter' starts at a location greater than the
@@ -610,8 +566,7 @@ ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
ACE_TRACE ("ACE_Shared_Memory_Pool::update");
size_t counter;
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
if (this->in_use (offset, counter) == -1)
return -1;
@@ -619,35 +574,24 @@ ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
if (counter == this->max_segments_)
ACE_ERROR_RETURN ((LM_ERROR,
"exceeded max number of segments = %d, base = %u, offset = %u\n",
- counter,
- this->base_addr_,
- offset),
- -1);
+ counter, this->base_addr_, offset), -1);
else
{
int shmid = ACE_OS::shmget (st[counter].key_,
rounded_bytes,
this->file_perms_ | IPC_CREAT | IPC_EXCL);
if (shmid == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("shmget")),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("shmget")), 0);
+
st[counter].shmid_ = shmid;
st[counter].used_ = 1;
void *address = (void *) (((char *) this->base_addr_) + offset);
- void *shmem = ACE_OS::shmat (st[counter].shmid_,
- (char *) address,
- 0);
+ void *shmem = ACE_OS::shmat (st[counter].shmid_, (char *) address, 0);
if (shmem != address)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) %p, shmem = %u, address = %u\n",
- "shmat",
- shmem,
- address),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p, shmem = %u, address = %u\n",
+ "shmat", shmem, address), 0);
}
return 0;
}
@@ -670,25 +614,19 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
// ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %u\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
size_t counter;
if (this->in_use (offset, counter) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("in_use")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("in_use")));
#if !defined(_UNICOS)
else if (!(siginfo->si_code == SEGV_MAPERR
&& siginfo->si_addr < (((char *) this->base_addr_) + offset)
&& siginfo->si_addr >= ((char *) this->base_addr_)))
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) address %u out of range\n",
- siginfo->si_addr),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %u out of range\n",
+ siginfo->si_addr), -1);
#else /* ! _UNICOS */
else if (!(siginfo->si_code == SEGV_MEMERR
&& siginfo->si_addr < (((unsigned long) this->base_addr_) + offset)
&& siginfo->si_addr >= ((unsigned long) this->base_addr_)))
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) address %u out of range\n",
- siginfo->si_addr),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) address %u out of range\n",
+ siginfo->si_addr), -1);
#endif /* ! _UNICOS */
}
@@ -704,24 +642,16 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
#else /* ! _UNICOS */
if (this->find_seg ((const void *)siginfo->si_addr, offset, counter) == -1)
#endif /* ! _UNICOS */
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("in_use")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("in_use")), -1);
void *address = (void *) (((char *) this->base_addr_) + offset);
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
void *shmem = ACE_OS::shmat (st[counter].shmid_, (char *) address, 0);
if (shmem != address)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) %p, shmem = %u, address = %u\n",
- "shmat",
- shmem,
- address),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p, shmem = %u, address = %u\n",
+ "shmat", shmem, address), 0);
// NOTE: this won't work if we dont have SIGINFO_T or SI_ADDR
#else
@@ -736,8 +666,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (LPCTSTR backing_store_name,
: base_addr_ (0),
file_perms_ (ACE_DEFAULT_FILE_PERMS),
max_segments_ (ACE_DEFAULT_MAX_SEGMENTS),
- minimum_bytes_ (0),
- segment_size_ (ACE_DEFAULT_SEGMENT_SIZE)
+ minimum_bytes_ (0)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool");
@@ -748,7 +677,6 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (LPCTSTR backing_store_name,
this->max_segments_ = options->max_segments_;
this->file_perms_ = options->file_perms_;
this->minimum_bytes_ = options->minimum_bytes_;
- this->segment_size_ = options->segment_size_;
}
if (backing_store_name)
@@ -777,9 +705,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (LPCTSTR backing_store_name,
this->base_shm_key_ = ACE_DEFAULT_SHM_KEY;
if (this->signal_handler_.register_handler (SIGSEGV, this) == -1)
- ACE_ERROR ((LM_ERROR,
- ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("ACE_Sig_Handler::register_handler")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_Sig_Handler::register_handler")));
}
// Ask system for more shared memory.
@@ -826,51 +752,35 @@ ACE_Shared_Memory_Pool::init_acquire (size_t nbytes,
if (shmid == -1)
{
if (errno != EEXIST)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("shmget")),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("shmget")), 0);
+
first_time = 0;
shmid = ACE_OS::shmget (this->base_shm_key_, 0, 0);
if (shmid == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("(%P|%t) %p\n"),
- ASYS_TEXT ("shmget")),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("shmget")), 0);
- // This implementation doesn't care if we don't get the key we
- // want...
- this->base_addr_ =
- ACE_OS::shmat (shmid,
- (char *) this->base_addr_, 0);
+ // This implementation doesn't care if we don't get the key we want...
+ this->base_addr_ = ACE_OS::shmat (shmid, (char *) this->base_addr_, 0);
if (this->base_addr_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) %p, base_addr = %u\n",
- "shmat",
- this->base_addr_),
- 0);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p, base_addr = %u\n",
+ "shmat", this->base_addr_), 0);
}
else
{
first_time = 1;
- // This implementation doesn't care if we don't get the key we
- // want...
- this->base_addr_ =
- ACE_OS::shmat (shmid,
- (char *) this->base_addr_, 0);
+ // This implementation doesn't care if we don't get the key we want...
+ this->base_addr_ = ACE_OS::shmat (shmid, (char *) this->base_addr_, 0);
if (this->base_addr_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) %p, base_addr = %u\n",
- "shmat",
- this->base_addr_), 0);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p, base_addr = %u\n",
+ "shmat", this->base_addr_), 0);
+
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
st[0].key_ = this->base_shm_key_;
st[0].shmid_ = shmid;
@@ -897,8 +807,7 @@ ACE_Shared_Memory_Pool::release (void)
ACE_TRACE ("ACE_Shared_Memory_Pool::release");
int result = 0;
- SHM_TABLE *st = ACE_reinterpret_cast (SHM_TABLE *,
- this->base_addr_);
+ SHM_TABLE *st = (SHM_TABLE *) this->base_addr_;
for (size_t counter = 0;
counter < this->max_segments_ && st[counter].used_ == 1;