gnuace: use list of generated files from GENERATED_DIRTY for ADDITIONAL_IDL_TARGETS
[ACE_TAO.git] / ACE / ace / Shared_Memory_MM.cpp
blobc465fe0b163a059c29824ce0f9c5ae4c09e1c1b2
1 #include "ace/Shared_Memory_MM.h"
3 #if defined (ACE_HAS_ALLOC_HOOKS)
4 # include "ace/Malloc_Base.h"
5 #endif /* ACE_HAS_ALLOC_HOOKS */
7 #if !defined (__ACE_INLINE__)
8 #include "ace/Shared_Memory_MM.inl"
9 #endif /* __ACE_INLINE__ */
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_MM)
15 void
16 ACE_Shared_Memory_MM::dump (void) const
18 #if defined (ACE_HAS_DUMP)
19 ACE_TRACE ("ACE_Shared_Memory_MM::dump");
20 #endif /* ACE_HAS_DUMP */
23 // Creates a shared memory segment of SIZE bytes.
25 ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (ACE_HANDLE handle,
26 size_t length,
27 int prot,
28 int share,
29 char *addr,
30 ACE_OFF_T pos)
31 : shared_memory_ (handle, length, prot, share, addr, pos)
33 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
36 ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
37 size_t len,
38 int flags,
39 int mode,
40 int prot,
41 int share,
42 char *addr,
43 ACE_OFF_T pos)
44 : shared_memory_ (file_name, len, flags, mode,
45 prot, share, addr, pos)
47 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
50 // The "do-nothing" constructor.
52 ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (void)
54 ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM");
57 // The overall size of the segment.
59 size_t
60 ACE_Shared_Memory_MM::get_segment_size (void) const
62 ACE_TRACE ("ACE_Shared_Memory_MM::get_segment_size");
63 // This cast is legit since the original length in open() is an int.
64 return this->shared_memory_.size ();
67 // Unmaps the shared memory segment.
69 int
70 ACE_Shared_Memory_MM::remove (void)
72 ACE_TRACE ("ACE_Shared_Memory_MM::remove");
73 return shared_memory_.remove ();
76 // Closes (unmaps) the shared memory segment.
78 int
79 ACE_Shared_Memory_MM::close (void)
81 ACE_TRACE ("ACE_Shared_Memory_MM::close");
82 return shared_memory_.unmap ();
85 void *
86 ACE_Shared_Memory_MM::malloc (size_t)
88 ACE_TRACE ("ACE_Shared_Memory_MM::malloc");
89 void *addr = 0;
91 return this->shared_memory_ (addr) == -1 ? 0 : addr;
94 ACE_HANDLE
95 ACE_Shared_Memory_MM::get_id (void) const
97 ACE_TRACE ("ACE_Shared_Memory_MM::get_id");
98 return this->shared_memory_.handle ();
102 ACE_Shared_Memory_MM::free (void *p)
104 ACE_TRACE ("ACE_Shared_Memory_MM::free");
105 return p != 0;
108 ACE_END_VERSIONED_NAMESPACE_DECL