#![forbid(unsafe_code)]
use libseccomp::ScmpNotifResp;
use nix::errno::Errno;
use crate::{confine::is_valid_ptr, req::UNotifyEventRequest, sysinfo::SysInfo};
pub(crate) fn sys_sysinfo(request: UNotifyEventRequest) -> ScmpNotifResp {
syscall_handler!(request, |request: UNotifyEventRequest| {
let req = request.scmpreq;
if !is_valid_ptr(req.data.args[0], req.data.arch) {
return Err(Errno::EFAULT);
}
let info = SysInfo::new(req.data.arch)?;
request.write_mem_all(info.as_bytes(), req.data.args[0])?;
Ok(request.return_syscall(0))
})
}