AuroraRuntime/Source/Process/AuProcessSectionFileMapView.Unix.hpp

46 lines
1.2 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuProcessSectionFileMapView.Unix.hpp
Date: 2022-08-09
Author: Reece
***/
#pragma once
namespace Aurora::Process
{
struct ProcessSectionView;
struct ProcessSectionFileMapView : IProcessSectionMapView
{
ProcessSectionFileMapView(AuUInt uAddress, AuUInt uLength, bool bShouldUnmap, int optFd = -1);
virtual ~ProcessSectionFileMapView();
void Unmap() override;
bool Flush(AuUInt uOffset, AuUInt uLength) override;
AuUInt GetBaseAddress() override;
AuUInt GetAddress(AuUInt uOffset) override;
AuUInt8 *GetBasePointer() override;
AuUInt8 *GetPointer(AuUInt uOffset) override;
Memory::MemoryViewWrite ToWriteView() override;
Memory::MemoryViewRead ToReadView() override;
AuSPtr<IProcessSectionView> pSharedSectionHint {};
bool LockSwap() override;
bool UnlockSwap() override;
private:
AuUInt uAddress_ {};
AuUInt uLength_ {};
AuMutex mutex_;
AuAUInt32 uInUse_ {};
bool bShouldUnmap_ {};
int optFd_ {-1};
bool bIsDead_ {};
};
}