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_auto_cfg))]
23
24/// Access to the "poll" system call.
25pub mod poll;
26
27/// Types for representing system call results and errors.
28pub mod result;
29
30/// Types for use with "seek" operations.
31pub mod seek;
32
33/// The main `File` type and its supporting utilities for working safely with file descriptors.
34pub mod fd;
35pub use fd::{File, OpenOptions, OPEN_READ_ONLY, OPEN_READ_WRITE, OPEN_WRITE_ONLY};
36
37/// For interacting with tty devices.
38pub mod tty;
39
40/// Socket address manipulation, socket device ioctls, etc.
41pub mod socket;
42
43/// Synchronization primitives built using Linux kernel features.
44pub mod sync;
45
46/// For safely representing pointers in `ioctl` request types, and similar.
47pub mod ptr;
48
49#[cfg(test)]
50mod tests;