diff --git a/CHANGELOG.md b/CHANGELOG.md index 11d7774b17..058384f8c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ This project adheres to [Semantic Versioning](http://semver.org/). ([#853](https://github.com/nix-rust/nix/pull/853)) - Added `statvfs` module to all MacOS and Linux architectures. ([#832](https://github.com/nix-rust/nix/pull/832)) +- Added `EVFILT_EMPTY`, `EVFILT_PROCDESC` and `EVFILT_SENDFILE` on FreeBSD. + ([#825](https://github.com/nix-rust/nix/pull/825)) +- Exposed `termios::cfmakesane` on FreeBSD. + ([#825](https://github.com/nix-rust/nix/pull/825)) +- Exposed `MSG_CMSG_CLOEXEC` on *BSD. + ([#825](https://github.com/nix-rust/nix/pull/825)) ### Changed - Display and Debug for SysControlAddr now includes all fields. diff --git a/src/sys/event.rs b/src/sys/event.rs index 3a6c528d85..e2a4eaa16e 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -40,6 +40,9 @@ libc_enum! { #[cfg_attr(not(target_os = "netbsd"), repr(i16))] pub enum EventFilter { EVFILT_AIO, + /// Returns whenever there is no remaining data in the write buffer + #[cfg(target_os = "freebsd")] + EVFILT_EMPTY, #[cfg(target_os = "dragonfly")] EVFILT_EXCEPT, #[cfg(any(target_os = "dragonfly", @@ -52,7 +55,16 @@ libc_enum! { #[cfg(any(target_os = "ios", target_os = "macos"))] EVFILT_MACHPORT, EVFILT_PROC, + /// Returns events associated with the process referenced by a given + /// process descriptor, created by `pdfork()`. The events to monitor are: + /// + /// - NOTE_EXIT: the process has exited. The exit status will be stored in data. + #[cfg(target_os = "freebsd")] + EVFILT_PROCDESC, EVFILT_READ, + /// Returns whenever an asynchronous `sendfile()` call completes. + #[cfg(target_os = "freebsd")] + EVFILT_SENDFILE, EVFILT_SIGNAL, EVFILT_TIMER, #[cfg(any(target_os = "dragonfly", diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index beef3db804..af66bc4715 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -163,7 +163,12 @@ libc_bitflags!{ /// [open(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html). /// /// Only used in [`recvmsg`](fn.recvmsg.html) function. - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "netbsd", + target_os = "openbsd"))] MSG_CMSG_CLOEXEC; } } diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 356c7769bb..11cacd7c57 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -1023,6 +1023,19 @@ pub fn cfmakeraw(termios: &mut Termios) { termios.update_wrapper(); } +/// Configures the port to "sane" mode (like the configuration of a newly created terminal) (see +/// [tcsetattr(3)](https://www.freebsd.org/cgi/man.cgi?query=tcsetattr)). +/// +/// Note that this is a non-standard function, available on FreeBSD. +#[cfg(target_os = "freebsd")] +pub fn cfmakesane(termios: &mut Termios) { + let inner_termios = unsafe { termios.get_libc_termios_mut() }; + unsafe { + libc::cfmakesane(inner_termios); + } + termios.update_wrapper(); +} + /// Return the configuration of a port /// [tcgetattr(3p)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetattr.html)). ///