xref: /third_party/rust/crates/rustix/src/io/mod.rs (revision b8a62b91)
1//! I/O operations.
2
3mod close;
4#[cfg(any(target_os = "android", target_os = "linux"))]
5pub(crate) mod context;
6#[cfg(not(windows))]
7mod dup;
8mod errno;
9#[cfg(any(target_os = "android", target_os = "linux"))]
10mod eventfd;
11#[cfg(not(windows))]
12mod fcntl;
13#[cfg(not(feature = "std"))]
14pub(crate) mod fd;
15mod ioctl;
16#[cfg(not(any(windows, target_os = "redox")))]
17mod is_read_write;
18#[cfg(not(any(windows, target_os = "wasi")))]
19mod pipe;
20mod poll;
21#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
22mod procfs;
23#[cfg(not(windows))]
24mod read_write;
25#[cfg(not(feature = "std"))]
26mod seek_from;
27#[cfg(not(windows))]
28mod stdio;
29
30#[cfg(any(target_os = "android", target_os = "linux"))]
31pub use crate::backend::io::epoll;
32pub use close::close;
33#[cfg(not(any(windows, target_os = "aix", target_os = "wasi")))]
34pub use dup::{dup, dup2, dup3, DupFlags};
35pub use errno::{retry_on_intr, Errno, Result};
36#[cfg(any(target_os = "android", target_os = "linux"))]
37pub use eventfd::{eventfd, EventfdFlags};
38#[cfg(not(any(windows, target_os = "wasi")))]
39pub use fcntl::fcntl_dupfd_cloexec;
40#[cfg(not(windows))]
41pub use fcntl::{fcntl_getfd, fcntl_setfd, FdFlags};
42#[cfg(any(target_os = "ios", target_os = "macos"))]
43pub use ioctl::ioctl_fioclex;
44pub use ioctl::ioctl_fionbio;
45#[cfg(not(target_os = "redox"))]
46pub use ioctl::ioctl_fionread;
47#[cfg(any(target_os = "android", target_os = "linux"))]
48pub use ioctl::{ioctl_blkpbszget, ioctl_blksszget};
49#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
50pub use ioctl::{ioctl_tiocexcl, ioctl_tiocnxcl};
51#[cfg(not(any(windows, target_os = "redox")))]
52#[cfg(all(feature = "fs", feature = "net"))]
53pub use is_read_write::is_read_write;
54#[cfg(not(any(windows, target_os = "wasi")))]
55pub use pipe::pipe;
56#[cfg(not(any(
57    windows,
58    target_os = "haiku",
59    target_os = "illumos",
60    target_os = "redox",
61    target_os = "solaris",
62    target_os = "wasi",
63)))]
64pub use pipe::PIPE_BUF;
65#[cfg(not(any(
66    windows,
67    target_os = "aix",
68    target_os = "haiku",
69    target_os = "ios",
70    target_os = "macos",
71    target_os = "wasi"
72)))]
73pub use pipe::{pipe_with, PipeFlags};
74#[cfg(any(target_os = "android", target_os = "linux"))]
75pub use pipe::{splice, vmsplice, IoSliceRaw, SpliceFlags};
76pub use poll::{poll, PollFd, PollFlags};
77#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
78pub use procfs::{
79    proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap, proc_self_status,
80};
81#[cfg(not(windows))]
82pub use read_write::{pread, pwrite, read, readv, write, writev, IoSlice, IoSliceMut};
83#[cfg(not(any(
84    windows,
85    target_os = "haiku",
86    target_os = "redox",
87    target_os = "solaris"
88)))]
89pub use read_write::{preadv, pwritev};
90#[cfg(any(target_os = "android", target_os = "linux"))]
91pub use read_write::{preadv2, pwritev2, ReadWriteFlags};
92#[cfg(not(feature = "std"))]
93pub use seek_from::SeekFrom;
94#[cfg(feature = "std")]
95pub use std::io::SeekFrom;
96#[cfg(not(windows))]
97pub use stdio::{
98    raw_stderr, raw_stdin, raw_stdout, stderr, stdin, stdout, take_stderr, take_stdin, take_stdout,
99};
100