00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_SV_SHARED_MEMORY_H
00014 #define ACE_SV_SHARED_MEMORY_H
00015
00016 #include "ace/pre.h"
00017
00018 #include "ace/ACE_export.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif
00023
00024 #include "ace/os_include/sys/os_stat.h"
00025 #include "ace/os_include/sys/os_ipc.h"
00026 #include "ace/Default_Constants.h"
00027
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029
00030
00031
00032
00033
00034
00035 class ACE_Export ACE_SV_Shared_Memory
00036 {
00037 public:
00038 enum
00039 {
00040 ACE_CREATE = IPC_CREAT,
00041 ACE_OPEN = 0
00042 };
00043
00044
00045 ACE_SV_Shared_Memory (void);
00046 ACE_SV_Shared_Memory (key_t external_id,
00047 size_t size,
00048 int create,
00049 int perms = ACE_DEFAULT_FILE_PERMS,
00050 void *virtual_addr = 0,
00051 int flags = 0);
00052
00053 ACE_SV_Shared_Memory (ACE_HANDLE internal_id,
00054 int flags = 0);
00055
00056 int open (key_t external_id,
00057 size_t size,
00058 int create = ACE_SV_Shared_Memory::ACE_OPEN,
00059 int perms = ACE_DEFAULT_FILE_PERMS);
00060
00061 int open_and_attach (key_t external_id,
00062 size_t size,
00063 int create = ACE_SV_Shared_Memory::ACE_OPEN,
00064 int perms = ACE_DEFAULT_FILE_PERMS,
00065 void *virtual_addr = 0,
00066 int flags = 0);
00067
00068
00069 int attach (void *virtual_addr = 0,
00070 int flags =0);
00071
00072
00073 int detach (void);
00074
00075
00076 int remove (void);
00077
00078
00079 int control (int cmd, void *buf);
00080
00081
00082 void *get_segment_ptr (void) const;
00083 size_t get_segment_size (void) const;
00084
00085
00086 ACE_HANDLE get_id (void) const;
00087
00088
00089 void dump (void) const;
00090
00091
00092 ACE_ALLOC_HOOK_DECLARE;
00093
00094 protected:
00095 enum
00096 {
00097
00098 ALIGN_WORDB = 8
00099 };
00100
00101
00102 ACE_HANDLE internal_id_;
00103
00104
00105 size_t size_;
00106
00107
00108 void *segment_ptr_;
00109
00110
00111 size_t round_up (size_t len);
00112 };
00113
00114 ACE_END_VERSIONED_NAMESPACE_DECL
00115
00116 #if defined (__ACE_INLINE__)
00117 #include "ace/SV_Shared_Memory.inl"
00118 #endif
00119
00120 #include "ace/post.h"
00121
00122 #endif