summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/imp/linux_raw/termios
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/imp/linux_raw/termios')
-rw-r--r--vendor/rustix/src/imp/linux_raw/termios/mod.rs2
-rw-r--r--vendor/rustix/src/imp/linux_raw/termios/syscalls.rs249
-rw-r--r--vendor/rustix/src/imp/linux_raw/termios/types.rs456
3 files changed, 707 insertions, 0 deletions
diff --git a/vendor/rustix/src/imp/linux_raw/termios/mod.rs b/vendor/rustix/src/imp/linux_raw/termios/mod.rs
new file mode 100644
index 000000000..1e0181a99
--- /dev/null
+++ b/vendor/rustix/src/imp/linux_raw/termios/mod.rs
@@ -0,0 +1,2 @@
+pub(crate) mod syscalls;
+pub(crate) mod types;
diff --git a/vendor/rustix/src/imp/linux_raw/termios/syscalls.rs b/vendor/rustix/src/imp/linux_raw/termios/syscalls.rs
new file mode 100644
index 000000000..b62a033e0
--- /dev/null
+++ b/vendor/rustix/src/imp/linux_raw/termios/syscalls.rs
@@ -0,0 +1,249 @@
+//! linux_raw syscalls supporting `rustix::termios`.
+//!
+//! # Safety
+//!
+//! See the `rustix::imp` module documentation for details.
+#![allow(unsafe_code)]
+#![allow(clippy::undocumented_unsafe_blocks)]
+
+use super::super::conv::{by_ref, c_uint, ret};
+use crate::fd::BorrowedFd;
+use crate::io;
+use crate::process::{Pid, RawNonZeroPid};
+use crate::termios::{
+ Action, OptionalActions, QueueSelector, Termios, Winsize, BRKINT, CBAUD, CS8, CSIZE, ECHO,
+ ECHONL, ICANON, ICRNL, IEXTEN, IGNBRK, IGNCR, INLCR, ISIG, ISTRIP, IXON, OPOST, PARENB, PARMRK,
+ VMIN, VTIME,
+};
+#[cfg(feature = "procfs")]
+use crate::{ffi::CStr, fs::FileType, path::DecInt};
+use core::mem::MaybeUninit;
+use linux_raw_sys::general::__kernel_pid_t;
+use linux_raw_sys::ioctl::{
+ TCFLSH, TCGETS, TCSBRK, TCSETS, TCXONC, TIOCGPGRP, TIOCGSID, TIOCGWINSZ, TIOCSPGRP, TIOCSWINSZ,
+};
+
+#[inline]
+pub(crate) fn tcgetwinsize(fd: BorrowedFd<'_>) -> io::Result<Winsize> {
+ unsafe {
+ let mut result = MaybeUninit::<Winsize>::uninit();
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGWINSZ), &mut result))
+ .map(|()| result.assume_init())
+ }
+}
+
+#[inline]
+pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
+ unsafe {
+ let mut result = MaybeUninit::<Termios>::uninit();
+ ret(syscall!(__NR_ioctl, fd, c_uint(TCGETS), &mut result)).map(|()| result.assume_init())
+ }
+}
+
+#[inline]
+pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
+ unsafe {
+ let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGPGRP), &mut result)).map(|()| {
+ let pid = result.assume_init();
+ debug_assert!(pid > 0);
+ Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid as u32))
+ })
+ }
+}
+
+#[inline]
+pub(crate) fn tcsetattr(
+ fd: BorrowedFd,
+ optional_actions: OptionalActions,
+ termios: &Termios,
+) -> io::Result<()> {
+ // Translate from `optional_actions` into an ioctl request code. On MIPS,
+ // `optional_actions` already has `TCGETS` added to it.
+ let request = if cfg!(any(target_arch = "mips", target_arch = "mips64")) {
+ optional_actions as u32
+ } else {
+ TCSETS + optional_actions as u32
+ };
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_ioctl,
+ fd,
+ c_uint(request as u32),
+ by_ref(termios)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(0))) }
+}
+
+#[inline]
+pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(1))) }
+}
+
+#[inline]
+pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_ioctl,
+ fd,
+ c_uint(TCFLSH),
+ c_uint(queue_selector as u32)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_ioctl,
+ fd,
+ c_uint(TCXONC),
+ c_uint(action as u32)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
+ unsafe {
+ let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGSID), &mut result)).map(|()| {
+ let pid = result.assume_init();
+ debug_assert!(pid > 0);
+ Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid as u32))
+ })
+ }
+}
+
+#[inline]
+pub(crate) fn tcsetwinsize(fd: BorrowedFd, winsize: Winsize) -> io::Result<()> {
+ unsafe {
+ ret(syscall!(
+ __NR_ioctl,
+ fd,
+ c_uint(TIOCSWINSZ),
+ by_ref(&winsize)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn tcsetpgrp(fd: BorrowedFd<'_>, pid: Pid) -> io::Result<()> {
+ unsafe { ret(syscall!(__NR_ioctl, fd, c_uint(TIOCSPGRP), pid)) }
+}
+
+#[inline]
+#[must_use]
+#[allow(clippy::missing_const_for_fn)]
+pub(crate) fn cfgetospeed(termios: &Termios) -> u32 {
+ termios.c_cflag & CBAUD
+}
+
+#[inline]
+#[must_use]
+#[allow(clippy::missing_const_for_fn)]
+pub(crate) fn cfgetispeed(termios: &Termios) -> u32 {
+ termios.c_cflag & CBAUD
+}
+
+#[inline]
+pub(crate) fn cfmakeraw(termios: &mut Termios) {
+ // From the Linux [`cfmakeraw` man page]:
+ //
+ // [`cfmakeraw` man page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html
+ termios.c_iflag &= !(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
+ termios.c_oflag &= !OPOST;
+ termios.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ termios.c_cflag &= !(CSIZE | PARENB);
+ termios.c_cflag |= CS8;
+
+ // Musl and glibc also do these:
+ termios.c_cc[VMIN] = 1;
+ termios.c_cc[VTIME] = 0;
+}
+
+#[inline]
+pub(crate) fn cfsetospeed(termios: &mut Termios, speed: u32) -> io::Result<()> {
+ if (speed & !CBAUD) != 0 {
+ return Err(io::Errno::INVAL);
+ }
+ termios.c_cflag &= !CBAUD;
+ termios.c_cflag |= speed;
+ Ok(())
+}
+
+#[inline]
+pub(crate) fn cfsetispeed(termios: &mut Termios, speed: u32) -> io::Result<()> {
+ if speed == 0 {
+ return Ok(());
+ }
+ if (speed & !CBAUD) != 0 {
+ return Err(io::Errno::INVAL);
+ }
+ termios.c_cflag &= !CBAUD;
+ termios.c_cflag |= speed;
+ Ok(())
+}
+
+#[inline]
+pub(crate) fn cfsetspeed(termios: &mut Termios, speed: u32) -> io::Result<()> {
+ if (speed & !CBAUD) != 0 {
+ return Err(io::Errno::INVAL);
+ }
+ termios.c_cflag &= !CBAUD;
+ termios.c_cflag |= speed;
+ Ok(())
+}
+
+#[inline]
+pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {
+ // On error, Linux will return either `EINVAL` (2.6.32) or `ENOTTY`
+ // (otherwise), because we assume we're never passing an invalid
+ // file descriptor (which would get `EBADF`). Either way, an error
+ // means we don't have a tty.
+ tcgetwinsize(fd).is_ok()
+}
+
+#[cfg(feature = "procfs")]
+pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
+ let fd_stat = super::super::fs::syscalls::fstat(fd)?;
+
+ // Quick check: if `fd` isn't a character device, it's not a tty.
+ if FileType::from_raw_mode(fd_stat.st_mode) != FileType::CharacterDevice {
+ return Err(crate::io::Errno::NOTTY);
+ }
+
+ // Check that `fd` is really a tty.
+ tcgetwinsize(fd)?;
+
+ // Get a fd to '/proc/self/fd'.
+ let proc_self_fd = io::proc_self_fd()?;
+
+ // Gather the ttyname by reading the 'fd' file inside 'proc_self_fd'.
+ let r =
+ super::super::fs::syscalls::readlinkat(proc_self_fd, DecInt::from_fd(&fd).as_c_str(), buf)?;
+
+ // If the number of bytes is equal to the buffer length, truncation may
+ // have occurred. This check also ensures that we have enough space for
+ // adding a NUL terminator.
+ if r == buf.len() {
+ return Err(io::Errno::RANGE);
+ }
+ buf[r] = b'\0';
+
+ // Check that the path we read refers to the same file as `fd`.
+ let path = CStr::from_bytes_with_nul(&buf[..=r]).unwrap();
+
+ let path_stat = super::super::fs::syscalls::stat(path)?;
+ if path_stat.st_dev != fd_stat.st_dev || path_stat.st_ino != fd_stat.st_ino {
+ return Err(crate::io::Errno::NODEV);
+ }
+
+ Ok(r)
+}
diff --git a/vendor/rustix/src/imp/linux_raw/termios/types.rs b/vendor/rustix/src/imp/linux_raw/termios/types.rs
new file mode 100644
index 000000000..ce8832455
--- /dev/null
+++ b/vendor/rustix/src/imp/linux_raw/termios/types.rs
@@ -0,0 +1,456 @@
+use super::super::c;
+
+/// `TCSA*` values for use with [`tcsetattr`].
+///
+/// [`tcsetattr`]: crate::termios::tcsetattr
+#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
+#[repr(u32)]
+pub enum OptionalActions {
+ /// `TCSANOW`—Make the change immediately.
+ Now = linux_raw_sys::general::TCSANOW,
+
+ /// `TCSADRAIN`—Make the change after all output has been transmitted.
+ Drain = linux_raw_sys::general::TCSADRAIN,
+
+ /// `TCSAFLUSH`—Discard any pending input and then make the change
+ /// after all output has been transmitted.
+ Flush = linux_raw_sys::general::TCSAFLUSH,
+}
+
+/// `TC*` values for use with [`tcflush`].
+///
+/// [`tcflush`]: crate::termios::tcflush
+#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
+#[repr(u32)]
+pub enum QueueSelector {
+ /// `TCIFLUSH`—Flush data received but not read.
+ IFlush = linux_raw_sys::general::TCIFLUSH,
+
+ /// `TCOFLUSH`—Flush data written but not transmitted.
+ OFlush = linux_raw_sys::general::TCOFLUSH,
+
+ /// `TCIOFLUSH`—`IFlush` and `OFlush` combined.
+ IOFlush = linux_raw_sys::general::TCIOFLUSH,
+}
+
+/// `TC*` values for use with [`tcflow`].
+///
+/// [`tcflow`]: crate::termios::tcflow
+#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
+#[repr(u32)]
+pub enum Action {
+ /// `TCOOFF`—Suspend output.
+ OOff = linux_raw_sys::general::TCOOFF,
+
+ /// `TCOON`—Restart suspended output.
+ OOn = linux_raw_sys::general::TCOON,
+
+ /// `TCIOFF`—Transmits a STOP byte.
+ IOff = linux_raw_sys::general::TCIOFF,
+
+ /// `TCION`—Transmits a START byte.
+ IOn = linux_raw_sys::general::TCION,
+}
+
+/// `struct termios` for use with [`tcgetattr`].
+///
+/// [`tcgetattr`]: crate::termios::tcgetattr
+pub type Termios = linux_raw_sys::general::termios;
+
+/// `struct winsize` for use with [`tcgetwinsize`].
+///
+/// [`tcgetwinsize`]: crate::termios::tcgetwinsize
+pub type Winsize = linux_raw_sys::general::winsize;
+
+/// `tcflag_t`—A type for the flags fields of [`Termios`].
+pub type Tcflag = linux_raw_sys::general::tcflag_t;
+
+/// `speed_t`—A return type for [`cfsetspeed`] and similar.
+///
+/// [`cfsetspeed`]: crate::termios::cfsetspeed
+pub type Speed = linux_raw_sys::general::speed_t;
+
+/// `VINTR`
+pub const VINTR: usize = linux_raw_sys::general::VINTR as usize;
+
+/// `VQUIT`
+pub const VQUIT: usize = linux_raw_sys::general::VQUIT as usize;
+
+/// `VERASE`
+pub const VERASE: usize = linux_raw_sys::general::VERASE as usize;
+
+/// `VKILL`
+pub const VKILL: usize = linux_raw_sys::general::VKILL as usize;
+
+/// `VEOF`
+pub const VEOF: usize = linux_raw_sys::general::VEOF as usize;
+
+/// `VTIME`
+pub const VTIME: usize = linux_raw_sys::general::VTIME as usize;
+
+/// `VMIN`
+pub const VMIN: usize = linux_raw_sys::general::VMIN as usize;
+
+/// `VSWTC`
+pub const VSWTC: usize = linux_raw_sys::general::VSWTC as usize;
+
+/// `VSTART`
+pub const VSTART: usize = linux_raw_sys::general::VSTART as usize;
+
+/// `VSTOP`
+pub const VSTOP: usize = linux_raw_sys::general::VSTOP as usize;
+
+/// `VSUSP`
+pub const VSUSP: usize = linux_raw_sys::general::VSUSP as usize;
+
+/// `VEOL`
+pub const VEOL: usize = linux_raw_sys::general::VEOL as usize;
+
+/// `VREPRINT`
+pub const VREPRINT: usize = linux_raw_sys::general::VREPRINT as usize;
+
+/// `VDISCARD`
+pub const VDISCARD: usize = linux_raw_sys::general::VDISCARD as usize;
+
+/// `VWERASE`
+pub const VWERASE: usize = linux_raw_sys::general::VWERASE as usize;
+
+/// `VLNEXT`
+pub const VLNEXT: usize = linux_raw_sys::general::VLNEXT as usize;
+
+/// `VEOL2`
+pub const VEOL2: usize = linux_raw_sys::general::VEOL2 as usize;
+
+/// `IGNBRK`
+pub const IGNBRK: c::c_uint = linux_raw_sys::general::IGNBRK;
+
+/// `BRKINT`
+pub const BRKINT: c::c_uint = linux_raw_sys::general::BRKINT;
+
+/// `IGNPAR`
+pub const IGNPAR: c::c_uint = linux_raw_sys::general::IGNPAR;
+
+/// `PARMRK`
+pub const PARMRK: c::c_uint = linux_raw_sys::general::PARMRK;
+
+/// `INPCK`
+pub const INPCK: c::c_uint = linux_raw_sys::general::INPCK;
+
+/// `ISTRIP`
+pub const ISTRIP: c::c_uint = linux_raw_sys::general::ISTRIP;
+
+/// `INLCR`
+pub const INLCR: c::c_uint = linux_raw_sys::general::INLCR;
+
+/// `IGNCR`
+pub const IGNCR: c::c_uint = linux_raw_sys::general::IGNCR;
+
+/// `ICRNL`
+pub const ICRNL: c::c_uint = linux_raw_sys::general::ICRNL;
+
+/// `IUCLC`
+pub const IUCLC: c::c_uint = linux_raw_sys::general::IUCLC;
+
+/// `IXON`
+pub const IXON: c::c_uint = linux_raw_sys::general::IXON;
+
+/// `IXANY`
+pub const IXANY: c::c_uint = linux_raw_sys::general::IXANY;
+
+/// `IXOFF`
+pub const IXOFF: c::c_uint = linux_raw_sys::general::IXOFF;
+
+/// `IMAXBEL`
+pub const IMAXBEL: c::c_uint = linux_raw_sys::general::IMAXBEL;
+
+/// `IUTF8`
+pub const IUTF8: c::c_uint = linux_raw_sys::general::IUTF8;
+
+/// `OPOST`
+pub const OPOST: c::c_uint = linux_raw_sys::general::OPOST;
+
+/// `OLCUC`
+pub const OLCUC: c::c_uint = linux_raw_sys::general::OLCUC;
+
+/// `ONLCR`
+pub const ONLCR: c::c_uint = linux_raw_sys::general::ONLCR;
+
+/// `OCRNL`
+pub const OCRNL: c::c_uint = linux_raw_sys::general::OCRNL;
+
+/// `ONOCR`
+pub const ONOCR: c::c_uint = linux_raw_sys::general::ONOCR;
+
+/// `ONLRET`
+pub const ONLRET: c::c_uint = linux_raw_sys::general::ONLRET;
+
+/// `OFILL`
+pub const OFILL: c::c_uint = linux_raw_sys::general::OFILL;
+
+/// `OFDEL`
+pub const OFDEL: c::c_uint = linux_raw_sys::general::OFDEL;
+
+/// `NLDLY`
+pub const NLDLY: c::c_uint = linux_raw_sys::general::NLDLY;
+
+/// `NL0`
+pub const NL0: c::c_uint = linux_raw_sys::general::NL0;
+
+/// `NL1`
+pub const NL1: c::c_uint = linux_raw_sys::general::NL1;
+
+/// `CRDLY`
+pub const CRDLY: c::c_uint = linux_raw_sys::general::CRDLY;
+
+/// `CR0`
+pub const CR0: c::c_uint = linux_raw_sys::general::CR0;
+
+/// `CR1`
+pub const CR1: c::c_uint = linux_raw_sys::general::CR1;
+
+/// `CR2`
+pub const CR2: c::c_uint = linux_raw_sys::general::CR2;
+
+/// `CR3`
+pub const CR3: c::c_uint = linux_raw_sys::general::CR3;
+
+/// `TABDLY`
+pub const TABDLY: c::c_uint = linux_raw_sys::general::TABDLY;
+
+/// `TAB0`
+pub const TAB0: c::c_uint = linux_raw_sys::general::TAB0;
+
+/// `TAB1`
+pub const TAB1: c::c_uint = linux_raw_sys::general::TAB1;
+
+/// `TAB2`
+pub const TAB2: c::c_uint = linux_raw_sys::general::TAB2;
+
+/// `TAB3`
+pub const TAB3: c::c_uint = linux_raw_sys::general::TAB3;
+
+/// `BSDLY`
+pub const BSDLY: c::c_uint = linux_raw_sys::general::BSDLY;
+
+/// `BS0`
+pub const BS0: c::c_uint = linux_raw_sys::general::BS0;
+
+/// `BS1`
+pub const BS1: c::c_uint = linux_raw_sys::general::BS1;
+
+/// `FFDLY`
+pub const FFDLY: c::c_uint = linux_raw_sys::general::FFDLY;
+
+/// `FF0`
+pub const FF0: c::c_uint = linux_raw_sys::general::FF0;
+
+/// `FF1`
+pub const FF1: c::c_uint = linux_raw_sys::general::FF1;
+
+/// `VTDLY`
+pub const VTDLY: c::c_uint = linux_raw_sys::general::VTDLY;
+
+/// `VT0`
+pub const VT0: c::c_uint = linux_raw_sys::general::VT0;
+
+/// `VT1`
+pub const VT1: c::c_uint = linux_raw_sys::general::VT1;
+
+/// `B0`
+pub const B0: Speed = linux_raw_sys::general::B0;
+
+/// `B50`
+pub const B50: Speed = linux_raw_sys::general::B50;
+
+/// `B75`
+pub const B75: Speed = linux_raw_sys::general::B75;
+
+/// `B110`
+pub const B110: Speed = linux_raw_sys::general::B110;
+
+/// `B134`
+pub const B134: Speed = linux_raw_sys::general::B134;
+
+/// `B150`
+pub const B150: Speed = linux_raw_sys::general::B150;
+
+/// `B200`
+pub const B200: Speed = linux_raw_sys::general::B200;
+
+/// `B300`
+pub const B300: Speed = linux_raw_sys::general::B300;
+
+/// `B600`
+pub const B600: Speed = linux_raw_sys::general::B600;
+
+/// `B1200`
+pub const B1200: Speed = linux_raw_sys::general::B1200;
+
+/// `B1800`
+pub const B1800: Speed = linux_raw_sys::general::B1800;
+
+/// `B2400`
+pub const B2400: Speed = linux_raw_sys::general::B2400;
+
+/// `B4800`
+pub const B4800: Speed = linux_raw_sys::general::B4800;
+
+/// `B9600`
+pub const B9600: Speed = linux_raw_sys::general::B9600;
+
+/// `B19200`
+pub const B19200: Speed = linux_raw_sys::general::B19200;
+
+/// `B38400`
+pub const B38400: Speed = linux_raw_sys::general::B38400;
+
+/// `B57600`
+pub const B57600: Speed = linux_raw_sys::general::B57600;
+
+/// `B115200`
+pub const B115200: Speed = linux_raw_sys::general::B115200;
+
+/// `B230400`
+pub const B230400: Speed = linux_raw_sys::general::B230400;
+
+/// `B460800`
+pub const B460800: Speed = linux_raw_sys::general::B460800;
+
+/// `B500000`
+pub const B500000: Speed = linux_raw_sys::general::B500000;
+
+/// `B576000`
+pub const B576000: Speed = linux_raw_sys::general::B576000;
+
+/// `B921600`
+pub const B921600: Speed = linux_raw_sys::general::B921600;
+
+/// `B1000000`
+pub const B1000000: Speed = linux_raw_sys::general::B1000000;
+
+/// `B1152000`
+pub const B1152000: Speed = linux_raw_sys::general::B1152000;
+
+/// `B1500000`
+pub const B1500000: Speed = linux_raw_sys::general::B1500000;
+
+/// `B2000000`
+pub const B2000000: Speed = linux_raw_sys::general::B2000000;
+
+/// `B2500000`
+pub const B2500000: Speed = linux_raw_sys::general::B2500000;
+
+/// `B3000000`
+pub const B3000000: Speed = linux_raw_sys::general::B3000000;
+
+/// `B3500000`
+pub const B3500000: Speed = linux_raw_sys::general::B3500000;
+
+/// `B4000000`
+pub const B4000000: Speed = linux_raw_sys::general::B4000000;
+
+/// `CSIZE`
+pub const CSIZE: c::c_uint = linux_raw_sys::general::CSIZE;
+
+/// `CS5`
+pub const CS5: c::c_uint = linux_raw_sys::general::CS5;
+
+/// `CS6`
+pub const CS6: c::c_uint = linux_raw_sys::general::CS6;
+
+/// `CS7`
+pub const CS7: c::c_uint = linux_raw_sys::general::CS7;
+
+/// `CS8`
+pub const CS8: c::c_uint = linux_raw_sys::general::CS8;
+
+/// `CSTOPB`
+pub const CSTOPB: c::c_uint = linux_raw_sys::general::CSTOPB;
+
+/// `CREAD`
+pub const CREAD: c::c_uint = linux_raw_sys::general::CREAD;
+
+/// `PARENB`
+pub const PARENB: c::c_uint = linux_raw_sys::general::PARENB;
+
+/// `PARODD`
+pub const PARODD: c::c_uint = linux_raw_sys::general::PARODD;
+
+/// `HUPCL`
+pub const HUPCL: c::c_uint = linux_raw_sys::general::HUPCL;
+
+/// `CLOCAL`
+pub const CLOCAL: c::c_uint = linux_raw_sys::general::CLOCAL;
+
+/// `ISIG`
+pub const ISIG: c::c_uint = linux_raw_sys::general::ISIG;
+
+/// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating
+/// canonical mode.
+pub const ICANON: Tcflag = linux_raw_sys::general::ICANON;
+
+/// `ECHO`
+pub const ECHO: c::c_uint = linux_raw_sys::general::ECHO;
+
+/// `ECHOE`
+pub const ECHOE: c::c_uint = linux_raw_sys::general::ECHOE;
+
+/// `ECHOK`
+pub const ECHOK: c::c_uint = linux_raw_sys::general::ECHOK;
+
+/// `ECHONL`
+pub const ECHONL: c::c_uint = linux_raw_sys::general::ECHONL;
+
+/// `NOFLSH`
+pub const NOFLSH: c::c_uint = linux_raw_sys::general::NOFLSH;
+
+/// `TOSTOP`
+pub const TOSTOP: c::c_uint = linux_raw_sys::general::TOSTOP;
+
+/// `IEXTEN`
+pub const IEXTEN: c::c_uint = linux_raw_sys::general::IEXTEN;
+
+/// `EXTA`
+pub const EXTA: c::c_uint = linux_raw_sys::general::EXTA;
+
+/// `EXTB`
+pub const EXTB: c::c_uint = linux_raw_sys::general::EXTB;
+
+/// `CBAUD`
+pub const CBAUD: c::c_uint = linux_raw_sys::general::CBAUD;
+
+/// `CBAUDEX`
+pub const CBAUDEX: c::c_uint = linux_raw_sys::general::CBAUDEX;
+
+/// `CIBAUD`
+pub const CIBAUD: c::c_uint = linux_raw_sys::general::CIBAUD;
+
+/// `CMSPAR`
+pub const CMSPAR: c::c_uint = linux_raw_sys::general::CMSPAR;
+
+/// `CRTSCTS`
+pub const CRTSCTS: c::c_uint = linux_raw_sys::general::CRTSCTS;
+
+/// `XCASE`
+pub const XCASE: c::c_uint = linux_raw_sys::general::XCASE;
+
+/// `ECHOCTL`
+pub const ECHOCTL: c::c_uint = linux_raw_sys::general::ECHOCTL;
+
+/// `ECHOPRT`
+pub const ECHOPRT: c::c_uint = linux_raw_sys::general::ECHOPRT;
+
+/// `ECHOKE`
+pub const ECHOKE: c::c_uint = linux_raw_sys::general::ECHOKE;
+
+/// `FLUSHO`
+pub const FLUSHO: c::c_uint = linux_raw_sys::general::FLUSHO;
+
+/// `PENDIN`
+pub const PENDIN: c::c_uint = linux_raw_sys::general::PENDIN;
+
+/// `EXTPROC`
+pub const EXTPROC: c::c_uint = linux_raw_sys::general::EXTPROC;
+
+/// `XTABS`
+pub const XTABS: c::c_uint = linux_raw_sys::general::XTABS;