//! Adapt the Linux API to resemble a POSIX-style libc API. //! //! The linux_raw backend doesn't use actual libc; this just defines certain //! types that are convenient to have defined.
pub(crate) type size_t = usize; pub(crate) use linux_raw_sys::ctypes::*; pub(crate) use linux_raw_sys::errno::EINVAL; pub(crate) use linux_raw_sys::ioctl::{FIONBIO, FIONREAD}; // Import the kernel's `uid_t` and `gid_t` if they're 32-bit. #[cfg(not(any(target_arch = "arm", target_arch = "sparc", target_arch = "x86")))] pub(crate) use linux_raw_sys::general::{__kernel_gid_t as gid_t, __kernel_uid_t as uid_t}; pub(crate) use linux_raw_sys::general::{
__kernel_pid_t as pid_t, __kernel_time64_t as time_t, __kernel_timespec as timespec, iovec,
O_CLOEXEC, O_NOCTTY, O_NONBLOCK, O_RDWR,
};
#[cfg(feature = "event")] #[cfg(test)] pub(crate) use linux_raw_sys::general::epoll_event;
// On MIPS, `TCSANOW` et al have `TCSETS` added to them, so we need it to // subtract it out. #[cfg(all(
feature = "termios",
any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"
)
))] pub(crate) use linux_raw_sys::ioctl::TCSETS;
// Define our own `uid_t` and `gid_t` if the kernel's versions are not 32-bit. #[cfg(any(target_arch = "arm", target_arch = "sparc", target_arch = "x86"))] pub(crate) type uid_t = u32; #[cfg(any(target_arch = "arm", target_arch = "sparc", target_arch = "x86"))] pub(crate) type gid_t = u32;
// Bindgen infers `u32` for many of these macro types which meant to be // used with `c_int` in the C APIs, so cast them to `c_int`.
// Convert the signal constants from `u32` to `c_int`. pub(crate) const SIGHUP: c_int = linux_raw_sys::general::SIGHUP as _; pub(crate) const SIGINT: c_int = linux_raw_sys::general::SIGINT as _; pub(crate) const SIGQUIT: c_int = linux_raw_sys::general::SIGQUIT as _; pub(crate) const SIGILL: c_int = linux_raw_sys::general::SIGILL as _; pub(crate) const SIGTRAP: c_int = linux_raw_sys::general::SIGTRAP as _; pub(crate) const SIGABRT: c_int = linux_raw_sys::general::SIGABRT as _; pub(crate) const SIGBUS: c_int = linux_raw_sys::general::SIGBUS as _; pub(crate) const SIGFPE: c_int = linux_raw_sys::general::SIGFPE as _; pub(crate) const SIGKILL: c_int = linux_raw_sys::general::SIGKILL as _; pub(crate) const SIGUSR1: c_int = linux_raw_sys::general::SIGUSR1 as _; pub(crate) const SIGSEGV: c_int = linux_raw_sys::general::SIGSEGV as _; pub(crate) const SIGUSR2: c_int = linux_raw_sys::general::SIGUSR2 as _; pub(crate) const SIGPIPE: c_int = linux_raw_sys::general::SIGPIPE as _; pub(crate) const SIGALRM: c_int = linux_raw_sys::general::SIGALRM as _; pub(crate) const SIGTERM: c_int = linux_raw_sys::general::SIGTERM as _; #[cfg(not(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc",
target_arch = "sparc64"
)))] pub(crate) const SIGSTKFLT: c_int = linux_raw_sys::general::SIGSTKFLT as _; pub(crate) const SIGCHLD: c_int = linux_raw_sys::general::SIGCHLD as _; pub(crate) const SIGCONT: c_int = linux_raw_sys::general::SIGCONT as _; pub(crate) const SIGSTOP: c_int = linux_raw_sys::general::SIGSTOP as _; pub(crate) const SIGTSTP: c_int = linux_raw_sys::general::SIGTSTP as _; pub(crate) const SIGTTIN: c_int = linux_raw_sys::general::SIGTTIN as _; pub(crate) const SIGTTOU: c_int = linux_raw_sys::general::SIGTTOU as _; pub(crate) const SIGURG: c_int = linux_raw_sys::general::SIGURG as _; pub(crate) const SIGXCPU: c_int = linux_raw_sys::general::SIGXCPU as _; pub(crate) const SIGXFSZ: c_int = linux_raw_sys::general::SIGXFSZ as _; pub(crate) const SIGVTALRM: c_int = linux_raw_sys::general::SIGVTALRM as _; pub(crate) const SIGPROF: c_int = linux_raw_sys::general::SIGPROF as _; pub(crate) const SIGWINCH: c_int = linux_raw_sys::general::SIGWINCH as _; pub(crate) const SIGIO: c_int = linux_raw_sys::general::SIGIO as _; pub(crate) const SIGPWR: c_int = linux_raw_sys::general::SIGPWR as _; pub(crate) const SIGSYS: c_int = linux_raw_sys::general::SIGSYS as _; #[cfg(any(
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "sparc",
target_arch = "sparc64"
))] pub(crate) const SIGEMT: c_int = linux_raw_sys::general::SIGEMT as _;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.