00001
00002
00003 #include "ace/SV_Shared_Memory.h"
00004 #include "ace/Log_Msg.h"
00005
00006 #if !defined (__ACE_INLINE__)
00007 #include "ace/SV_Shared_Memory.inl"
00008 #endif
00009
00010 ACE_RCSID(ace, SV_Shared_Memory, "SV_Shared_Memory.cpp,v 4.11 2005/10/28 16:14:55 ossama Exp")
00011
00012 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00013
00014 ACE_ALLOC_HOOK_DEFINE(ACE_SV_Shared_Memory)
00015
00016 void
00017 ACE_SV_Shared_Memory::dump (void) const
00018 {
00019 #if defined (ACE_HAS_DUMP)
00020 ACE_TRACE ("ACE_SV_Shared_Memory::dump");
00021 #endif
00022 }
00023
00024
00025
00026
00027 int
00028 ACE_SV_Shared_Memory::open_and_attach (key_t external_id,
00029 size_t sz,
00030 int create,
00031 int perms,
00032 void *virtual_addr,
00033 int flags)
00034 {
00035 ACE_TRACE ("ACE_SV_Shared_Memory::open_and_attach");
00036 if (this->open (external_id, sz, create, perms) == -1)
00037 return -1;
00038 else if (this->attach (virtual_addr, flags) == -1)
00039 return -1;
00040 else
00041 return 0;
00042 }
00043
00044
00045
00046 ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (key_t external_id,
00047 size_t sz,
00048 int create,
00049 int perms,
00050 void *virtual_addr,
00051 int flags)
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 }
00059
00060
00061
00062 ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (void)
00063 : internal_id_ (0),
00064 size_ (0),
00065 segment_ptr_ (0)
00066 {
00067 ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory");
00068 }
00069
00070
00071
00072
00073
00074
00075
00076
00077 ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (ACE_HANDLE int_id,
00078 int flags)
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 }
00087
00088 ACE_END_VERSIONED_NAMESPACE_DECL