2022-04-15 10:01:43 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
2022-12-14 05:03:37 +00:00
|
|
|
File: AuIPCMemory.Unix.hpp
|
2022-04-15 10:01:43 +00:00
|
|
|
Date: 2022-4-14
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
2022-08-02 04:52:17 +00:00
|
|
|
#include <Source/IO/IPC/IPC.hpp>
|
2022-12-16 00:41:01 +00:00
|
|
|
#include <Source/IO/IPC/AuIPCHandle.hpp>
|
2022-08-02 04:52:17 +00:00
|
|
|
|
2022-06-11 23:52:46 +00:00
|
|
|
namespace Aurora::IO::IPC
|
2022-04-15 10:01:43 +00:00
|
|
|
{
|
2022-08-02 04:52:17 +00:00
|
|
|
struct IPCSharedMemoryImpl : IPCSharedMemory
|
|
|
|
{
|
2022-12-14 05:03:37 +00:00
|
|
|
IPCSharedMemoryImpl(int fd,
|
|
|
|
void *pBase,
|
|
|
|
const IPC::IPCHandle &handle,
|
|
|
|
bool bOwns);
|
2022-08-02 04:52:17 +00:00
|
|
|
~IPCSharedMemoryImpl();
|
|
|
|
|
|
|
|
virtual Memory::MemoryViewWrite GetMemory() override;
|
|
|
|
virtual AuUInt GetLength() override;
|
|
|
|
|
|
|
|
virtual AuString ExportToString() override;
|
|
|
|
|
|
|
|
IPC::IPCHandle handle_;
|
|
|
|
private:
|
2022-12-14 05:03:37 +00:00
|
|
|
void *pBase_ {};
|
|
|
|
AuUInt uLen_ {};
|
|
|
|
int fd_ {};
|
|
|
|
bool bOwns_;
|
2022-08-02 04:52:17 +00:00
|
|
|
};
|
2022-04-15 10:01:43 +00:00
|
|
|
|
2022-08-10 11:12:36 +00:00
|
|
|
AuString GetServerPath(const IPC::IPCToken &handle);
|
2022-08-02 04:52:17 +00:00
|
|
|
AuSPtr<IPCSharedMemory> ImportSharedMemoryEx(const IPCToken &token);
|
2022-04-15 10:01:43 +00:00
|
|
|
}
|