[LTP] [PATCH v2 1/2] lapi: add struct sockaddr_vm fallback

Andrea Cervesato andrea.cervesato@suse.de
Tue Sep 23 10:40:59 CEST 2025


From: Andrea Cervesato <andrea.cervesato@suse.com>

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 configure.ac              |  2 ++
 include/lapi/vm_sockets.h | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 62ae27d494474fe342b1cceeac7f4c21c0b1028c..813f4c8525ea8f79852a419375ad797cb9fe2f50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,8 @@ AC_CHECK_TYPES([struct file_attr],,,[#include <linux/fs.h>])
 
 AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>])
 
+AC_CHECK_TYPES([struct sockaddr_vm],,,[#include <linux/vm_sockets.h>])
+
 # Tools knobs
 
 # Bash
diff --git a/include/lapi/vm_sockets.h b/include/lapi/vm_sockets.h
index 07884e538688569b5325b251fd629f20e44c1cdb..fda8c3156dc34b39fc2e91fba090bff00e209fc0 100644
--- a/include/lapi/vm_sockets.h
+++ b/include/lapi/vm_sockets.h
@@ -7,6 +7,7 @@
 #define LAPI_VM_SOCKETS_H__
 
 #include <sys/socket.h>
+#include "config.h"
 
 #if HAVE_LINUX_VM_SOCKETS_H
 #  include <linux/vm_sockets.h>
@@ -16,4 +17,20 @@
 #  define VMADDR_CID_LOCAL 1
 #endif
 
+#ifndef HAVE_STRUCT_SOCKADDR_VM
+struct sockaddr_vm {
+	unsigned short svm_family;
+	unsigned short svm_reserved1;
+	unsigned int svm_port;
+	unsigned int svm_cid;
+	unsigned char svm_flags;
+	unsigned char svm_zero[sizeof(struct sockaddr) -
+			       sizeof(sa_family_t) -
+			       sizeof(unsigned short) -
+			       sizeof(unsigned int) -
+			       sizeof(unsigned int) -
+			       sizeof(unsigned char)];
+};
+#endif
+
 #endif /* LAPI_VM_SOCKETS_H__ */

-- 
2.51.0



More information about the ltp mailing list