#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 95 of file SV_Shared_Memory.h.
00096 {
00097 /// Most restrictive alignment.
00098 ALIGN_WORDB = 8
00099 };
|
|
|
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_LIB_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_LIB_TEXT ("%p\n"),
00057 ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory")));
00058 }
|
|
||||||||||||
|
Definition at line 77 of file SV_Shared_Memory.cpp. References ACE_ERROR, ACE_LIB_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_LIB_TEXT ("%p\n"), 00085 ACE_LIB_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
00067 ACE_NOTSUP_RETURN (-1);
00068 #else
00069 return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf);
00070 #endif /* ACE_WIN32 */
00071 }
|
|
|
Detach this shared memory segment.
Definition at line 99 of file SV_Shared_Memory.inl. References ACE_TRACE, and ACE_OS::shmdt(). Referenced by ACE_Shared_Memory_SV::close().
00100 {
00101 ACE_TRACE ("ACE_SV_Shared_Memory::detach");
00102 return ACE_OS::shmdt (this->segment_ptr_);
00103 }
|
|
|
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 113 of file SV_Shared_Memory.inl. References ACE_TRACE. Referenced by ACE_Shared_Memory_SV::get_id().
00114 {
00115 ACE_TRACE ("ACE_SV_Shared_Memory::get_id");
00116 return this->internal_id_;
00117 }
|
|
|
Definition at line 106 of file SV_Shared_Memory.inl. References ACE_TRACE, and segment_ptr_. Referenced by ACE_Shared_Memory_SV::malloc().
00107 {
00108 ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_ptr");
00109 return this->segment_ptr_;
00110 }
|
|
|
Definition at line 76 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 85 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().
00086 {
00087 ACE_TRACE ("ACE_SV_Shared_Memory::remove");
00088 #if defined (ACE_WIN32)
00089 ACE_NOTSUP_RETURN (-1);
00090 #else
00091 return ACE_OS::shmctl (this->internal_id_, IPC_RMID, 0);
00092 #endif /* ACE_WIN32 */
00093 }
|
|
|
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 92 of file SV_Shared_Memory.h. |
|
|
Internal identifier.
Definition at line 102 of file SV_Shared_Memory.h. |
|
|
Pointer to the beginning of the segment.
Definition at line 108 of file SV_Shared_Memory.h. Referenced by attach(), get_segment_ptr(), and open(). |
|
|
Size of the mapped segment.
Definition at line 105 of file SV_Shared_Memory.h. |
1.3.6