aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-19 01:12:39 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-19 01:12:39 +0000
commitb03bef41fe767490ba3aa0d515defeb01c2e7695 (patch)
tree02f38cf7a980210feaebf1207f113cec1d7f42e5
parent945daa2d20f65d68df44ab5193c7e7e0c846c3c7 (diff)
parentb1dbb1d2a24042d84dc2cfcaeebb1f7be33a3e34 (diff)
downloadgrpc-grpc-android-vts-11.0_r10.tar.gz
Snap for 6606167 from b1dbb1d2a24042d84dc2cfcaeebb1f7be33a3e34 to rvc-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-vts-11.0_r1android-security-11.0.0_r76android-security-11.0.0_r75android-security-11.0.0_r74android-security-11.0.0_r73android-security-11.0.0_r72android-security-11.0.0_r71android-security-11.0.0_r70android-security-11.0.0_r69android-security-11.0.0_r68android-security-11.0.0_r67android-security-11.0.0_r66android-security-11.0.0_r65android-security-11.0.0_r64android-security-11.0.0_r63android-security-11.0.0_r62android-security-11.0.0_r61android-security-11.0.0_r60android-security-11.0.0_r59android-security-11.0.0_r58android-security-11.0.0_r57android-security-11.0.0_r56android-security-11.0.0_r55android-security-11.0.0_r54android-security-11.0.0_r53android-security-11.0.0_r52android-security-11.0.0_r51android-security-11.0.0_r50android-security-11.0.0_r49android-security-11.0.0_r1android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r2android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android-cts-11.0_r1android-11.0.0_r5android-11.0.0_r4android-11.0.0_r3android-11.0.0_r25android-11.0.0_r2android-11.0.0_r17android-11.0.0_r1android11-tests-releaseandroid11-security-releaseandroid11-s1-releaseandroid11-release
Change-Id: Icd288071bf72b0a6889a50fac88773d5af0ef48d
-rw-r--r--src/core/ext/filters/client_channel/parse_address.cc4
-rw-r--r--src/core/lib/iomgr/sockaddr_posix.h8
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix.cc7
-rw-r--r--src/core/lib/iomgr/vm_sockets.h44
4 files changed, 51 insertions, 12 deletions
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index c737f53d01..b49d2a6b3a 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -26,10 +26,6 @@
#include <string.h>
#ifdef GRPC_HAVE_UNIX_SOCKET
#include <sys/un.h>
-#ifdef GRPC_HAVE_LINUX_VSOCK
-#include <sys/socket.h>
-#include <linux/vm_sockets.h>
-#endif /* GRPC_HAVE_LINUX_VSOCK */
#endif
#include <grpc/support/alloc.h>
diff --git a/src/core/lib/iomgr/sockaddr_posix.h b/src/core/lib/iomgr/sockaddr_posix.h
index e32fc9a219..9ad9abe26f 100644
--- a/src/core/lib/iomgr/sockaddr_posix.h
+++ b/src/core/lib/iomgr/sockaddr_posix.h
@@ -51,7 +51,13 @@ typedef struct in6_addr grpc_in6_addr;
#ifdef GRPC_HAVE_LINUX_VSOCK
#include <linux/vm_sockets.h> // Needs to come after sys/socket.h
#define GRPC_AF_VSOCK AF_VSOCK
-#endif /* GRPC_HAVE_LINUX_VSOCK */
+#elif GPR_ANDROID
+// HACK(chenhaosjtuacm): when building host services for run_cvd, the glibc version of Android
+// toolchain is too low, using the header copied from bionic libc instead
+#include "vm_sockets.h"
+#define GRPC_HAVE_LINUX_VSOCK
+#define GRPC_AF_VSOCK AF_VSOCK
+#endif
#define GRPC_AI_PASSIVE AI_PASSIVE
diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc
index cf93a7d9c4..6541b58dc5 100644
--- a/src/core/lib/iomgr/unix_sockets_posix.cc
+++ b/src/core/lib/iomgr/unix_sockets_posix.cc
@@ -19,13 +19,6 @@
#include "src/core/lib/iomgr/port.h"
-#ifdef GRPC_HAVE_LINUX_VSOCK
-
-#include <sys/socket.h>
-#include <linux/vm_sockets.h>
-
-#endif /* GRPC_HAVE_LINUX_VSOCK */
-
#ifdef GRPC_HAVE_UNIX_SOCKET
#include "src/core/lib/iomgr/sockaddr.h"
diff --git a/src/core/lib/iomgr/vm_sockets.h b/src/core/lib/iomgr/vm_sockets.h
new file mode 100644
index 0000000000..151f6769d1
--- /dev/null
+++ b/src/core/lib/iomgr/vm_sockets.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** Copied and modified from bionic/libc/kernel/uapi/linux/vm_sockets.h
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_VM_SOCKETS_H
+#define _UAPI_VM_SOCKETS_H
+#include <linux/socket.h>
+#define SO_VM_SOCKETS_BUFFER_SIZE 0
+#define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1
+#define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2
+#define SO_VM_SOCKETS_PEER_HOST_VM_ID 3
+#define SO_VM_SOCKETS_TRUSTED 5
+#define SO_VM_SOCKETS_CONNECT_TIMEOUT 6
+#define SO_VM_SOCKETS_NONBLOCK_TXRX 7
+#define VMADDR_CID_ANY - 1U
+#define VMADDR_PORT_ANY - 1U
+#define VMADDR_CID_HYPERVISOR 0
+#define VMADDR_CID_RESERVED 1
+#define VMADDR_CID_HOST 2
+#define VM_SOCKETS_INVALID_VERSION - 1U
+#define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24)
+#define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16)
+#define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF))
+struct sockaddr_vm {
+ __kernel_sa_family_t svm_family;
+ unsigned short svm_reserved1;
+ unsigned int svm_port;
+ unsigned int svm_cid;
+ unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) - sizeof(unsigned int) - sizeof(unsigned int)];
+};
+#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
+#ifndef AF_VSOCK
+#define AF_VSOCK 40
+#endif
+#endif