Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: cfmakesane, EVFILT_* #825

Merged
merged 3 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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