Skip to content

Commit

Permalink
Add AIX operating system support
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnelises authored and Thomasdezeeuw committed Aug 21, 2023
1 parent 8dd37c5 commit 605ba78
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sys/unix/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
sin_addr,
sin_zero: [0; 8],
#[cfg(any(
target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
Expand Down Expand Up @@ -126,6 +127,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
sin6_flowinfo: addr.flowinfo(),
sin6_scope_id: addr.scope_id(),
#[cfg(any(
target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
Expand Down
1 change: 1 addition & 0 deletions src/sys/unix/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ pub fn new() -> io::Result<(Sender, Receiver)> {
}

#[cfg(not(any(
target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
Expand Down
1 change: 1 addition & 0 deletions src/sys/unix/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
// OSes inherit the non-blocking flag from the listener, so we just have to
// set `CLOEXEC`.
#[cfg(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "redox",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/uds/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
let mut socklen = mem::size_of_val(&sockaddr) as libc::socklen_t;

#[cfg(not(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand All @@ -67,6 +68,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
};

#[cfg(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/uds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cfg_os_poll! {
where T: FromRawFd,
{
#[cfg(not(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
Expand All @@ -94,6 +95,7 @@ cfg_os_poll! {
// the file descriptors will leak. Creating `pair` above ensures that if
// there is an error, the file descriptors are closed.
#[cfg(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
Expand Down
6 changes: 6 additions & 0 deletions src/sys/unix/waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod fdbased {
use crate::sys::unix::waker::eventfd::WakerInternal;
#[cfg(any(
mio_unsupported_force_waker_pipe,
target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
Expand Down Expand Up @@ -198,6 +199,7 @@ pub use self::kqueue::Waker;

#[cfg(any(
mio_unsupported_force_waker_pipe,
target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
Expand All @@ -222,7 +224,10 @@ mod pipe {
impl WakerInternal {
pub fn new() -> io::Result<WakerInternal> {
let mut fds = [-1; 2];
#[cfg(not(target_os = "aix"))]
syscall!(pipe2(fds.as_mut_ptr(), libc::O_NONBLOCK | libc::O_CLOEXEC))?;
#[cfg(target_os = "aix")]
syscall!(pipe(fds.as_mut_ptr()))?;
let sender = unsafe { File::from_raw_fd(fds[1]) };
let receiver = unsafe { File::from_raw_fd(fds[0]) };

Expand Down Expand Up @@ -278,6 +283,7 @@ mod pipe {
mio_unsupported_force_poll_poll,
any(
mio_unsupported_force_waker_pipe,
target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
Expand Down

0 comments on commit 605ba78

Please sign in to comment.