142 bool create(
const std::string& name,
size_t size,
Mode mode = kReadWrite);
151 bool attach(
const std::string& name,
Mode mode = kReadWrite);
182 [[nodiscard]]
const void*
data()
const;
189 [[nodiscard]]
size_t size()
const;
193 std::unique_ptr<Impl> impl_;
Named cross-process shared-memory region with read-only or read-write mappings.
Definition: sys_sharemem.h:104
SysSharemem()
Constructs a wrapper in the detached state.
const void * data() const
Returns a read-only pointer to the start of the mapping.
size_t size() const
Returns the size of the mapping in bytes.
void * data()
Returns a writable pointer to the start of the mapping.
bool create(const std::string &name, size_t size, Mode mode=kReadWrite)
Creates and maps a new shared-memory region of size bytes under name.
~SysSharemem()
Destructor. Invokes detach(false) when the wrapper is still attached.
Mode
Access mode applied to the mapping.
Definition: sys_sharemem.h:115
bool attach(const std::string &name, Mode mode=kReadWrite)
Attaches to an existing shared-memory region previously created with the same name.
bool detach(bool force=true)
Unmaps the region and optionally unlinks the kernel name.
bool is_attached() const
Reports whether the wrapper currently owns a mapping.
Cross-platform macros for visibility, branch hints, copy prevention, singletons and string helpers.
#define VLINK_EXPORT
Definition: macros.h:81
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition: macros.h:174