Skip to content

Commit c1ee0d0

Browse files
Merge #921
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 <[email protected]>
2 parents 90b1c17 + 594b924 commit c1ee0d0

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99
- Added a `sysinfo` wrapper.
1010
([#922](https://github.com/nix-rust/nix/pull/922))
11+
- Support the `SO_PEERCRED` socket option and the `UnixCredentials` type on all Linux and Android targets.
12+
([#921](https://github.com/nix-rust/nix/pull/921))
1113

1214
### Changed
1315

src/sys/socket/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ libc_bitflags!{
173173
}
174174

175175
cfg_if! {
176-
if #[cfg(all(target_os = "linux", not(target_arch = "arm")))] {
176+
if #[cfg(any(target_os = "android", target_os = "linux"))] {
177177
/// Unix credentials of the sending process.
178178
///
179179
/// This struct is used with the `SO_PEERCRED` ancillary message for UNIX sockets.

src/sys/socket/sockopt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ sockopt_impl!(Both, Broadcast, libc::SOL_SOCKET, libc::SO_BROADCAST, bool);
225225
sockopt_impl!(Both, OobInline, libc::SOL_SOCKET, libc::SO_OOBINLINE, bool);
226226
sockopt_impl!(GetOnly, SocketError, libc::SOL_SOCKET, libc::SO_ERROR, i32);
227227
sockopt_impl!(Both, KeepAlive, libc::SOL_SOCKET, libc::SO_KEEPALIVE, bool);
228-
#[cfg(all(target_os = "linux", not(target_arch="arm")))]
228+
#[cfg(any(target_os = "android", target_os = "linux"))]
229229
sockopt_impl!(GetOnly, PeerCredentials, libc::SOL_SOCKET, libc::SO_PEERCRED, super::UnixCredentials);
230230
#[cfg(any(target_os = "ios",
231231
target_os = "macos"))]
@@ -478,7 +478,7 @@ unsafe impl<'a> Set<'a, usize> for SetUsize {
478478

479479
#[cfg(test)]
480480
mod test {
481-
#[cfg(all(target_os = "linux", not(target_arch = "arm")))]
481+
#[cfg(any(target_os = "android", target_os = "linux"))]
482482
#[test]
483483
fn can_get_peercred_on_unix_socket() {
484484
use super::super::*;

0 commit comments

Comments
 (0)