Pass the pid value when invoking virNetSocketNew(). This will make
libvirt.rpc.socket_new stap probe return the right pid.
Signed-off-by: Jincheng Miao <jmiao(a)redhat.com>
---
src/rpc/virnetsocket.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 04bf25a..4c98fa9 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -300,7 +300,8 @@ int virNetSocketNewListenTCP(const char *nodename,
if (VIR_EXPAND_N(socks, nsocks, 1) < 0)
goto error;
- if (!(socks[nsocks-1] = virNetSocketNew(&addr, NULL, false, fd, -1, 0)))
+ if (!(socks[nsocks-1] = virNetSocketNew(&addr, NULL, false, fd, -1,
+ getpid())))
goto error;
runp = runp->ai_next;
fd = -1;
@@ -382,7 +383,7 @@ int virNetSocketNewListenUNIX(const char *path,
goto error;
}
- if (!(*retsock = virNetSocketNew(&addr, NULL, false, fd, -1, 0)))
+ if (!(*retsock = virNetSocketNew(&addr, NULL, false, fd, -1, getpid())))
goto error;
return 0;
@@ -420,7 +421,7 @@ int virNetSocketNewListenFD(int fd,
return -1;
}
- if (!(*retsock = virNetSocketNew(&addr, NULL, false, fd, -1, 0)))
+ if (!(*retsock = virNetSocketNew(&addr, NULL, false, fd, -1, getpid())))
return -1;
return 0;
@@ -497,7 +498,8 @@ int virNetSocketNewConnectTCP(const char *nodename,
goto error;
}
- if (!(*retsock = virNetSocketNew(&localAddr, &remoteAddr, true, fd, -1, 0)))
+ if (!(*retsock = virNetSocketNew(&localAddr, &remoteAddr, true, fd, -1,
+ getpid())))
goto error;
freeaddrinfo(ai);
@@ -574,7 +576,8 @@ retry:
goto error;
}
- if (!(*retsock = virNetSocketNew(&localAddr, &remoteAddr, true, fd, -1, 0)))
+ if (!(*retsock = virNetSocketNew(&localAddr, &remoteAddr, true, fd, -1,
+ getpid())))
goto error;
return 0;
@@ -1741,7 +1744,8 @@ int virNetSocketAccept(virNetSocketPtr sock, virNetSocketPtr
*clientsock)
if (!(*clientsock = virNetSocketNew(&localAddr,
&remoteAddr,
true,
- fd, -1, 0)))
+ fd, -1,
+ getpid())))
goto cleanup;
fd = -1;
--
1.8.3.1