]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
missing: move socket related definitions to missing_socket.h
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 6 Dec 2018 05:41:34 +0000 (06:41 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 6 Dec 2018 12:25:24 +0000 (13:25 +0100)
src/basic/meson.build
src/basic/missing.h
src/basic/missing_socket.h [new file with mode: 0644]

index 764c6c9bc6b8f98a120001ad14eef0743a98baa3..17282a9befb1161d03e6a7630b24c2bb17ef3873 100644 (file)
@@ -109,6 +109,7 @@ basic_sources = files('''
         missing_prctl.h
         missing_resource.h
         missing_securebits.h
+        missing_socket.h
         missing_stat.h
         missing_syscall.h
         missing_type.h
index 3cf8d7c915fa085ebdc4ea66c527f7a74fc14d12..8d12cb318d10321eeeffa283cc46d89e56c87a2c 100644 (file)
@@ -7,26 +7,8 @@
 #include <inttypes.h>
 #include <linux/falloc.h>
 #include <stdlib.h>
-#include <sys/socket.h>
 #include <sys/syscall.h>
 
-#if HAVE_LINUX_VM_SOCKETS_H
-#include <linux/vm_sockets.h>
-#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 */
-
 #ifndef MFD_ALLOW_SEALING
 #define MFD_ALLOW_SEALING 0x0002U
 #endif
@@ -35,26 +17,10 @@ struct sockaddr_vm {
 #define MFD_CLOEXEC 0x0001U
 #endif
 
-#ifndef IP_FREEBIND
-#define IP_FREEBIND 15
-#endif
-
 #ifndef TIOCVHANGUP
 #define TIOCVHANGUP 0x5437
 #endif
 
-#ifndef IP_TRANSPARENT
-#define IP_TRANSPARENT 19
-#endif
-
-#ifndef SOL_NETLINK
-#define SOL_NETLINK 270
-#endif
-
-#ifndef SOL_SCTP
-#define SOL_SCTP 132
-#endif
-
 #ifndef GRND_NONBLOCK
 #define GRND_NONBLOCK 0x0001
 #endif
@@ -111,10 +77,6 @@ struct sockaddr_vm {
 #define MS_LAZYTIME     (1<<25)
 #endif
 
-#ifndef SCM_SECURITY
-#define SCM_SECURITY 0x03
-#endif
-
 #ifndef DM_DEFERRED_REMOVE
 #define DM_DEFERRED_REMOVE (1 << 17)
 #endif
@@ -135,14 +97,6 @@ struct sockaddr_vm {
 #  define TFD_TIMER_CANCEL_ON_SET (1 << 1)
 #endif
 
-#ifndef SO_REUSEPORT
-#  define SO_REUSEPORT 15
-#endif
-
-#ifndef SO_PEERGROUPS
-#  define SO_PEERGROUPS 59
-#endif
-
 #ifndef DRM_IOCTL_SET_MASTER
 #  define DRM_IOCTL_SET_MASTER _IO('d', 0x1e)
 #endif
@@ -159,14 +113,6 @@ struct sockaddr_vm {
 #define RENAME_NOREPLACE (1 << 0)
 #endif
 
-#ifndef SOL_ALG
-#define SOL_ALG 279
-#endif
-
-#ifndef AF_VSOCK
-#define AF_VSOCK 40
-#endif
-
 #ifndef EXT4_IOC_RESIZE_FS
 #  define EXT4_IOC_RESIZE_FS              _IOW('f', 16, __u64)
 #endif
@@ -203,6 +149,7 @@ struct sockaddr_vm {
 #include "missing_network.h"
 #include "missing_prctl.h"
 #include "missing_resource.h"
+#include "missing_socket.h"
 #include "missing_type.h"
 
 #include "missing_syscall.h"
diff --git a/src/basic/missing_socket.h b/src/basic/missing_socket.h
new file mode 100644 (file)
index 0000000..a5fd457
--- /dev/null
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <sys/socket.h>
+
+#if HAVE_LINUX_VM_SOCKETS_H
+#include <linux/vm_sockets.h>
+#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 */
+
+#ifndef AF_VSOCK
+#define AF_VSOCK 40
+#endif
+
+#ifndef SO_REUSEPORT
+#define SO_REUSEPORT 15
+#endif
+
+#ifndef SO_PEERGROUPS
+#define SO_PEERGROUPS 59
+#endif
+
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+
+#ifndef SOL_ALG
+#define SOL_ALG 279
+#endif
+
+/* Not exposed yet. Defined in include/linux/socket.h. */
+#ifndef SOL_SCTP
+#define SOL_SCTP 132
+#endif
+
+/* Not exposed yet. Defined in include/linux/socket.h */
+#ifndef SCM_SECURITY
+#define SCM_SECURITY 0x03
+#endif
+
+/* netinet/in.h */
+#ifndef IP_FREEBIND
+#define IP_FREEBIND 15
+#endif
+
+#ifndef IP_TRANSPARENT
+#define IP_TRANSPARENT 19
+#endif