From 4e6dd2429732941641382af2ff6d46dfddfe8113 Mon Sep 17 00:00:00 2001 From: James Brown Date: Fri, 6 Jan 2017 13:34:08 -0800 Subject: [PATCH] Add getpeereid function This is a wrapper around getsockopt() for getting the uid/gid of a remote Unix domain socket peer. It was added in FreeBSD 4.6 and present in all modern BSDs I checked (including Mac OS X). --- src/unix/bsd/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index c7997ef5e951f..2f7024f8276a0 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -355,6 +355,10 @@ extern { pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); + + pub fn getpeereid(socket: ::c_int, + euid: *mut ::uid_t, + egid: *mut ::gid_t) -> ::c_int; } cfg_if! {