diff --git a/CHANGELOG.md b/CHANGELOG.md index 02518d27d0..9d840c9e12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/sys/termios.rs b/src/sys/termios.rs index b768caa8ba..cb3fac926d 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -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)). ///