diff options
Diffstat (limited to 'src/sys/mman.rs')
-rw-r--r-- | src/sys/mman.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 04664fd0..0815b618 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -1,8 +1,9 @@ use {Error, Result, NixPath}; use errno::Errno; -use fcntl::{Fd, OFlag}; +use fcntl::OFlag; use libc::{c_void, size_t, off_t, mode_t}; use sys::stat::Mode; +use std::os::unix::io::RawFd; pub use self::consts::*; @@ -193,7 +194,7 @@ pub fn munlock(addr: *const c_void, length: size_t) -> Result<()> { /// Calls to mmap are inherently unsafe, so they must be made in an unsafe block. Typically /// a higher-level abstraction will hide the unsafe interactions with the mmap'd region. -pub fn mmap(addr: *mut c_void, length: size_t, prot: MmapProt, flags: MmapFlag, fd: Fd, offset: off_t) -> Result<*mut c_void> { +pub fn mmap(addr: *mut c_void, length: size_t, prot: MmapProt, flags: MmapFlag, fd: RawFd, offset: off_t) -> Result<*mut c_void> { let ret = unsafe { ffi::mmap(addr, length, prot, flags, fd, offset) }; if ret as isize == MAP_FAILED { @@ -224,7 +225,7 @@ pub fn msync(addr: *const c_void, length: size_t, flags: MmapSync) -> Result<()> } } -pub fn shm_open<P: ?Sized + NixPath>(name: &P, flag: OFlag, mode: Mode) -> Result<Fd> { +pub fn shm_open<P: ?Sized + NixPath>(name: &P, flag: OFlag, mode: Mode) -> Result<RawFd> { let ret = try!(name.with_nix_path(|cstr| { unsafe { ffi::shm_open(cstr.as_ptr(), flag.bits(), mode.bits() as mode_t) |