diff options
author | Utkarsh Kukreti <utkarshkukreti@gmail.com> | 2015-02-10 12:10:57 +0530 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-02-10 22:34:13 -0800 |
commit | effb423fdb26843612edca6a748e479522089c1d (patch) | |
tree | a2ca4f77d2bfd158f42d8a90cd4b4c2df371037d /src/sys/termios.rs | |
parent | 51becf70d23c1ac6184921fb729fd61324538ddc (diff) | |
download | nix-effb423fdb26843612edca6a748e479522089c1d.zip |
Add `NixPath`, `NixError`, and `NixResult`.
Diffstat (limited to 'src/sys/termios.rs')
-rw-r--r-- | src/sys/termios.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 525a13ff..56beca2e 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -1,7 +1,8 @@ -use errno::{SysError, SysResult, from_ffi}; +use errno::Errno; use fcntl::Fd; use libc::c_int; use std::mem; +use {NixError, NixResult, from_ffi}; pub use self::ffi::consts::*; pub use self::ffi::consts::SetArg::*; @@ -361,19 +362,19 @@ pub fn cfgetospeed(termios: &Termios) -> speed_t { } } -pub fn cfsetispeed(termios: &mut Termios, speed: speed_t) -> SysResult<()> { +pub fn cfsetispeed(termios: &mut Termios, speed: speed_t) -> NixResult<()> { from_ffi(unsafe { ffi::cfsetispeed(termios, speed) }) } -pub fn cfsetospeed(termios: &mut Termios, speed: speed_t) -> SysResult<()> { +pub fn cfsetospeed(termios: &mut Termios, speed: speed_t) -> NixResult<()> { from_ffi(unsafe { ffi::cfsetospeed(termios, speed) }) } -pub fn tcgetattr(fd: Fd) -> SysResult<Termios> { +pub fn tcgetattr(fd: Fd) -> NixResult<Termios> { let mut termios = unsafe { mem::uninitialized() }; let res = unsafe { @@ -381,7 +382,7 @@ pub fn tcgetattr(fd: Fd) -> SysResult<Termios> { }; if res < 0 { - return Err(SysError::last()); + return Err(NixError::Sys(Errno::last())); } Ok(termios) @@ -389,31 +390,31 @@ pub fn tcgetattr(fd: Fd) -> SysResult<Termios> { pub fn tcsetattr(fd: Fd, actions: SetArg, - termios: &Termios) -> SysResult<()> { + termios: &Termios) -> NixResult<()> { from_ffi(unsafe { ffi::tcsetattr(fd, actions as c_int, termios) }) } -pub fn tcdrain(fd: Fd) -> SysResult<()> { +pub fn tcdrain(fd: Fd) -> NixResult<()> { from_ffi(unsafe { ffi::tcdrain(fd) }) } -pub fn tcflow(fd: Fd, action: FlowArg) -> SysResult<()> { +pub fn tcflow(fd: Fd, action: FlowArg) -> NixResult<()> { from_ffi(unsafe { ffi::tcflow(fd, action as c_int) }) } -pub fn tcflush(fd: Fd, action: FlushArg) -> SysResult<()> { +pub fn tcflush(fd: Fd, action: FlushArg) -> NixResult<()> { from_ffi(unsafe { ffi::tcflush(fd, action as c_int) }) } -pub fn tcsendbreak(fd: Fd, action: c_int) -> SysResult<()> { +pub fn tcsendbreak(fd: Fd, action: c_int) -> NixResult<()> { from_ffi(unsafe { ffi::tcsendbreak(fd, action) }) |