#include <SV_Shared_Memory.h>
Public Types | |
enum | { ACE_CREATE = IPC_CREAT, ACE_OPEN = 0 } |
Public Member Functions | |
ACE_SV_Shared_Memory (void) | |
ACE_SV_Shared_Memory (key_t external_id, size_t size, int create, int perms=ACE_DEFAULT_FILE_PERMS, void *virtual_addr=0, int flags=0) | |
ACE_SV_Shared_Memory (ACE_HANDLE internal_id, int flags=0) | |
int | open (key_t external_id, size_t size, int create=ACE_SV_Shared_Memory::ACE_OPEN, int perms=ACE_DEFAULT_FILE_PERMS) |
int | open_and_attach (key_t external_id, size_t size, int create=ACE_SV_Shared_Memory::ACE_OPEN, int perms=ACE_DEFAULT_FILE_PERMS, void *virtual_addr=0, int flags=0) |
int | attach (void *virtual_addr=0, int flags=0) |
Attach this shared memory segment. | |
int | detach (void) |
Detach this shared memory segment. | |
int | remove (void) |
Remove this shared memory segment. | |
int | control (int cmd, void *buf) |
Forward to underlying System V . | |
void * | get_segment_ptr (void) const |
size_t | get_segment_size (void) const |
ACE_HANDLE | get_id (void) const |
Return the ID of the shared memory segment (i.e., an ACE_HANDLE). | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
enum | { ALIGN_WORDB = 8 } |
Protected Member Functions | |
size_t | round_up (size_t len) |
Round up to an appropriate page size. | |
Protected Attributes | |
ACE_HANDLE | internal_id_ |
Internal identifier. | |
size_t | size_ |
Size of the mapped segment. | |
void * | segment_ptr_ |
Pointer to the beginning of the segment. |
Definition at line 35 of file SV_Shared_Memory.h.
|
Definition at line 38 of file SV_Shared_Memory.h.
00039 { 00040 ACE_CREATE = IPC_CREAT, 00041 ACE_OPEN = 0 00042 }; |
|
Definition at line 94 of file SV_Shared_Memory.h.
00095 { 00096 /// Most restrictive alignment. 00097 ALIGN_WORDB = 8 00098 }; |
|
Definition at line 62 of file SV_Shared_Memory.cpp. References ACE_TRACE.
00063 : internal_id_ (0), 00064 size_ (0), 00065 segment_ptr_ (0) 00066 { 00067 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); 00068 } |
|
Definition at line 46 of file SV_Shared_Memory.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, LM_ERROR, and open_and_attach().
00052 { 00053 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); 00054 if (this->open_and_attach (external_id, sz, create, 00055 perms, virtual_addr, flags) == -1) 00056 ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), 00057 ACE_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); 00058 } |
|
Definition at line 77 of file SV_Shared_Memory.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, attach(), and LM_ERROR.
00079 : internal_id_ (int_id), 00080 size_ (0) 00081 { 00082 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); 00083 if (this->attach (0, flags) == -1) 00084 ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), 00085 ACE_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); 00086 } |
|
Attach this shared memory segment.
Definition at line 44 of file SV_Shared_Memory.inl. References ACE_NOTSUP_RETURN, ACE_TRACE, segment_ptr_, and ACE_OS::shmat(). Referenced by ACE_SV_Shared_Memory(), and open_and_attach().
00045 { 00046 ACE_TRACE ("ACE_SV_Shared_Memory::attach"); 00047 #if defined (ACE_WIN32) 00048 ACE_UNUSED_ARG(flags); 00049 ACE_UNUSED_ARG(virtual_addr); 00050 ACE_NOTSUP_RETURN (-1); 00051 #else 00052 this->segment_ptr_ = ACE_OS::shmat (this->internal_id_, virtual_addr, flags); 00053 return this->segment_ptr_ == (void *) -1 ? -1 : 0; 00054 #endif /* ACE_WIN32 */ 00055 } |
|
Forward to underlying System V .
Definition at line 60 of file SV_Shared_Memory.inl. References ACE_NOTSUP_RETURN, ACE_TRACE, and ACE_OS::shmctl().
00061 { 00062 ACE_TRACE ("ACE_SV_Shared_Memory::control"); 00063 #if defined (ACE_WIN32) 00064 ACE_UNUSED_ARG(cmd); 00065 ACE_UNUSED_ARG(buf); 00066 ACE_NOTSUP_RETURN (-1); 00067 #else 00068 return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf); 00069 #endif /* ACE_WIN32 */ 00070 } |
|
Detach this shared memory segment.
Definition at line 98 of file SV_Shared_Memory.inl. References ACE_TRACE, and ACE_OS::shmdt(). Referenced by ACE_Shared_Memory_SV::close().
00099 { 00100 ACE_TRACE ("ACE_SV_Shared_Memory::detach"); 00101 return ACE_OS::shmdt (this->segment_ptr_); 00102 } |
|
Dump the state of an object.
Definition at line 17 of file SV_Shared_Memory.cpp. References ACE_TRACE.
00018 { 00019 #if defined (ACE_HAS_DUMP) 00020 ACE_TRACE ("ACE_SV_Shared_Memory::dump"); 00021 #endif /* ACE_HAS_DUMP */ 00022 } |
|
Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
Definition at line 112 of file SV_Shared_Memory.inl. References ACE_TRACE. Referenced by ACE_Shared_Memory_SV::get_id().
00113 { 00114 ACE_TRACE ("ACE_SV_Shared_Memory::get_id"); 00115 return this->internal_id_; 00116 } |
|
Definition at line 105 of file SV_Shared_Memory.inl. References ACE_TRACE, and segment_ptr_. Referenced by ACE_Shared_Memory_SV::malloc().
00106 { 00107 ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_ptr"); 00108 return this->segment_ptr_; 00109 } |
|
Definition at line 75 of file SV_Shared_Memory.inl. References ACE_TRACE. Referenced by ACE_Shared_Memory_SV::get_segment_size().
|
|
Definition at line 22 of file SV_Shared_Memory.inl. References ACE_NOTSUP_RETURN, ACE_TRACE, segment_ptr_, and ACE_OS::shmget(). Referenced by open_and_attach().
00023 { 00024 ACE_TRACE ("ACE_SV_Shared_Memory::open"); 00025 #if defined (ACE_WIN32) 00026 ACE_UNUSED_ARG(perms); 00027 ACE_UNUSED_ARG(create); 00028 ACE_UNUSED_ARG(sz); 00029 ACE_UNUSED_ARG(external_id); 00030 ACE_NOTSUP_RETURN (-1); 00031 #else 00032 this->segment_ptr_ = 0; 00033 this->size_ = sz; 00034 00035 this->internal_id_ = ACE_OS::shmget (external_id, sz, create | perms); 00036 00037 return this->internal_id_ == -1 ? -1 : 0; 00038 #endif /* ACE_WIN32 */ 00039 } |
|
Definition at line 28 of file SV_Shared_Memory.cpp. References ACE_TRACE, attach(), and open(). Referenced by ACE_SV_Shared_Memory(), and ACE_Shared_Memory_SV::open().
|
|
Remove this shared memory segment.
Definition at line 84 of file SV_Shared_Memory.inl. References ACE_NOTSUP_RETURN, ACE_TRACE, IPC_RMID, and ACE_OS::shmctl(). Referenced by ACE_Shared_Memory_SV::remove().
00085 { 00086 ACE_TRACE ("ACE_SV_Shared_Memory::remove"); 00087 #if defined (ACE_WIN32) 00088 ACE_NOTSUP_RETURN (-1); 00089 #else 00090 return ACE_OS::shmctl (this->internal_id_, IPC_RMID, 0); 00091 #endif /* ACE_WIN32 */ 00092 } |
|
Round up to an appropriate page size.
Definition at line 12 of file SV_Shared_Memory.inl. References ACE_TRACE.
00013 { 00014 ACE_TRACE ("ACE_SV_Shared_Memory::round_up"); 00015 return (len + ACE_SV_Shared_Memory::ALIGN_WORDB - 1) & ~(ACE_SV_Shared_Memory::ALIGN_WORDB - 1); 00016 } |
|
Declare the dynamic allocation hooks.
Definition at line 91 of file SV_Shared_Memory.h. |
|
Internal identifier.
Definition at line 101 of file SV_Shared_Memory.h. |
|
Pointer to the beginning of the segment.
Definition at line 107 of file SV_Shared_Memory.h. Referenced by attach(), get_segment_ptr(), and open(). |
|
Size of the mapped segment.
Definition at line 104 of file SV_Shared_Memory.h. |