diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/memfd.rs | 5 | ||||
-rw-r--r-- | src/sys/mod.rs | 3 | ||||
-rw-r--r-- | src/sys/syscall.rs | 91 |
3 files changed, 3 insertions, 96 deletions
diff --git a/src/sys/memfd.rs b/src/sys/memfd.rs index b9812943..056e9e43 100644 --- a/src/sys/memfd.rs +++ b/src/sys/memfd.rs @@ -11,8 +11,9 @@ bitflags!( ); pub fn memfd_create(name: &CStr, flags: MemFdCreateFlag) -> Result<RawFd> { - use sys::syscall::{syscall, MEMFD_CREATE}; - let res = unsafe { syscall(MEMFD_CREATE, name.as_ptr(), flags.bits()) }; + let res = unsafe { + libc::syscall(libc::SYS_memfd_create, name.as_ptr(), flags.bits()) + }; Errno::result(res).map(|r| r as RawFd) } diff --git a/src/sys/mod.rs b/src/sys/mod.rs index c73a09cd..7326a2cf 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -31,9 +31,6 @@ pub mod socket; pub mod stat; -#[cfg(any(target_os = "linux", target_os = "android"))] -pub mod syscall; - #[cfg(any(target_os = "linux"))] pub mod reboot; diff --git a/src/sys/syscall.rs b/src/sys/syscall.rs deleted file mode 100644 index 50866ca7..00000000 --- a/src/sys/syscall.rs +++ /dev/null @@ -1,91 +0,0 @@ -//! Indirect system call -//! -use libc::c_int; - -pub use self::arch::*; - -#[cfg(target_arch = "x86_64")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 155; - pub static MEMFD_CREATE: Syscall = 319; -} - -#[cfg(target_arch = "x86")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 217; - pub static MEMFD_CREATE: Syscall = 356; -} - -#[cfg(target_arch = "aarch64")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 41; - pub static MEMFD_CREATE: Syscall = 279; -} - -#[cfg(target_arch = "arm")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 218; - pub static MEMFD_CREATE: Syscall = 385; -} - -// Rust on mips uses the N32 ABI -#[cfg(target_arch = "mips")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 216; - pub static MEMFD_CREATE: Syscall = 354; -} - -// Rust on mips64 uses the N64 ABI -#[cfg(target_arch = "mips64")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 151; - pub static MEMFD_CREATE: Syscall = 314; -} - -#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 203; - pub static MEMFD_CREATE: Syscall = 360; -} - -#[cfg(target_arch = "s390x")] -mod arch { - use libc::c_long; - - pub type Syscall = c_long; - - pub static SYSPIVOTROOT: Syscall = 217; - pub static MEMFD_CREATE: Syscall = 350; -} - -extern { - pub fn syscall(num: Syscall, ...) -> c_int; -} |