diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 3 | ||||
-rw-r--r-- | src/sys/aio.rs | 18 | ||||
-rw-r--r-- | src/sys/event.rs | 4 | ||||
-rw-r--r-- | src/sys/signal.rs | 10 |
4 files changed, 17 insertions, 18 deletions
@@ -31,7 +31,6 @@ pub mod libc { pub use self::libc::*; } -pub use libc::{c_int, c_void}; pub use errno::Errno; pub mod errno; @@ -96,7 +95,7 @@ pub enum Error { /// The operation involved a conversion to Rust's native String type, which failed because the /// string did not contain all valid UTF-8. InvalidUtf8, - /// The operation is not supported by Nix, in this instance either use the libc bindings or + /// The operation is not supported by Nix, in this instance either use the libc bindings or /// consult the module documentation to see if there is a more appropriate interface available. UnsupportedOperation, } diff --git a/src/sys/aio.rs b/src/sys/aio.rs index 64aee7ca..abb742f3 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -94,7 +94,7 @@ impl<'a> AioCb<'a> { /// be prioritized at the process's priority level minus `prio` /// * `sigev_notify` Determines how you will be notified of event /// completion. - pub fn from_fd(fd: RawFd, prio: ::c_int, + pub fn from_fd(fd: RawFd, prio: libc::c_int, sigev_notify: SigevNotify) -> AioCb<'a> { let mut a = AioCb::common_init(fd, prio, sigev_notify); a.aio_offset = 0; @@ -118,13 +118,13 @@ impl<'a> AioCb<'a> { /// * `opcode` This field is only used for `lio_listio`. It determines /// which operation to use for this individual aiocb pub fn from_mut_slice(fd: RawFd, offs: off_t, buf: &'a mut [u8], - prio: ::c_int, sigev_notify: SigevNotify, + prio: libc::c_int, sigev_notify: SigevNotify, opcode: LioOpcode) -> AioCb<'a> { let mut a = AioCb::common_init(fd, prio, sigev_notify); a.aio_offset = offs; a.aio_nbytes = buf.len() as size_t; a.aio_buf = buf.as_ptr() as *mut c_void; - a.aio_lio_opcode = opcode as ::c_int; + a.aio_lio_opcode = opcode as libc::c_int; let aiocb = AioCb { aiocb: a, mutable: true, in_progress: false, keeper: Keeper::phantom(PhantomData)}; @@ -146,13 +146,13 @@ impl<'a> AioCb<'a> { /// * `opcode` This field is only used for `lio_listio`. It determines /// which operation to use for this individual aiocb pub fn from_boxed_slice(fd: RawFd, offs: off_t, buf: Rc<Box<[u8]>>, - prio: ::c_int, sigev_notify: SigevNotify, + prio: libc::c_int, sigev_notify: SigevNotify, opcode: LioOpcode) -> AioCb<'a> { let mut a = AioCb::common_init(fd, prio, sigev_notify); a.aio_offset = offs; a.aio_nbytes = buf.len() as size_t; a.aio_buf = buf.as_ptr() as *mut c_void; - a.aio_lio_opcode = opcode as ::c_int; + a.aio_lio_opcode = opcode as libc::c_int; let aiocb = AioCb{ aiocb: a, mutable: true, in_progress: false, keeper: Keeper::boxed(buf)}; @@ -173,7 +173,7 @@ impl<'a> AioCb<'a> { // AioCb, and they must all be the same type. We're basically stuck with // using an unsafe function, since aio (as designed in C) is an unsafe API. pub fn from_slice(fd: RawFd, offs: off_t, buf: &'a [u8], - prio: ::c_int, sigev_notify: SigevNotify, + prio: libc::c_int, sigev_notify: SigevNotify, opcode: LioOpcode) -> AioCb { let mut a = AioCb::common_init(fd, prio, sigev_notify); a.aio_offset = offs; @@ -183,14 +183,14 @@ impl<'a> AioCb<'a> { // it. a.aio_buf = buf.as_ptr() as *mut c_void; assert!(opcode != LioOpcode::LIO_READ, "Can't read into an immutable buffer"); - a.aio_lio_opcode = opcode as ::c_int; + a.aio_lio_opcode = opcode as libc::c_int; let aiocb = AioCb { aiocb: a, mutable: false, in_progress: false, keeper: Keeper::none}; aiocb } - fn common_init(fd: RawFd, prio: ::c_int, + fn common_init(fd: RawFd, prio: libc::c_int, sigev_notify: SigevNotify) -> libc::aiocb { // Use mem::zeroed instead of explicitly zeroing each field, because the // number and name of reserved fields is OS-dependent. On some OSes, @@ -235,7 +235,7 @@ impl<'a> AioCb<'a> { pub fn fsync(&mut self, mode: AioFsyncMode) -> Result<()> { let p: *mut libc::aiocb = &mut self.aiocb; self.in_progress = true; - Errno::result(unsafe { libc::aio_fsync(mode as ::c_int, p) }).map(drop) + Errno::result(unsafe { libc::aio_fsync(mode as libc::c_int, p) }).map(drop) } /// Asynchronously reads from a file descriptor into a buffer diff --git a/src/sys/event.rs b/src/sys/event.rs index 494c12dd..95b7619e 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -21,7 +21,7 @@ pub struct KEvent { #[cfg(any(target_os = "openbsd", target_os = "freebsd", target_os = "dragonfly", target_os = "macos", target_os = "ios"))] -type type_of_udata = *mut ::c_void; +type type_of_udata = *mut libc::c_void; #[cfg(any(target_os = "openbsd", target_os = "freebsd", target_os = "dragonfly", target_os = "macos", target_os = "ios"))] @@ -127,7 +127,7 @@ libc_bitflags!( #[cfg(any(target_os = "macos", target_os = "ios"))] NOTE_EXITSTATUS, NOTE_EXTEND, - #[cfg(any(target_os = "macos", + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 309919b7..f885af92 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -523,20 +523,20 @@ impl SigEvent { SigevNotify::SigevThreadId{..} => 4 // No SIGEV_THREAD_ID defined }; sev.sigev_signo = match sigev_notify { - SigevNotify::SigevSignal{ signal, .. } => signal as ::c_int, + SigevNotify::SigevSignal{ signal, .. } => signal as libc::c_int, #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] SigevNotify::SigevKevent{ kq, ..} => kq, #[cfg(any(target_os = "linux", target_os = "freebsd"))] - SigevNotify::SigevThreadId{ signal, .. } => signal as ::c_int, + SigevNotify::SigevThreadId{ signal, .. } => signal as libc::c_int, _ => 0 }; sev.sigev_value.sival_ptr = match sigev_notify { SigevNotify::SigevNone => ptr::null_mut::<libc::c_void>(), - SigevNotify::SigevSignal{ si_value, .. } => si_value as *mut ::c_void, + SigevNotify::SigevSignal{ si_value, .. } => si_value as *mut libc::c_void, #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] - SigevNotify::SigevKevent{ udata, .. } => udata as *mut ::c_void, + SigevNotify::SigevKevent{ udata, .. } => udata as *mut libc::c_void, #[cfg(any(target_os = "linux", target_os = "freebsd"))] - SigevNotify::SigevThreadId{ si_value, .. } => si_value as *mut ::c_void, + SigevNotify::SigevThreadId{ si_value, .. } => si_value as *mut libc::c_void, }; SigEvent::set_tid(&mut sev, &sigev_notify); SigEvent{sigevent: sev} |