relibc/header/sys_ioctl/
mod.rs1use crate::{
6 error::ResultExt,
7 platform::types::{c_char, c_int, c_ulong, c_ushort, c_void},
8};
9
10pub mod constants;
11
12pub use constants::*;
13
14#[repr(C)]
16pub struct sgttyb {
17 sg_ispeed: c_char,
18 sg_ospeed: c_char,
19 sg_erase: c_char,
20 sg_kill: c_char,
21 sg_flags: c_ushort,
22}
23
24#[unsafe(no_mangle)]
25pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) -> c_int {
26 #[cfg(target_os = "linux")]
28 unsafe {
29 crate::platform::Sys::ioctl(fd, request, out).or_minus_one_errno()
30 }
31 #[cfg(target_os = "redox")]
32 unsafe { self::redox::ioctl_inner(fd, request, out) }.or_minus_one_errno()
33}
34
35#[cfg(target_os = "linux")]
36pub use self::linux::*;
37
38#[cfg(target_os = "linux")]
39pub mod linux;
40
41#[cfg(target_os = "redox")]
42pub use self::redox::*;
43
44#[cfg(target_os = "redox")]
45pub mod redox;