linux_io/lib.rs
1//! Lightweight but safe abstractions around Linux system calls related to
2//! file descriptors.
3//!
4//! This goal of this crate is to expose a convenient API while skipping any
5//! unnecessary abstraction. In most cases calls to functions in this crate
6//! should reduce to inline system calls and some minimal argument and result
7//! conversion code, and the results should be generally unsurprising to anyone
8//! who is familiar with the underlying system call behavior.
9//!
10//! The functions in this crate wrap functions in crate [`linux_unsafe`] to
11//! actually make the system calls, and so the platform support for this
12//! crate is limited to what that other crate supports.
13//!
14//! Implements standard library I/O traits by default, but can be made friendly
15//! to `no_std` environments by disabling the default feature `std`.
16//!
17//! The initial versions of this crate are focused only on basic file
18//! operations, until the API for that feels settled. In later releases the
19//! scope will hopefully increase to cover most or all of the system calls
20//! that work with file descriptors.
21#![no_std]
22#![cfg_attr(docsrs, feature(doc_cfg))]
23#![cfg_attr(docsrs, doc(auto_cfg))]
24
25/// Access to the "poll" system call.
26pub mod poll;
27
28/// Types for representing system call results and errors.
29pub mod result;
30
31/// Types for use with "seek" operations.
32pub mod seek;
33
34/// The main `File` type and its supporting utilities for working safely with file descriptors.
35pub mod fd;
36pub use fd::{File, OpenOptions, OPEN_READ_ONLY, OPEN_READ_WRITE, OPEN_WRITE_ONLY};
37
38/// For interacting with tty devices.
39pub mod tty;
40
41/// Socket address manipulation, socket device ioctls, etc.
42pub mod socket;
43
44/// Synchronization primitives built using Linux kernel features.
45pub mod sync;
46
47/// For safely representing pointers in `ioctl` request types, and similar.
48pub mod ptr;
49
50#[cfg(test)]
51mod tests;