19 : m_fd(fd), m_locked(false), m_start(0), m_len(0) {}
24 return DoLock([&](
const uint64_t start,
25 const uint64_t len) {
return DoWriteLock(start, len); },
30 return DoLock([&](
const uint64_t start,
36 return DoLock([&](
const uint64_t start,
37 const uint64_t len) {
return DoReadLock(start, len); },
42 return DoLock([&](
const uint64_t start,
52 if (
error.Success()) {
65 return Status(
"File is invalid");
70 const auto error = locker(start, len);
71 if (
error.Success()) {
static llvm::raw_ostream & error(Stream &strm)
static Status AlreadyLocked()
static Status NotLocked()
std::function< Status(const uint64_t, const uint64_t)> Locker
virtual bool IsValidFile() const
Status TryWriteLock(const uint64_t start, const uint64_t len)
virtual Status DoTryReadLock(const uint64_t start, const uint64_t len)=0
Status WriteLock(const uint64_t start, const uint64_t len)
Status TryReadLock(const uint64_t start, const uint64_t len)
virtual Status DoTryWriteLock(const uint64_t start, const uint64_t len)=0
Status ReadLock(const uint64_t start, const uint64_t len)
Status DoLock(const Locker &locker, const uint64_t start, const uint64_t len)
virtual Status DoUnlock()=0
virtual Status DoWriteLock(const uint64_t start, const uint64_t len)=0
virtual Status DoReadLock(const uint64_t start, const uint64_t len)=0
A class that represents a running process on the host machine.