diff options
author | Mathieu Parent <math.parent@gmail.com> | 2011-11-05 19:04:40 +0100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2011-12-06 11:57:11 +1100 |
commit | bb3d6698e91a3971dd7e7470666864c8213cbaf7 (patch) | |
tree | 5a9505f36567bf80bee4efd7d8768cbcc865b035 /ctdb/common/system_linux.c | |
parent | 4ce585cd0e07f6669cb31d822d280d0e7499a2dc (diff) | |
download | samba-bb3d6698e91a3971dd7e7470666864c8213cbaf7.tar.gz |
Move platform-specific code to common/system_*
This removes #ifdef AIX and ease the addition of new platforms.
(This used to be ctdb commit 2fd1067a075fe0e4b2a36d4ea18af139d03f17bf)
Diffstat (limited to 'ctdb/common/system_linux.c')
-rw-r--r-- | ctdb/common/system_linux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c index ca2d47580ba..cb26dcd654b 100644 --- a/ctdb/common/system_linux.c +++ b/ctdb/common/system_linux.c @@ -563,3 +563,15 @@ bool ctdb_sys_check_iface_exists(const char *iface) return true; } + +int ctdb_get_peer_pid(const int fd, pid_t *peer_pid) +{ + struct ucred cr; + socklen_t crl = sizeof(struct ucred); + int ret; + if ((ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &crl) == 0)) { + peer_pid = cr.pid; + } + return ret; +} + |