Skip to content

Commit 605ba78

Browse files
ecnelisesThomasdezeeuw
authored andcommitted
Add AIX operating system support
1 parent 8dd37c5 commit 605ba78

File tree

6 files changed

+14
-0
lines changed

6 files changed

+14
-0
lines changed

src/sys/unix/net.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
9999
sin_addr,
100100
sin_zero: [0; 8],
101101
#[cfg(any(
102+
target_os = "aix",
102103
target_os = "dragonfly",
103104
target_os = "freebsd",
104105
target_os = "ios",
@@ -126,6 +127,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
126127
sin6_flowinfo: addr.flowinfo(),
127128
sin6_scope_id: addr.scope_id(),
128129
#[cfg(any(
130+
target_os = "aix",
129131
target_os = "dragonfly",
130132
target_os = "freebsd",
131133
target_os = "ios",

src/sys/unix/pipe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ pub fn new() -> io::Result<(Sender, Receiver)> {
191191
}
192192

193193
#[cfg(not(any(
194+
target_os = "aix",
194195
target_os = "android",
195196
target_os = "dragonfly",
196197
target_os = "freebsd",

src/sys/unix/tcp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
8282
// OSes inherit the non-blocking flag from the listener, so we just have to
8383
// set `CLOEXEC`.
8484
#[cfg(any(
85+
target_os = "aix",
8586
target_os = "ios",
8687
target_os = "macos",
8788
target_os = "redox",

src/sys/unix/uds/listener.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
4444
let mut socklen = mem::size_of_val(&sockaddr) as libc::socklen_t;
4545

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

6970
#[cfg(any(
71+
target_os = "aix",
7072
target_os = "ios",
7173
target_os = "macos",
7274
target_os = "netbsd",

src/sys/unix/uds/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ cfg_os_poll! {
7575
where T: FromRawFd,
7676
{
7777
#[cfg(not(any(
78+
target_os = "aix",
7879
target_os = "ios",
7980
target_os = "macos",
8081
target_os = "tvos",
@@ -94,6 +95,7 @@ cfg_os_poll! {
9495
// the file descriptors will leak. Creating `pair` above ensures that if
9596
// there is an error, the file descriptors are closed.
9697
#[cfg(any(
98+
target_os = "aix",
9799
target_os = "ios",
98100
target_os = "macos",
99101
target_os = "tvos",

src/sys/unix/waker.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod fdbased {
1919
use crate::sys::unix::waker::eventfd::WakerInternal;
2020
#[cfg(any(
2121
mio_unsupported_force_waker_pipe,
22+
target_os = "aix",
2223
target_os = "dragonfly",
2324
target_os = "illumos",
2425
target_os = "netbsd",
@@ -198,6 +199,7 @@ pub use self::kqueue::Waker;
198199

199200
#[cfg(any(
200201
mio_unsupported_force_waker_pipe,
202+
target_os = "aix",
201203
target_os = "dragonfly",
202204
target_os = "illumos",
203205
target_os = "netbsd",
@@ -222,7 +224,10 @@ mod pipe {
222224
impl WakerInternal {
223225
pub fn new() -> io::Result<WakerInternal> {
224226
let mut fds = [-1; 2];
227+
#[cfg(not(target_os = "aix"))]
225228
syscall!(pipe2(fds.as_mut_ptr(), libc::O_NONBLOCK | libc::O_CLOEXEC))?;
229+
#[cfg(target_os = "aix")]
230+
syscall!(pipe(fds.as_mut_ptr()))?;
226231
let sender = unsafe { File::from_raw_fd(fds[1]) };
227232
let receiver = unsafe { File::from_raw_fd(fds[0]) };
228233

@@ -278,6 +283,7 @@ mod pipe {
278283
mio_unsupported_force_poll_poll,
279284
any(
280285
mio_unsupported_force_waker_pipe,
286+
target_os = "aix",
281287
target_os = "dragonfly",
282288
target_os = "illumos",
283289
target_os = "netbsd",

0 commit comments

Comments
 (0)