Skip to content

Commit

Permalink
vm.budgets.mlock_avail name2oid
Browse files Browse the repository at this point in the history
  • Loading branch information
mikusp committed Feb 18, 2024
1 parent 58ece47 commit e37a45c
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion src/kernel/src/sysctl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ impl Sysctl {
pub const VM_PS4DEV_TRCMEM_TOTAL: i32 = 571;
pub const VM_PS4DEV_TRCMEM_AVAIL: i32 = 572;

pub const VM_BUDGETS: i32 = 313;
pub const VM_BUDGETS_MLOCK_AVAIL: i32 = 314;

pub const HW_PAGESIZE: i32 = 7;

pub fn new(mm: &Arc<MemoryManager>, machdep: &Arc<MachDep>, sys: &mut Syscalls) -> Arc<Self> {
Expand Down Expand Up @@ -439,6 +442,16 @@ impl Sysctl {
todo!()
}

fn budgets_mlock_avail(
&self,
_: &'static Oid,
_: &Arg,
_: usize,
_req: &mut SysctlReq,
) -> Result<(), SysErr> {
todo!()
}

fn machdep_tsc_freq(
&self,
oid: &'static Oid,
Expand Down Expand Up @@ -630,6 +643,8 @@ type Handler = fn(&Sysctl, &'static Oid, &Arg, usize, &mut SysctlReq) -> Result<
// └─── ...
// └─── (2.1.571) VM_PS4DEV_TRCMEM_TOTAL
// └─── (2.1.572) VM_PS4DEV_TRCMEM_AVAIL
// └─── (2.313) VM_BUDGETS
// └─── (2.313.314) VM_BUDGETS_MLOCK_AVAIL
// └─── ...
// └─── (3) VFS
// └─── ...
Expand Down Expand Up @@ -916,7 +931,7 @@ static VM_CHILDREN: OidList = OidList {

static VM_PS4DEV: Oid = Oid {
parent: &VM_CHILDREN,
link: None, // TODO: Change to a proper value.
link: Some(&VM_BUDGETS), // TODO: Change to a proper value.
number: Sysctl::VM_PS4DEV,
kind: Sysctl::CTLFLAG_RD | Sysctl::CTLTYPE_NODE,
arg1: Some(&VM_PS4DEV_CHILDREN),
Expand Down Expand Up @@ -960,6 +975,38 @@ static VM_PS4DEV_TRCMEM_AVAIL: Oid = Oid {
enabled: true,
};

static VM_BUDGETS: Oid = Oid {
parent: &VM_CHILDREN,
link: None, // TODO: Change to a proper value.
number: Sysctl::VM_BUDGETS,
kind: Sysctl::CTLFLAG_RW | Sysctl::CTLTYPE_NODE,
arg1: Some(&VM_BUDGETS_CHILDREN),
arg2: 0,
name: "budgets",
handler: None,
fmt: "N",
descr: "VM budgets",
enabled: true,
};

static VM_BUDGETS_CHILDREN: OidList = OidList {
first: Some(&VM_BUDGETS_MLOCK_AVAIL),
};

static VM_BUDGETS_MLOCK_AVAIL: Oid = Oid {
parent: &VM_BUDGETS_CHILDREN,
link: None,
number: Sysctl::VM_BUDGETS_MLOCK_AVAIL,
kind: Sysctl::CTLFLAG_RD | Sysctl::CTLTYPE_ULONG,
arg1: None,
arg2: 0,
name: "mlock_avail",
handler: Some(Sysctl::budgets_mlock_avail),
fmt: "L",
descr: "Available MLOCK budget",
enabled: true,
};

static HW: Oid = Oid {
parent: &CHILDREN,
link: Some(&MACHDEP),
Expand Down

0 comments on commit e37a45c

Please sign in to comment.