]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
linux: include sys/socket.h in linux/vm_sockets.h
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Apr 2025 03:21:24 +0000 (12:21 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 30 Apr 2025 05:37:34 +0000 (07:37 +0200)
The header requires struct sockaddr declared. So, otherwise, we need to
include sys/socket.h earlier than linux/vm_sockets.h.
Let's make the header includable at any place.

src/basic/include/linux/update.sh
src/basic/include/linux/vm_sockets.h
src/basic/socket-util.h

index 31dcddaf95df666f66ae60cd6bcefbfa1dd59be6..8976a185c80a2af0e288e0f43ddbe98c25b0d7f7 100755 (executable)
@@ -29,5 +29,9 @@ for i in *.h */*.h; do
             # add casts in ethtool_cmd_speed()
             sed -r -i '/return (ep->speed_hi << 16) | ep->speed;/ s/return .*;/return ((__u32) ep->speed_hi << 16) | (__u32) ep->speed;/' "$i"
             ;;
+        vm_sockets.h)
+            # the header requires struct sockaddr declared
+            sed -r -i '/#define _VM_SOCKETS_H/a \\n#include <sys/socket.h>' "$i"
+            ;;
     esac
 done
index aa3ec6516c7843f9a87237339e330044a7de2341..2579fef57215e354444ee343210e39594c5bfb62 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _VM_SOCKETS_H
 #define _VM_SOCKETS_H
 
+#include <sys/socket.h>
+
 #include <linux/socket.h>
 #include <linux/types.h>
 
index c5e389ca3a7467666cc194a58282916c5a8e1aaf..d0aedb524e80085e16d8885896ec9d339c42ec9c 100644 (file)
@@ -6,12 +6,12 @@
 #include <linux/if_infiniband.h>
 #include <linux/if_packet.h>
 #include <linux/netlink.h>
-#include <sys/socket.h> /* linux/vms_sockets.h requires 'struct sockaddr' */
 #include <linux/vm_sockets.h>
 #include <netinet/in.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <string.h>
+#include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/un.h>