#[repr(C)]pub struct Termios {
pub c_iflag: u32,
pub c_oflag: u32,
pub c_cflag: u32,
pub c_lflag: u32,
pub c_line: u8,
pub c_cc: [u8; 19],
pub c_ispeed: u32,
pub c_ospeed: u32,
}Expand description
终端属性结构(用于 TCGETS/TCSETS)
这是 Linux asm-generic/termbits.h 中定义的标准 termios 结构。 RISC-V 架构使用 asm-generic 定义,NCCS=19。
内存布局:
- offset 0-15: c_iflag, c_oflag, c_cflag, c_lflag (4 * u32 = 16 bytes)
- offset 16: c_line (u8 = 1 byte)
- offset 17-35: c_cc[19] (19 * u8 = 19 bytes)
- offset 36-39: c_ispeed (u32 = 4 bytes, 对齐到4字节边界)
- offset 40-43: c_ospeed (u32 = 4 bytes) 总大小:44字节
Fields§
§c_iflag: u32输入模式标志
c_oflag: u32输出模式标志
c_cflag: u32控制模式标志
c_lflag: u32本地模式标志
c_line: u8行规程
c_cc: [u8; 19]特殊控制字符 [NCCS=19]
c_ispeed: u32输入波特率(注意:musl 在此之前有3字节padding使其对齐到4字节边界)
c_ospeed: u32输出波特率
Implementations§
Trait Implementations§
impl Copy for Termios
Auto Trait Implementations§
impl Freeze for Termios
impl RefUnwindSafe for Termios
impl Send for Termios
impl Sync for Termios
impl Unpin for Termios
impl UnwindSafe for Termios
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)