Skip to content

Commit

Permalink
Portability fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed May 7, 2022
1 parent 6b527db commit df44b5d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/sys/aio.rs
Expand Up @@ -30,14 +30,15 @@ use pin_utils::unsafe_pinned;
use std::{
convert::TryFrom,
fmt::{self, Debug},
io::{IoSlice, IoSliceMut},
marker::{PhantomData, PhantomPinned},
mem,
os::unix::io::RawFd,
pin::Pin,
ptr,
thread
};
#[cfg(target_os = "freebsd")]
use std::io::{IoSlice, IoSliceMut};
use crate::sys::signal::*;
use crate::sys::time::TimeSpec;

Expand Down Expand Up @@ -1185,16 +1186,24 @@ mod t {
assert_eq!(aior.as_ref() as *const libc::aiocb,
&aior as *const AioRead as *const libc::aiocb);

let wbuf = [];
let aiow = AioWrite::new(666, 0, &wbuf, 0, sev);
assert_eq!(aiow.as_ref() as *const libc::aiocb,
&aiow as *const AioWrite as *const libc::aiocb);
}

#[cfg(target_os = "freebsd")]
#[test]
fn casting_vectored() {
let sev = SigevNotify::SigevNone;

let mut rbuf = [];
let mut rbufs = [IoSliceMut::new(&mut rbuf)];
let aiorv = AioReadv::new(666, 0, &mut rbufs[..], 0, sev);
assert_eq!(aiorv.as_ref() as *const libc::aiocb,
&aiorv as *const AioReadv as *const libc::aiocb);

let wbuf = [];
let aiow = AioWrite::new(666, 0, &wbuf, 0, sev);
assert_eq!(aiow.as_ref() as *const libc::aiocb,
&aiow as *const AioWrite as *const libc::aiocb);

let wbufs = [IoSlice::new(&wbuf)];
let aiowv = AioWritev::new(666, 0, &wbufs, 0, sev);
assert_eq!(aiowv.as_ref() as *const libc::aiocb,
Expand Down

0 comments on commit df44b5d

Please sign in to comment.