Skip to content

Commit

Permalink
Merge #921
Browse files Browse the repository at this point in the history
921: Get `SO_PEERCRED` working on all Linux targets r=asomers a=jonas-schievink

These were disabled for ARM way back in 0db6ed1 and 09c00ed. Try to enable them for all arches and Android as well, since the removal wasn't really explained and I see no reason why this shouldn't work.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
  • Loading branch information
bors[bot] and jonas-schievink committed Jul 5, 2018
2 parents 90b1c17 + 594b924 commit c1ee0d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Added a `sysinfo` wrapper.
([#922](https://github.com/nix-rust/nix/pull/922))
- Support the `SO_PEERCRED` socket option and the `UnixCredentials` type on all Linux and Android targets.
([#921](https://github.com/nix-rust/nix/pull/921))

### Changed

Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ libc_bitflags!{
}

cfg_if! {
if #[cfg(all(target_os = "linux", not(target_arch = "arm")))] {
if #[cfg(any(target_os = "android", target_os = "linux"))] {
/// Unix credentials of the sending process.
///
/// This struct is used with the `SO_PEERCRED` ancillary message for UNIX sockets.
Expand Down
4 changes: 2 additions & 2 deletions src/sys/socket/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ sockopt_impl!(Both, Broadcast, libc::SOL_SOCKET, libc::SO_BROADCAST, bool);
sockopt_impl!(Both, OobInline, libc::SOL_SOCKET, libc::SO_OOBINLINE, bool);
sockopt_impl!(GetOnly, SocketError, libc::SOL_SOCKET, libc::SO_ERROR, i32);
sockopt_impl!(Both, KeepAlive, libc::SOL_SOCKET, libc::SO_KEEPALIVE, bool);
#[cfg(all(target_os = "linux", not(target_arch="arm")))]
#[cfg(any(target_os = "android", target_os = "linux"))]
sockopt_impl!(GetOnly, PeerCredentials, libc::SOL_SOCKET, libc::SO_PEERCRED, super::UnixCredentials);
#[cfg(any(target_os = "ios",
target_os = "macos"))]
Expand Down Expand Up @@ -478,7 +478,7 @@ unsafe impl<'a> Set<'a, usize> for SetUsize {

#[cfg(test)]
mod test {
#[cfg(all(target_os = "linux", not(target_arch = "arm")))]
#[cfg(any(target_os = "android", target_os = "linux"))]
#[test]
fn can_get_peercred_on_unix_socket() {
use super::super::*;
Expand Down

0 comments on commit c1ee0d0

Please sign in to comment.