summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-02-21 03:31:38 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-02-21 03:31:38 +0000
commit2b9c67cca5c6113a9b8162ca7abef33269439997 (patch)
treed366fae2fb3b0291305f6790101c75351f8c9bd7
parent8d1766e5edff85ed19c6341659e58c9aa0f053a9 (diff)
parent647bac767036e68c8cc0a69a25547e6ee50994a0 (diff)
downloadnix-2b9c67cca5c6113a9b8162ca7abef33269439997.zip
Merge #825
825: FreeBSD: cfmakesane, EVFILT_* r=Susurrus a=myfreeweb Depends on: https://github.com/rust-lang/libc/pull/887
-rw-r--r--CHANGELOG.md6
-rw-r--r--src/sys/event.rs12
-rw-r--r--src/sys/socket/mod.rs7
-rw-r--r--src/sys/termios.rs13
4 files changed, 37 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11d7774b..058384f8 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 3a6c528d..e2a4eaa1 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 beef3db8..af66bc47 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 356c7769..11cacd7c 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)).
///