From 836f4e065989868e7257e3989ea09054034e6c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 24 Jun 2019 11:48:12 +0100 Subject: [PATCH] rpc: add helper API for getting UNIX path from socket object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- src/libvirt_remote.syms | 1 + src/rpc/virnetsocket.c | 8 ++++++++ src/rpc/virnetsocket.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index b63eac123f..99fe3dd07c 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -219,6 +219,7 @@ virNetSocketCheckProtocols; virNetSocketClose; virNetSocketDupFD; virNetSocketGetFD; +virNetSocketGetPath; virNetSocketGetPort; virNetSocketGetSELinuxContext; virNetSocketGetUNIXIdentity; diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index bfa1952989..254f39c4ec 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1408,6 +1408,14 @@ bool virNetSocketHasPassFD(virNetSocketPtr sock) return hasPassFD; } +char *virNetSocketGetPath(virNetSocketPtr sock) +{ + char *path = NULL; + virObjectLock(sock); + path = virSocketAddrGetPath(&sock->localAddr); + virObjectUnlock(sock); + return path; +} int virNetSocketGetPort(virNetSocketPtr sock) { diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h index 343c8f43e0..de5a465cde 100644 --- a/src/rpc/virnetsocket.h +++ b/src/rpc/virnetsocket.h @@ -127,6 +127,7 @@ bool virNetSocketIsLocal(virNetSocketPtr sock); bool virNetSocketHasPassFD(virNetSocketPtr sock); +char *virNetSocketGetPath(virNetSocketPtr sock); int virNetSocketGetPort(virNetSocketPtr sock); int virNetSocketGetUNIXIdentity(virNetSocketPtr sock, -- GitLab