From dd6bbfc14c20df55461965ae6108cc6184263712 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 10 Jan 2017 13:35:18 +0000 Subject: [PATCH 1/1] missing.h: add AF_VSOCK bits Ubuntu 14.04 (Trusty) kernel header packages ship without . Only struct sockaddr_vm and VMADDR_CID_ANY will be needed by elogind and they are simple enough to go in missing.h. CentOS 7 does not define AF_VSOCK. Define it so the code can compile although actual socket(2) calls may fail at runtime if the address family isn't available. --- src/basic/missing.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/basic/missing.h b/src/basic/missing.h index 50c9e7cd8..beadd70ac 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,23 @@ #include #endif +#ifdef HAVE_LINUX_VM_SOCKETS_H +#include +#else +#define VMADDR_CID_ANY -1U +struct sockaddr_vm { + unsigned short svm_family; + unsigned short svm_reserved1; + unsigned int svm_port; + unsigned int svm_cid; + unsigned char svm_zero[sizeof(struct sockaddr) - + sizeof(unsigned short) - + sizeof(unsigned short) - + sizeof(unsigned int) - + sizeof(unsigned int)]; +}; +#endif /* !HAVE_LINUX_VM_SOCKETS_H */ + #include "macro.h" #ifndef RLIMIT_RTTIME @@ -1172,4 +1190,8 @@ struct ethtool_link_settings { #define SOL_ALG 279 #endif +#ifndef AF_VSOCK +#define AF_VSOCK 40 +#endif + #include "missing_syscall.h" -- 2.30.2