Skip to content

Commit

Permalink
Merge #825
Browse files Browse the repository at this point in the history
825: FreeBSD: cfmakesane, EVFILT_* r=Susurrus a=myfreeweb

Depends on: rust-lang/libc#887
  • Loading branch information
bors[bot] committed Feb 21, 2018
2 parents 8d1766e + 647bac7 commit 2b9c67c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions src/sys/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/sys/termios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
///
Expand Down

0 comments on commit 2b9c67c

Please sign in to comment.