#include <SV_Shared_Memory.h>
Public Types | |
| enum | { ACE_CREATE = IPC_CREAT, ACE_OPEN = 0 } |
Public Methods | |
| 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. More... | |
| int | detach (void) |
| Detach this shared memory segment. More... | |
| int | remove (void) |
| Remove this shared memory segment. More... | |
| int | control (int cmd, void *buf) |
| Forward to underlying System V <shmctl>. More... | |
| 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). More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Types | |
| enum | { ALIGN_WORDB = 8 } |
Protected Methods | |
| size_t | round_up (size_t len) |
| Round up to an appropriate page size. More... | |
Protected Attributes | |
| ACE_HANDLE | internal_id_ |
| Internal identifier. More... | |
| size_t | size_ |
| Size of the mapped segment. More... | |
| void * | segment_ptr_ |
| Pointer to the beginning of the segment. More... | |
Definition at line 31 of file SV_Shared_Memory.h.
|
|
Definition at line 34 of file SV_Shared_Memory.h.
00035 {
00036 ACE_CREATE = IPC_CREAT,
00037 ACE_OPEN = 0
00038 };
|
|
|
Definition at line 91 of file SV_Shared_Memory.h.
00092 {
00093 /// Most restrictive alignment.
00094 ALIGN_WORDB = 8
00095 };
|
|
|
Definition at line 60 of file SV_Shared_Memory.cpp. References ACE_TRACE.
00061 : internal_id_ (0), 00062 size_ (0), 00063 segment_ptr_ (0) 00064 { 00065 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); 00066 } |
|
||||||||||||||||||||||||||||
|
Definition at line 44 of file SV_Shared_Memory.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open_and_attach.
00050 {
00051 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory");
00052 if (this->open_and_attach (external_id, sz, create,
00053 perms, virtual_addr, flags) == -1)
00054 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"),
00055 ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory")));
00056 }
|
|
||||||||||||
|
Definition at line 75 of file SV_Shared_Memory.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, attach, and LM_ERROR.
00077 : internal_id_ (int_id), 00078 size_ (0) 00079 { 00080 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); 00081 if (this->attach (0, flags) == -1) 00082 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), 00083 ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); 00084 } |
|
||||||||||||
|
Attach this shared memory segment.
Definition at line 41 of file SV_Shared_Memory.i. References ACE_TRACE, segment_ptr_, and ACE_OS::shmat. Referenced by ACE_SV_Shared_Memory, and open_and_attach.
00042 {
00043 ACE_TRACE ("ACE_SV_Shared_Memory::attach");
00044 #if defined (ACE_WIN32)
00045 ACE_UNUSED_ARG(flags);
00046 ACE_UNUSED_ARG(virtual_addr);
00047 ACE_NOTSUP_RETURN (-1);
00048 #else
00049 this->segment_ptr_ = ACE_OS::shmat (this->internal_id_, virtual_addr, flags);
00050 return this->segment_ptr_ == (void *) -1 ? -1 : 0;
00051 #endif /* ACE_WIN32 */
00052 }
|
|
||||||||||||
|
Forward to underlying System V <shmctl>.
Definition at line 57 of file SV_Shared_Memory.i. References ACE_TRACE, and ACE_OS::shmctl.
00058 {
00059 ACE_TRACE ("ACE_SV_Shared_Memory::control");
00060 #if defined (ACE_WIN32)
00061 ACE_UNUSED_ARG(cmd);
00062 ACE_UNUSED_ARG(buf);
00063
00064 ACE_NOTSUP_RETURN (-1);
00065 #else
00066 return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf);
00067 #endif /* ACE_WIN32 */
00068 }
|
|
|
Detach this shared memory segment.
Definition at line 96 of file SV_Shared_Memory.i. References ACE_TRACE, and ACE_OS::shmdt. Referenced by ACE_Shared_Memory_SV::close.
00097 {
00098 ACE_TRACE ("ACE_SV_Shared_Memory::detach");
00099 return ACE_OS::shmdt (this->segment_ptr_);
00100 }
|
|
|
Dump the state of an object.
Definition at line 17 of file SV_Shared_Memory.cpp. References ACE_TRACE.
00018 {
00019 ACE_TRACE ("ACE_SV_Shared_Memory::dump");
00020 }
|
|
|
Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
Definition at line 110 of file SV_Shared_Memory.i. References ACE_TRACE, and internal_id_. Referenced by ACE_Shared_Memory_SV::get_id.
00111 {
00112 ACE_TRACE ("ACE_SV_Shared_Memory::get_id");
00113 return this->internal_id_;
00114 }
|
|
|
Definition at line 103 of file SV_Shared_Memory.i. References ACE_TRACE, and segment_ptr_. Referenced by ACE_Shared_Memory_SV::malloc.
00104 {
00105 ACE_TRACE ("ACE_SV_Shared_Memory::get_segment_ptr");
00106 return this->segment_ptr_;
00107 }
|
|
|
Definition at line 73 of file SV_Shared_Memory.i. References ACE_TRACE, and size_.
|
|
||||||||||||||||||||
|
Definition at line 19 of file SV_Shared_Memory.i. References ACE_TRACE, internal_id_, segment_ptr_, ACE_OS::shmget, and size_. Referenced by open_and_attach.
00020 {
00021 ACE_TRACE ("ACE_SV_Shared_Memory::open");
00022 #if defined (ACE_WIN32)
00023 ACE_UNUSED_ARG(perms);
00024 ACE_UNUSED_ARG(create);
00025 ACE_UNUSED_ARG(sz);
00026 ACE_UNUSED_ARG(external_id);
00027 ACE_NOTSUP_RETURN (-1);
00028 #else
00029 this->segment_ptr_ = 0;
00030 this->size_ = sz;
00031
00032 this->internal_id_ = ACE_OS::shmget (external_id, sz, create | perms);
00033
00034 return this->internal_id_ == -1 ? -1 : 0;
00035 #endif /* ACE_WIN32 */
00036 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 26 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 82 of file SV_Shared_Memory.i. References ACE_TRACE, IPC_RMID, and ACE_OS::shmctl. Referenced by ACE_Shared_Memory_SV::remove.
00083 {
00084 ACE_TRACE ("ACE_SV_Shared_Memory::remove");
00085 #if defined (ACE_WIN32)
00086 ACE_NOTSUP_RETURN (-1);
00087 #else
00088 return ACE_OS::shmctl (this->internal_id_, IPC_RMID, 0);
00089 #endif /* ACE_WIN32 */
00090 }
|
|
|
Round up to an appropriate page size.
Definition at line 9 of file SV_Shared_Memory.i. References ACE_TRACE, and ALIGN_WORDB.
00010 {
00011 ACE_TRACE ("ACE_SV_Shared_Memory::round_up");
00012 return (len + ACE_SV_Shared_Memory::ALIGN_WORDB - 1) & ~(ACE_SV_Shared_Memory::ALIGN_WORDB - 1);
00013 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 88 of file SV_Shared_Memory.h. |
|
|
Internal identifier.
Definition at line 98 of file SV_Shared_Memory.h. |
|
|
Pointer to the beginning of the segment.
Definition at line 104 of file SV_Shared_Memory.h. Referenced by attach, get_segment_ptr, and open. |
|
|
Size of the mapped segment.
Definition at line 101 of file SV_Shared_Memory.h. Referenced by get_segment_size, and open. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002