You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
//! Types for, and operations on file descriptors. Useful for mapping
|
|
use super::*;
|
|
|
|
/// Raw file-descriptor for standard input
|
|
pub const STDIN_FILENO: RawFd = libc::STDIN_FILENO;
|
|
/// Raw file-descriptor for standard output
|
|
pub const STDOUT_FILENO: RawFd = libc::STDOUT_FILENO;
|
|
/// Raw file-descriptor for standard error
|
|
pub const STDERR_FILENO: RawFd = libc::STDERR_FILENO;
|
|
|
|
mod raw;
|
|
use raw::*;
|
|
|
|
mod managed;
|
|
mod unmanaged;
|
|
|
|
pub use self::{
|
|
managed::*,
|
|
unmanaged::*,
|
|
};
|
|
|
|
pub mod memory;
|
|
|
|
#[cfg(test)]
|
|
mod tests
|
|
{
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn std_in_out_err_fileno()
|
|
{
|
|
#[inline(always)]
|
|
fn test_fileno<const EXPECTED: RawFd>(expected_name: &'static str, got: RawFd)
|
|
{
|
|
assert_eq!(EXPECTED, got, "{expected_name} invalid: expected: {EXPECTED}, got {got}");
|
|
}
|
|
|
|
test_fileno::<STDIN_FILENO>("STDIN_FILENO", std::io::stdin().as_raw_fd());
|
|
test_fileno::<STDOUT_FILENO>("STDOUT_FILENO", std::io::stdout().as_raw_fd());
|
|
test_fileno::<STDERR_FILENO>("STDERR_FILENO", std::io::stderr().as_raw_fd());
|
|
}
|
|
}
|