quotactl syscall numbers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-07-12 10:39:43 +02:00
parent a0d68fed38
commit d0e7b466bf
3 changed files with 10 additions and 3 deletions

View File

@ -95,6 +95,7 @@ impl Client {
match syscall_nr {
Syscall::Mknod => crate::sys_mknod::mknod(msg).await,
Syscall::MknodAt => crate::sys_mknod::mknodat(msg).await,
Syscall::Quotactl => crate::sys_quotactl::quotactl(msg).await,
}
}
}

View File

@ -66,14 +66,14 @@ pub async fn q_quotaon(
special: Option<CString>,
) -> Result<SyscallStatus, Error> {
let id = msg.arg_int(2)?;
let addr = msg.arg_caddr_t(3)?;
let special = special.map(|c| c.as_ptr()).unwrap_or(ptr::null());
let addr = msg.arg_caddr_t(3)? as usize;
let special = special.map(|c| c.as_ptr()).unwrap_or(ptr::null()) as usize;
let caps = msg.pid_fd().user_caps()?;
Ok(forking_syscall(move || {
let this = PidFd::current()?;
caps.apply(&this)?;
let out = sc_libc_try!(unsafe { libc::quotactl(cmd, special, id, addr) });
let out = sc_libc_try!(unsafe { libc::quotactl(cmd, special as _, id, addr as _) });
Ok(SyscallStatus::Ok(out.into()))
})
.await?)

View File

@ -24,12 +24,14 @@ impl From<Errno> for SyscallStatus {
pub enum Syscall {
Mknod,
MknodAt,
Quotactl,
}
pub struct SyscallArch {
arch: u32,
mknod: i32,
mknodat: i32,
quotactl: i32,
}
const SYSCALL_TABLE: &'static [SyscallArch] = &[
@ -37,11 +39,13 @@ const SYSCALL_TABLE: &'static [SyscallArch] = &[
arch: AUDIT_ARCH_X86_64,
mknod: 133,
mknodat: 259,
quotactl: 179,
},
SyscallArch {
arch: AUDIT_ARCH_I386,
mknod: 14,
mknodat: 297,
quotactl: 131,
},
];
@ -57,6 +61,8 @@ pub fn translate_syscall(arch: u32, nr: c_int) -> Option<Syscall> {
return Some(Syscall::Mknod);
} else if nr == sc.mknodat {
return Some(Syscall::MknodAt);
} else if nr == sc.quotactl {
return Some(Syscall::Quotactl);
}
}
}