Skip to content

Commit 6b705b3

Browse files
net: allow pipe::OpenOptions::read_write on Android (#7426)
1 parent 3636fd0 commit 6b705b3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tokio/src/net/unix/pipe.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn pipe() -> io::Result<(Sender, Receiver)> {
120120
/// ```
121121
#[derive(Clone, Debug)]
122122
pub struct OpenOptions {
123-
#[cfg(target_os = "linux")]
123+
#[cfg(any(target_os = "linux", target_os = "android"))]
124124
read_write: bool,
125125
unchecked: bool,
126126
}
@@ -131,7 +131,7 @@ impl OpenOptions {
131131
/// All options are initially set to `false`.
132132
pub fn new() -> OpenOptions {
133133
OpenOptions {
134-
#[cfg(target_os = "linux")]
134+
#[cfg(any(target_os = "linux", target_os = "android"))]
135135
read_write: false,
136136
unchecked: false,
137137
}
@@ -168,8 +168,8 @@ impl OpenOptions {
168168
/// .read_write(true)
169169
/// .open_receiver("path/to/a/fifo");
170170
/// ```
171-
#[cfg(target_os = "linux")]
172-
#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
171+
#[cfg(any(target_os = "linux", target_os = "android"))]
172+
#[cfg_attr(docsrs, doc(cfg(any(target_os = "linux", target_os = "android"))))]
173173
pub fn read_write(&mut self, value: bool) -> &mut Self {
174174
self.read_write = value;
175175
self
@@ -264,7 +264,7 @@ impl OpenOptions {
264264
.write(pipe_end == PipeEnd::Sender)
265265
.custom_flags(libc::O_NONBLOCK);
266266

267-
#[cfg(target_os = "linux")]
267+
#[cfg(any(target_os = "linux", target_os = "android"))]
268268
if self.read_write {
269269
options.read(true).write(true);
270270
}

tokio/tests/net_unix_pipe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async fn fifo_simple_send() -> io::Result<()> {
6868
}
6969

7070
#[tokio::test]
71-
#[cfg(target_os = "linux")]
71+
#[cfg(any(target_os = "linux", target_os = "android"))]
7272
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
7373
async fn fifo_simple_send_sender_first() -> io::Result<()> {
7474
const DATA: &[u8] = b"this is some data to write to the fifo";
@@ -134,7 +134,7 @@ async fn fifo_multiple_writes() -> io::Result<()> {
134134
/// Checks behavior of a resilient reader (Receiver in O_RDWR access mode)
135135
/// with writers sequentially opening and closing a FIFO.
136136
#[tokio::test]
137-
#[cfg(target_os = "linux")]
137+
#[cfg(any(target_os = "linux", target_os = "android"))]
138138
#[cfg_attr(miri, ignore)] // No `socket` in miri.
139139
async fn fifo_resilient_reader() -> io::Result<()> {
140140
const DATA: &[u8] = b"this is some data to write to the fifo";

0 commit comments

Comments
 (0)