diff options
author | Bryant Mairs <bryant@mai.rs> | 2017-07-11 22:09:26 -0700 |
---|---|---|
committer | Marcin Mielniczuk <marmistrz.dev@zoho.eu> | 2017-07-25 09:09:52 +0200 |
commit | e4a1851ad9aae66246dfceb43e3f20127322879d (patch) | |
tree | 8fdb0d580f8c03960b6aaa2f9818571c0f2ec454 /src/sys | |
parent | 82e0139bedfd6f13dd8cd501148ea09619b1d91b (diff) | |
download | nix-e4a1851ad9aae66246dfceb43e3f20127322879d.zip |
Remove c_int and c_void from root
These were exported for some weird reason and then left in
for documentation. Also some parts of certain modules used
them and others used the libc:: prefix. This was removed to
improve the docs and also code consistency
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/aio.rs | 18 | ||||
-rw-r--r-- | src/sys/event.rs | 4 | ||||
-rw-r--r-- | src/sys/signal.rs | 10 |
3 files changed, 16 insertions, 16 deletions
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} |