ioctl-rs-0.2.0/.gitignore01006440001750000175000000000022131764575760013475 0ustar0000000000000000target Cargo.lock ioctl-rs-0.2.0/.travis.yml01006440001750000175000000000077131764575760013630 0ustar0000000000000000language: rust rust: - 1.0.0 - stable - beta - nightly ioctl-rs-0.2.0/Cargo.toml.orig01006440001750000175000000000565132111261560014361 0ustar0000000000000000[package] name = "ioctl-rs" version = "0.2.0" authors = ["David Cuddeback "] description = "Rust bindings for system ioctls." license = "MIT" homepage = "https://github.com/dcuddeback/ioctl-rs" repository = "https://github.com/dcuddeback/ioctl-rs" readme = "README.md" keywords = ["ioctl"] exclude = ["ioctl_list/*"] [dependencies] libc = "0.2" ioctl-rs-0.2.0/Cargo.toml0000644000000016100007602 0ustar00# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g. crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] name = "ioctl-rs" version = "0.2.0" authors = ["David Cuddeback "] exclude = ["ioctl_list/*"] description = "Rust bindings for system ioctls." homepage = "https://github.com/dcuddeback/ioctl-rs" readme = "README.md" keywords = ["ioctl"] license = "MIT" repository = "https://github.com/dcuddeback/ioctl-rs" [dependencies.libc] version = "0.2" ioctl-rs-0.2.0/LICENSE01006440001750000175000000002043131764575760012517 0ustar0000000000000000Copyright (c) 2015 David Cuddeback Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ioctl-rs-0.2.0/README.md01006440001750000175000000003060132111261560012742 0ustar0000000000000000# IOCTL The `ioctl-rs` crate provides raw definitions as well as safe bindings for system ioctl calls on Unix operating systems. The ioctl constants, e.g., `TIOCEXCL`, are exported as constants that are usable with the unsafe `ioctl()` function. Wrapper functions are provided for some ioctls that handle input and output parameters and convert return values to `io::Result`. The wrapper functions are named after the ioctl that they implement. For example, `TIOCEXCL` is implemented in a wrapper function named `tiocexcl()`. ## Usage Add `ioctl-rs` as a dependency in `Cargo.toml`: ```toml [dependencies] ioctl-rs = "0.2" ``` Import the `ioctl_rs` crate. You may also need `std::os::unix::io::RawFd` for file descriptors and `std::io::Result` to propagate errors. ```rust extern crate ioctl_rs as ioctl; use std::io use std::os::unix::io::RawFd; fn setup_serial_port(fd: RawFd) -> io::Result<()> { // put file descriptor in exclusive mode try!(ioctl::tiocexcl(fd)); // clear all the modem pins ioctl::tiocmset(fd, 0) } ``` ## Contributing This repository includes a C++ program called `ioctl_list`, which generates Rust definitions for ioctl constants. To contribute ioctl definitions for a new platform or to add new ioctl definitions, please follow the instructions in the `ioctl_list` [README](/ioctl_list/README.md). ### Contributors * [dcuddeback](https://github.com/dcuddeback) * [trlim](https://github.com/trlim) * [mneumann](https://github.com/mneumann) ## License Copyright © 2015 David Cuddeback Distributed under the [MIT License](LICENSE). ioctl-rs-0.2.0/src/lib.rs01006440001750000175000000003310131764575760013413 0ustar0000000000000000extern crate libc; use std::io; use std::mem; use std::os::unix::io::RawFd; use libc::c_int; #[cfg(any(target_os = "linux", target_os = "android"))] pub use os::linux::*; #[cfg(target_os = "macos")] pub use os::macos::*; #[cfg(target_os = "freebsd")] pub use os::freebsd::*; #[cfg(target_os = "dragonfly")] pub use os::dragonfly::*; #[cfg(target_os = "openbsd")] pub use os::openbsd::*; mod os; /// Put the terminal in exclusive mode. pub fn tiocexcl(fd: RawFd) -> io::Result<()> { match unsafe { ioctl(fd, TIOCEXCL) } { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } /// Disable exclusive mode. pub fn tiocnxcl(fd: RawFd) -> io::Result<()> { match unsafe { ioctl(fd, TIOCNXCL) } { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } /// Get the status of modem bits. pub fn tiocmget(fd: RawFd) -> io::Result { let mut bits: c_int = unsafe { mem::uninitialized() }; match unsafe { ioctl(fd, TIOCMGET, &mut bits) } { 0 => Ok(bits), _ => Err(io::Error::last_os_error()) } } /// Set the status of modem bits. pub fn tiocmset(fd: RawFd, bits: c_int) -> io::Result<()> { match unsafe { ioctl(fd, TIOCMSET, &bits) } { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } /// Set the indicated modem bits. pub fn tiocmbis(fd: RawFd, bits: c_int) -> io::Result<()> { match unsafe { ioctl(fd, TIOCMBIS, &bits) } { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } /// Clear the indicated modem bits. pub fn tiocmbic(fd: RawFd, bits: c_int) -> io::Result<()> { match unsafe { ioctl(fd, TIOCMBIC, &bits) } { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } ioctl-rs-0.2.0/src/os/dragonfly.rs01006440001750000175000000004764131764575760015271 0ustar0000000000000000use libc::{c_int,c_ulong}; // socket pub const FIOSETOWN: c_ulong = 0x8004667c; pub const SIOCSPGRP: c_ulong = 0x80047308; pub const FIOGETOWN: c_ulong = 0x4004667b; pub const SIOCGPGRP: c_ulong = 0x40047309; // termios pub const TIOCEXCL: c_ulong = 0x2000740d; pub const TIOCNXCL: c_ulong = 0x2000740e; pub const TIOCSCTTY: c_ulong = 0x20007461; pub const TIOCGPGRP: c_ulong = 0x40047477; pub const TIOCSPGRP: c_ulong = 0x80047476; pub const TIOCOUTQ: c_ulong = 0x40047473; pub const TIOCSTI: c_ulong = 0x80017472; pub const TIOCGWINSZ: c_ulong = 0x40087468; pub const TIOCSWINSZ: c_ulong = 0x80087467; pub const TIOCMGET: c_ulong = 0x4004746a; pub const TIOCMBIS: c_ulong = 0x8004746c; pub const TIOCMBIC: c_ulong = 0x8004746b; pub const TIOCMSET: c_ulong = 0x8004746d; pub const FIONREAD: c_ulong = 0x4004667f; pub const TIOCCONS: c_ulong = 0x80047462; pub const TIOCPKT: c_ulong = 0x80047470; pub const FIONBIO: c_ulong = 0x8004667e; pub const TIOCNOTTY: c_ulong = 0x20007471; pub const TIOCSETD: c_ulong = 0x8004741b; pub const TIOCGETD: c_ulong = 0x4004741a; pub const FIONCLEX: c_ulong = 0x20006602; pub const FIOCLEX: c_ulong = 0x20006601; pub const FIOASYNC: c_ulong = 0x8004667d; // sockios pub const SIOCGIFCONF: c_ulong = 0xc0106924; pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; pub const SIOCSIFFLAGS: c_ulong = 0x80206910; pub const SIOCGIFADDR: c_ulong = 0xc0206921; pub const SIOCSIFADDR: c_ulong = 0x8020690c; pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; pub const SIOCSIFNETMASK: c_ulong = 0x80206916; pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; pub const SIOCSIFMETRIC: c_ulong = 0x80206918; pub const SIOCGIFMTU: c_ulong = 0xc0206933; pub const SIOCSIFMTU: c_ulong = 0x80206934; pub const SIOCADDMULTI: c_ulong = 0x80206931; pub const SIOCDELMULTI: c_ulong = 0x80206932; // modem control lines pub const TIOCM_LE: c_int = 0x00000001; pub const TIOCM_DTR: c_int = 0x00000002; pub const TIOCM_RTS: c_int = 0x00000004; pub const TIOCM_ST: c_int = 0x00000008; pub const TIOCM_SR: c_int = 0x00000010; pub const TIOCM_CTS: c_int = 0x00000020; pub const TIOCM_CAR: c_int = 0x00000040; pub const TIOCM_CD: c_int = 0x00000040; pub const TIOCM_RNG: c_int = 0x00000080; pub const TIOCM_RI: c_int = 0x00000080; pub const TIOCM_DSR: c_int = 0x00000100; extern "C" { pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; } ioctl-rs-0.2.0/src/os/freebsd.rs01006440001750000175000000004764131764575760014716 0ustar0000000000000000use libc::{c_int,c_ulong}; // socket pub const FIOSETOWN: c_ulong = 0x8004667c; pub const SIOCSPGRP: c_ulong = 0x80047308; pub const FIOGETOWN: c_ulong = 0x4004667b; pub const SIOCGPGRP: c_ulong = 0x40047309; // termios pub const TIOCEXCL: c_ulong = 0x2000740d; pub const TIOCNXCL: c_ulong = 0x2000740e; pub const TIOCSCTTY: c_ulong = 0x20007461; pub const TIOCGPGRP: c_ulong = 0x40047477; pub const TIOCSPGRP: c_ulong = 0x80047476; pub const TIOCOUTQ: c_ulong = 0x40047473; pub const TIOCSTI: c_ulong = 0x80017472; pub const TIOCGWINSZ: c_ulong = 0x40087468; pub const TIOCSWINSZ: c_ulong = 0x80087467; pub const TIOCMGET: c_ulong = 0x4004746a; pub const TIOCMBIS: c_ulong = 0x8004746c; pub const TIOCMBIC: c_ulong = 0x8004746b; pub const TIOCMSET: c_ulong = 0x8004746d; pub const FIONREAD: c_ulong = 0x4004667f; pub const TIOCCONS: c_ulong = 0x80047462; pub const TIOCPKT: c_ulong = 0x80047470; pub const FIONBIO: c_ulong = 0x8004667e; pub const TIOCNOTTY: c_ulong = 0x20007471; pub const TIOCSETD: c_ulong = 0x8004741b; pub const TIOCGETD: c_ulong = 0x4004741a; pub const FIONCLEX: c_ulong = 0x20006602; pub const FIOCLEX: c_ulong = 0x20006601; pub const FIOASYNC: c_ulong = 0x8004667d; // sockios pub const SIOCGIFCONF: c_ulong = 0xc0106924; pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; pub const SIOCSIFFLAGS: c_ulong = 0x80206910; pub const SIOCGIFADDR: c_ulong = 0xc0206921; pub const SIOCSIFADDR: c_ulong = 0x8020690c; pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; pub const SIOCSIFNETMASK: c_ulong = 0x80206916; pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; pub const SIOCSIFMETRIC: c_ulong = 0x80206918; pub const SIOCGIFMTU: c_ulong = 0xc0206933; pub const SIOCSIFMTU: c_ulong = 0x80206934; pub const SIOCADDMULTI: c_ulong = 0x80206931; pub const SIOCDELMULTI: c_ulong = 0x80206932; // modem control lines pub const TIOCM_LE: c_int = 0x00000001; pub const TIOCM_DTR: c_int = 0x00000002; pub const TIOCM_RTS: c_int = 0x00000004; pub const TIOCM_ST: c_int = 0x00000008; pub const TIOCM_SR: c_int = 0x00000010; pub const TIOCM_CTS: c_int = 0x00000020; pub const TIOCM_CAR: c_int = 0x00000040; pub const TIOCM_CD: c_int = 0x00000040; pub const TIOCM_RNG: c_int = 0x00000080; pub const TIOCM_RI: c_int = 0x00000080; pub const TIOCM_DSR: c_int = 0x00000100; extern "C" { pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; } ioctl-rs-0.2.0/src/os/linux.rs01006440001750000175000000010732132111261520014400 0ustar0000000000000000use libc::{c_int, c_uint}; // socket pub const FIOSETOWN: c_uint = 0x00008901; pub const SIOCSPGRP: c_uint = 0x00008902; pub const FIOGETOWN: c_uint = 0x00008903; pub const SIOCGPGRP: c_uint = 0x00008904; pub const SIOCGSTAMP: c_uint = 0x00008906; // termios pub const TCGETS: c_uint = 0x00005401; pub const TCSETS: c_uint = 0x00005402; pub const TCSETSW: c_uint = 0x00005403; pub const TCSETSF: c_uint = 0x00005404; pub const TCGETA: c_uint = 0x00005405; pub const TCSETA: c_uint = 0x00005406; pub const TCSETAW: c_uint = 0x00005407; pub const TCSETAF: c_uint = 0x00005408; pub const TCSBRK: c_uint = 0x00005409; pub const TCXONC: c_uint = 0x0000540a; pub const TCFLSH: c_uint = 0x0000540b; pub const TIOCEXCL: c_uint = 0x0000540c; pub const TIOCNXCL: c_uint = 0x0000540d; pub const TIOCSCTTY: c_uint = 0x0000540e; pub const TIOCGPGRP: c_uint = 0x0000540f; pub const TIOCSPGRP: c_uint = 0x00005410; pub const TIOCOUTQ: c_uint = 0x00005411; pub const TIOCSTI: c_uint = 0x00005412; pub const TIOCGWINSZ: c_uint = 0x00005413; pub const TIOCSWINSZ: c_uint = 0x00005414; pub const TIOCMGET: c_uint = 0x00005415; pub const TIOCMBIS: c_uint = 0x00005416; pub const TIOCMBIC: c_uint = 0x00005417; pub const TIOCMSET: c_uint = 0x00005418; pub const TIOCGSOFTCAR: c_uint = 0x00005419; pub const TIOCSSOFTCAR: c_uint = 0x0000541a; pub const FIONREAD: c_uint = 0x0000541b; pub const TIOCINQ: c_uint = 0x0000541b; pub const TIOCLINUX: c_uint = 0x0000541c; pub const TIOCCONS: c_uint = 0x0000541d; pub const TIOCGSERIAL: c_uint = 0x0000541e; pub const TIOCSSERIAL: c_uint = 0x0000541f; pub const TIOCPKT: c_uint = 0x00005420; pub const FIONBIO: c_uint = 0x00005421; pub const TIOCNOTTY: c_uint = 0x00005422; pub const TIOCSETD: c_uint = 0x00005423; pub const TIOCGETD: c_uint = 0x00005424; pub const TCSBRKP: c_uint = 0x00005425; pub const FIONCLEX: c_uint = 0x00005450; pub const FIOCLEX: c_uint = 0x00005451; pub const FIOASYNC: c_uint = 0x00005452; pub const TIOCSERCONFIG: c_uint = 0x00005453; pub const TIOCSERGWILD: c_uint = 0x00005454; pub const TIOCSERSWILD: c_uint = 0x00005455; pub const TIOCGLCKTRMIOS: c_uint = 0x00005456; pub const TIOCSLCKTRMIOS: c_uint = 0x00005457; pub const TIOCSERGSTRUCT: c_uint = 0x00005458; pub const TIOCSERGETLSR: c_uint = 0x00005459; pub const TIOCSERGETMULTI: c_uint = 0x0000545a; pub const TIOCSERSETMULTI: c_uint = 0x0000545b; // sockios pub const SIOCADDRT: c_uint = 0x0000890b; pub const SIOCDELRT: c_uint = 0x0000890c; pub const SIOCGIFNAME: c_uint = 0x00008910; pub const SIOCSIFLINK: c_uint = 0x00008911; pub const SIOCGIFCONF: c_uint = 0x00008912; pub const SIOCGIFFLAGS: c_uint = 0x00008913; pub const SIOCSIFFLAGS: c_uint = 0x00008914; pub const SIOCGIFADDR: c_uint = 0x00008915; pub const SIOCSIFADDR: c_uint = 0x00008916; pub const SIOCGIFDSTADDR: c_uint = 0x00008917; pub const SIOCSIFDSTADDR: c_uint = 0x00008918; pub const SIOCGIFBRDADDR: c_uint = 0x00008919; pub const SIOCSIFBRDADDR: c_uint = 0x0000891a; pub const SIOCGIFNETMASK: c_uint = 0x0000891b; pub const SIOCSIFNETMASK: c_uint = 0x0000891c; pub const SIOCGIFMETRIC: c_uint = 0x0000891d; pub const SIOCSIFMETRIC: c_uint = 0x0000891e; pub const SIOCGIFMEM: c_uint = 0x0000891f; pub const SIOCSIFMEM: c_uint = 0x00008920; pub const SIOCGIFMTU: c_uint = 0x00008921; pub const SIOCSIFMTU: c_uint = 0x00008922; pub const SIOCSIFHWADDR: c_uint = 0x00008924; pub const SIOCGIFENCAP: c_uint = 0x00008925; pub const SIOCSIFENCAP: c_uint = 0x00008926; pub const SIOCGIFHWADDR: c_uint = 0x00008927; pub const SIOCGIFSLAVE: c_uint = 0x00008929; pub const SIOCSIFSLAVE: c_uint = 0x00008930; pub const SIOCADDMULTI: c_uint = 0x00008931; pub const SIOCDELMULTI: c_uint = 0x00008932; pub const SIOCDARP: c_uint = 0x00008953; pub const SIOCGARP: c_uint = 0x00008954; pub const SIOCSARP: c_uint = 0x00008955; pub const SIOCDRARP: c_uint = 0x00008960; pub const SIOCGRARP: c_uint = 0x00008961; pub const SIOCSRARP: c_uint = 0x00008962; pub const SIOCGIFMAP: c_uint = 0x00008970; pub const SIOCSIFMAP: c_uint = 0x00008971; // modem control lines pub const TIOCM_LE: c_uint = 0x00000001; pub const TIOCM_DTR: c_uint = 0x00000002; pub const TIOCM_RTS: c_uint = 0x00000004; pub const TIOCM_ST: c_uint = 0x00000008; pub const TIOCM_SR: c_uint = 0x00000010; pub const TIOCM_CTS: c_uint = 0x00000020; pub const TIOCM_CAR: c_uint = 0x00000040; pub const TIOCM_CD: c_uint = 0x00000040; pub const TIOCM_RNG: c_uint = 0x00000080; pub const TIOCM_RI: c_uint = 0x00000080; pub const TIOCM_DSR: c_uint = 0x00000100; extern "C" { pub fn ioctl(fd: c_int, request: c_uint, ...) -> c_int; } ioctl-rs-0.2.0/src/os/macos.rs01006440001750000175000000005431131764575760014376 0ustar0000000000000000use libc::{c_int,c_ulong}; // socket pub const FIOSETOWN: c_ulong = 0x8004667c; pub const SIOCSPGRP: c_ulong = 0x80047308; pub const FIOGETOWN: c_ulong = 0x4004667b; pub const SIOCGPGRP: c_ulong = 0x40047309; // termios pub const TIOCEXCL: c_ulong = 0x2000740d; pub const TIOCNXCL: c_ulong = 0x2000740e; pub const TIOCSCTTY: c_ulong = 0x20007461; pub const TIOCGPGRP: c_ulong = 0x40047477; pub const TIOCSPGRP: c_ulong = 0x80047476; pub const TIOCOUTQ: c_ulong = 0x40047473; pub const TIOCSTI: c_ulong = 0x80017472; pub const TIOCGWINSZ: c_ulong = 0x40087468; pub const TIOCSWINSZ: c_ulong = 0x80087467; pub const TIOCMGET: c_ulong = 0x4004746a; pub const TIOCMBIS: c_ulong = 0x8004746c; pub const TIOCMBIC: c_ulong = 0x8004746b; pub const TIOCMSET: c_ulong = 0x8004746d; pub const FIONREAD: c_ulong = 0x4004667f; pub const TIOCCONS: c_ulong = 0x80047462; pub const TIOCPKT: c_ulong = 0x80047470; pub const FIONBIO: c_ulong = 0x8004667e; pub const TIOCNOTTY: c_ulong = 0x20007471; pub const TIOCSETD: c_ulong = 0x8004741b; pub const TIOCGETD: c_ulong = 0x4004741a; pub const FIONCLEX: c_ulong = 0x20006602; pub const FIOCLEX: c_ulong = 0x20006601; pub const FIOASYNC: c_ulong = 0x8004667d; // IOKit pub const IOSSDATALAT: c_ulong = 0x80085400; pub const IOSSDATALAT_32: c_ulong = 0x80045400; pub const IOSSDATALAT_64: c_ulong = 0x80085400; pub const IOSSIOSPEED: c_ulong = 0x80085402; pub const IOSSIOSPEED_32: c_ulong = 0x80045402; pub const IOSSIOSPEED_64: c_ulong = 0x80085402; // sockios pub const SIOCGIFCONF: c_ulong = 0xc00c6924; pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; pub const SIOCSIFFLAGS: c_ulong = 0x80206910; pub const SIOCGIFADDR: c_ulong = 0xc0206921; pub const SIOCSIFADDR: c_ulong = 0x8020690c; pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; pub const SIOCSIFNETMASK: c_ulong = 0x80206916; pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; pub const SIOCSIFMETRIC: c_ulong = 0x80206918; pub const SIOCGIFMTU: c_ulong = 0xc0206933; pub const SIOCSIFMTU: c_ulong = 0x80206934; pub const SIOCADDMULTI: c_ulong = 0x80206931; pub const SIOCDELMULTI: c_ulong = 0x80206932; // modem control lines pub const TIOCM_LE: c_int = 0x00000001; pub const TIOCM_DTR: c_int = 0x00000002; pub const TIOCM_RTS: c_int = 0x00000004; pub const TIOCM_ST: c_int = 0x00000008; pub const TIOCM_SR: c_int = 0x00000010; pub const TIOCM_CTS: c_int = 0x00000020; pub const TIOCM_CAR: c_int = 0x00000040; pub const TIOCM_CD: c_int = 0x00000040; pub const TIOCM_RNG: c_int = 0x00000080; pub const TIOCM_RI: c_int = 0x00000080; pub const TIOCM_DSR: c_int = 0x00000100; extern "C" { pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; } ioctl-rs-0.2.0/src/os/mod.rs01006440001750000175000000000407131764575760014051 0ustar0000000000000000#[cfg(any(target_os = "linux", target_os = "android"))] pub mod linux; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "freebsd")] pub mod freebsd; #[cfg(target_os = "dragonfly")] pub mod dragonfly; #[cfg(target_os = "openbsd")] pub mod openbsd; ioctl-rs-0.2.0/src/os/openbsd.rs01006440001750000175000000004764131764575760014736 0ustar0000000000000000use libc::{c_int,c_ulong}; // socket pub const FIOSETOWN: c_ulong = 0x8004667c; pub const SIOCSPGRP: c_ulong = 0x80047308; pub const FIOGETOWN: c_ulong = 0x4004667b; pub const SIOCGPGRP: c_ulong = 0x40047309; // termios pub const TIOCEXCL: c_ulong = 0x2000740d; pub const TIOCNXCL: c_ulong = 0x2000740e; pub const TIOCSCTTY: c_ulong = 0x20007461; pub const TIOCGPGRP: c_ulong = 0x40047477; pub const TIOCSPGRP: c_ulong = 0x80047476; pub const TIOCOUTQ: c_ulong = 0x40047473; pub const TIOCSTI: c_ulong = 0x80017472; pub const TIOCGWINSZ: c_ulong = 0x40087468; pub const TIOCSWINSZ: c_ulong = 0x80087467; pub const TIOCMGET: c_ulong = 0x4004746a; pub const TIOCMBIS: c_ulong = 0x8004746c; pub const TIOCMBIC: c_ulong = 0x8004746b; pub const TIOCMSET: c_ulong = 0x8004746d; pub const FIONREAD: c_ulong = 0x4004667f; pub const TIOCCONS: c_ulong = 0x80047462; pub const TIOCPKT: c_ulong = 0x80047470; pub const FIONBIO: c_ulong = 0x8004667e; pub const TIOCNOTTY: c_ulong = 0x20007471; pub const TIOCSETD: c_ulong = 0x8004741b; pub const TIOCGETD: c_ulong = 0x4004741a; pub const FIONCLEX: c_ulong = 0x20006602; pub const FIOCLEX: c_ulong = 0x20006601; pub const FIOASYNC: c_ulong = 0x8004667d; // sockios pub const SIOCGIFCONF: c_ulong = 0xc0106924; pub const SIOCGIFFLAGS: c_ulong = 0xc0206911; pub const SIOCSIFFLAGS: c_ulong = 0x80206910; pub const SIOCGIFADDR: c_ulong = 0xc0206921; pub const SIOCSIFADDR: c_ulong = 0x8020690c; pub const SIOCGIFDSTADDR: c_ulong = 0xc0206922; pub const SIOCSIFDSTADDR: c_ulong = 0x8020690e; pub const SIOCGIFBRDADDR: c_ulong = 0xc0206923; pub const SIOCSIFBRDADDR: c_ulong = 0x80206913; pub const SIOCGIFNETMASK: c_ulong = 0xc0206925; pub const SIOCSIFNETMASK: c_ulong = 0x80206916; pub const SIOCGIFMETRIC: c_ulong = 0xc0206917; pub const SIOCSIFMETRIC: c_ulong = 0x80206918; pub const SIOCGIFMTU: c_ulong = 0xc020697e; pub const SIOCSIFMTU: c_ulong = 0x8020697f; pub const SIOCADDMULTI: c_ulong = 0x80206931; pub const SIOCDELMULTI: c_ulong = 0x80206932; // modem control lines pub const TIOCM_LE: c_int = 0x00000001; pub const TIOCM_DTR: c_int = 0x00000002; pub const TIOCM_RTS: c_int = 0x00000004; pub const TIOCM_ST: c_int = 0x00000008; pub const TIOCM_SR: c_int = 0x00000010; pub const TIOCM_CTS: c_int = 0x00000020; pub const TIOCM_CAR: c_int = 0x00000040; pub const TIOCM_CD: c_int = 0x00000040; pub const TIOCM_RNG: c_int = 0x00000080; pub const TIOCM_RI: c_int = 0x00000080; pub const TIOCM_DSR: c_int = 0x00000100; extern "C" { pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; }