use linux_unsafe::{int, ulong, ushort};
use crate::fd::ioctl::{
ioctl_read, ioctl_write, ioctl_writeread, IoctlReqRead, IoctlReqWrite, IoctlReqWriteRead, _IOR,
_IOW,
};
pub const TIOCGWINSZ: IoctlReqRead<TtyDevice, WindowSize> = unsafe { ioctl_read(0x5413) };
pub const TIOCSWINSZ: IoctlReqWrite<TtyDevice, WindowSize> = unsafe { ioctl_write(0x5414) };
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct WindowSize {
pub ws_row: ushort,
pub ws_col: ushort,
pub ws_xpixel: ushort,
pub ws_ypixel: ushort,
}
pub struct TtyDevice;
impl super::fd::ioctl::IoDevice for TtyDevice {}
pub struct PtyControllerDevice;
impl super::fd::ioctl::IoDevice for PtyControllerDevice {}
const IOCTL_TTY: ulong = b'T' as ulong;
pub const TIOCSPTLCK: IoctlReqWrite<PtyControllerDevice, int> =
unsafe { ioctl_write(_IOW(IOCTL_TTY, 0x31, core::mem::size_of::<int>() as ulong)) };
pub const TIOCGPTN: IoctlReqWriteRead<PtyControllerDevice, int> =
unsafe { ioctl_writeread(_IOR(IOCTL_TTY, 0x30, core::mem::size_of::<int>() as ulong)) };