Skip to content

Commit d550555

Browse files
committed
Add cfmakesane() on FreeBSD
1 parent b111026 commit d550555

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5252
([#814](https://github.com/nix-rust/nix/pull/814))
5353
- Added `EVFILT_EMPTY`, `EVFILT_PROCDESC` and `EVFILT_SENDFILE` on FreeBSD.
5454
([#825](https://github.com/nix-rust/nix/pull/825))
55+
- Exposed `termios::cfmakesane` on FreeBSD.
56+
([#825](https://github.com/nix-rust/nix/pull/825))
5557

5658
### Changed
5759
- Use native `pipe2` on all BSD targets. Users should notice no difference.

src/sys/termios.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,18 @@ pub fn cfmakeraw(termios: &mut Termios) {
793793
termios.update_wrapper();
794794
}
795795

796+
/// Configures the port to "sane" mode (like the configuration of a newly created terminal).
797+
///
798+
/// Note that this is a non-standard function, available on FreeBSD.
799+
#[cfg(target_os = "freebsd")]
800+
pub fn cfmakesane(termios: &mut Termios) {
801+
let inner_termios = unsafe { termios.get_libc_termios_mut() };
802+
unsafe {
803+
libc::cfmakesane(inner_termios);
804+
}
805+
termios.update_wrapper();
806+
}
807+
796808
/// Set input baud rate (see
797809
/// [cfsetispeed(3p)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/cfsetispeed.html)).
798810
///

0 commit comments

Comments
 (0)