diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-02-09 01:47:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-09 01:47:12 +0000 |
commit | c42b6494d664463c03b2a96431bc500a53be5e49 (patch) | |
tree | 5a4bf9cfc1e32518e701069355b700c1ba7d2f78 /src | |
parent | 348e2387938938b9de46886494f2c799893f2a12 (diff) | |
parent | 960199daf9f395096b08dc24aa0337cb5b93da81 (diff) | |
download | nix-c42b6494d664463c03b2a96431bc500a53be5e49.zip |
Merge #1967
1967: Added LOCAL_PEERPID/LocalPeerPid sockopt for macos r=asomers a=mitsuhiko
macOS has a badly documented `LOCAL_PEERPID` sockopt that can be used to retrieve the PID of the connected peer.
I intentionally only added this for macOS because I know it exists there, and I'm not sure about ios yet even if it exists there, it's doubtful that the PID information gets any use there.
Co-authored-by: Armin Ronacher <armin.ronacher@active-4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/socket/sockopt.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index dd24208f..90216649 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -492,6 +492,15 @@ sockopt_impl!( libc::LOCAL_PEERCRED, super::XuCred ); +#[cfg(any(target_os = "macos", target_os = "ios"))] +sockopt_impl!( + /// Get the PID of the peer process of a connected unix domain socket. + LocalPeerPid, + GetOnly, + 0, + libc::LOCAL_PEERPID, + libc::c_int +); #[cfg(any(target_os = "android", target_os = "linux"))] sockopt_impl!( /// Return the credentials of the foreign process connected to this socket. |