Skip to content

Commit

Permalink
Add cfmakesane() on FreeBSD and DragonFlyBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Jan 4, 2018
1 parent b111026 commit 7ea2152
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#814](https://github.com/nix-rust/nix/pull/814))
- Added `EVFILT_EMPTY`, `EVFILT_PROCDESC` and `EVFILT_SENDFILE` on FreeBSD.
([#825](https://github.com/nix-rust/nix/pull/825))
- Exposed `termios::cfmakesane` on FreeBSD and DragonFlyBSD.
([#825](https://github.com/nix-rust/nix/pull/825))

### Changed
- Use native `pipe2` on all BSD targets. Users should notice no difference.
Expand Down
12 changes: 12 additions & 0 deletions src/sys/termios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,18 @@ pub fn cfmakeraw(termios: &mut Termios) {
termios.update_wrapper();
}

/// Configures the port to "sane" mode (like the configuration of a newly created terminal).
///
/// Note that this is a non-standard function, available on FreeBSD and DragonFlyBSD.
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
pub fn cfmakesane(termios: &mut Termios) {
let inner_termios = unsafe { termios.get_libc_termios_mut() };
unsafe {
libc::cfmakesane(inner_termios);
}
termios.update_wrapper();
}

/// Set input baud rate (see
/// [cfsetispeed(3p)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/cfsetispeed.html)).
///
Expand Down

0 comments on commit 7ea2152

Please sign in to comment.