提交 91b423be 编写于 作者: J Jasper Lievisse Adriaanse 提交者: Roman Bogorodskiy

Use struct sockpeercred when available

OpenBSD uses 'struct sockpeercred' instead of 'struct ucred'. Add a
configure check that detects its presence and use if in the code that
could be compiled on OpenBSD.
Signed-off-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
上级 1b60f1b4
......@@ -393,6 +393,12 @@ AC_CHECK_TYPE([struct ifreq],
#include <net/if.h>
]])
AC_CHECK_TYPE([struct sockpeercred],
[AC_DEFINE([HAVE_STRUCT_SOCKPEERCRED], [1],
[Defined if struct sockpeercred is available])],
[], [[#include <sys/socket.h>
]])
AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES],
[], [], [[#include <linux/ethtool.h>
......
......@@ -1259,7 +1259,11 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
pid_t *pid,
unsigned long long *timestamp)
{
# if defined(HAVE_STRUCT_SOCKPEERCRED)
struct sockpeercred cr;
# else
struct ucred cr;
# endif
socklen_t cr_len = sizeof(cr);
int ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册