Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AIX operating system support #1704

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -35,6 +35,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 @@ -58,6 +59,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 @@ -78,6 +78,7 @@ cfg_os_poll! {
where T: FromRawFd,
{
#[cfg(not(any(
target_os = "aix",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
Expand All @@ -97,6 +98,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()))?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need to set the libc::O_NONBLOCK | libc::O_CLOEXEC otherwise this will not work.

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