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 17, 2024
1 parent 0c02b15 commit 2b07381
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 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 @@ -916,7 +929,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 +973,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_RD | Sysctl::CTLFLAG_WR | 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), // TODO: use a proper value
};

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 2b07381

Please sign in to comment.