The Pedigree Project
0.1
src
modules
subsys
posix
PosixMemoryLockAccount.h
1
/*
2
* Copyright (c) 2026, Pedigree Developers
3
*
4
* Permission to use, copy, modify, and distribute this software for any
5
* purpose with or without fee is hereby granted.
6
*/
7
8
#ifndef PEDIGREE_POSIX_MEMORY_LOCK_ACCOUNT_H
9
#define PEDIGREE_POSIX_MEMORY_LOCK_ACCOUNT_H
10
11
#include "pedigree/kernel/processor/UserMemoryPolicy.h"
12
13
#include "linux-resource-abi.h"
14
15
class
EXPORTED_PUBLIC
PosixMemoryLockAccount
final :
public
MemoryLockAccount
{
16
public
:
17
enum class
LimitStatus { Success, Invalid, PermissionDenied };
18
19
PosixMemoryLockAccount
() =
default
;
20
PosixMemoryLockAccount
(
const
PosixMemoryLockAccount
& parent);
21
22
bool
permitsTotalPages(
size_t
total,
bool
privileged)
const override
;
23
bool
permitsLocking(
bool
privileged)
const override
{
24
return
privileged || m_Limit.current != 0;
25
}
26
27
// Limit mutation and mapping admission share the manager operation gate.
28
LinuxRlimit64
limit()
const
{
29
return
m_Limit;
30
}
31
LimitStatus setLimit(
const
LinuxRlimit64
& limit,
bool
privileged);
32
33
private
:
34
PosixMemoryLockAccount
& operator=(
const
PosixMemoryLockAccount
&) =
delete
;
35
LinuxRlimit64
m_Limit{1ULL << 24, 1ULL << 24};
36
};
37
38
#endif
MemoryLockAccount
Definition
UserMemoryPolicy.h:39
PosixMemoryLockAccount
Definition
PosixMemoryLockAccount.h:15
LinuxRlimit64
Definition
linux-resource-abi.h:14
Generated on Thu Sep 24 2026 06:23:59 for The Pedigree Project by
1.9.8