(
&self,
func_code: FunctionCode,
addr: u64,
length: u64,
arg: u64,
)
| 505 | } |
| 506 | |
| 507 | fn process_request( |
| 508 | &self, |
| 509 | func_code: FunctionCode, |
| 510 | addr: u64, |
| 511 | length: u64, |
| 512 | arg: u64, |
| 513 | ) -> Result<PvmemcontrolResp, Error> { |
| 514 | let result = match func_code { |
| 515 | FunctionCode::Info => { |
| 516 | return Ok(PvmemcontrolResp { |
| 517 | ret_errno: 0.into(), |
| 518 | ret_code: 0.into(), |
| 519 | ret_value: get_page_size().into(), |
| 520 | arg0: MAJOR_VERSION.into(), |
| 521 | arg1: MINOR_VERSION.into(), |
| 522 | }); |
| 523 | } |
| 524 | FunctionCode::Dontneed => self.madvise(addr, length, libc::MADV_DONTNEED), |
| 525 | FunctionCode::Remove => self.madvise(addr, length, libc::MADV_REMOVE), |
| 526 | FunctionCode::Free => self.madvise(addr, length, libc::MADV_FREE), |
| 527 | FunctionCode::Pageout => self.madvise(addr, length, libc::MADV_PAGEOUT), |
| 528 | FunctionCode::Dontdump => self.madvise(addr, length, libc::MADV_DONTDUMP), |
| 529 | FunctionCode::SetVMAAnonName => self.set_vma_anon_name(addr, length, arg), |
| 530 | FunctionCode::Mlock => self.mlock(addr, length, false), |
| 531 | FunctionCode::Munlock => self.munlock(addr, length), |
| 532 | FunctionCode::MprotectNone => self.mprotect(addr, length, libc::PROT_NONE), |
| 533 | FunctionCode::MprotectR => self.mprotect(addr, length, libc::PROT_READ), |
| 534 | FunctionCode::MprotectW => self.mprotect(addr, length, libc::PROT_WRITE), |
| 535 | FunctionCode::MprotectRW => { |
| 536 | self.mprotect(addr, length, libc::PROT_READ | libc::PROT_WRITE) |
| 537 | } |
| 538 | FunctionCode::Mergeable => self.madvise(addr, length, libc::MADV_MERGEABLE), |
| 539 | FunctionCode::Unmergeable => self.madvise(addr, length, libc::MADV_UNMERGEABLE), |
| 540 | }; |
| 541 | result.map(|_| PvmemcontrolResp::default()) |
| 542 | } |
| 543 | |
| 544 | fn handle_request( |
| 545 | &self, |
no test coverage detected