diff options
author | Hao Chen <chenhaosjtuacm@google.com> | 2020-06-18 20:08:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-18 20:08:18 +0000 |
commit | d11d14cd1120bd35793d55026121816089c3ba5b (patch) | |
tree | 02f38cf7a980210feaebf1207f113cec1d7f42e5 | |
parent | 5696073f320780c7e6a080711c1c97e6f56a664d (diff) | |
parent | b1dbb1d2a24042d84dc2cfcaeebb1f7be33a3e34 (diff) | |
download | grpc-grpc-d11d14cd1120bd35793d55026121816089c3ba5b.tar.gz |
Add bionic vm_sockets header am: b1dbb1d2a2android-mainline-11.0.0_r44android-mainline-11.0.0_r43android-mainline-11.0.0_r42android-mainline-11.0.0_r41android-mainline-11.0.0_r40android-mainline-11.0.0_r39android-mainline-11.0.0_r38android-mainline-11.0.0_r37android-mainline-11.0.0_r36android-mainline-11.0.0_r35android-mainline-11.0.0_r34android-mainline-11.0.0_r32android-mainline-11.0.0_r31android-mainline-11.0.0_r30android-mainline-11.0.0_r28android-mainline-11.0.0_r27android-mainline-11.0.0_r26android-mainline-11.0.0_r25android-mainline-11.0.0_r24android-mainline-11.0.0_r23android-mainline-11.0.0_r22android-mainline-11.0.0_r21android-mainline-11.0.0_r20android-mainline-11.0.0_r18android-mainline-11.0.0_r17android-mainline-11.0.0_r16android-mainline-11.0.0_r15android-mainline-11.0.0_r14android-mainline-11.0.0_r13android-mainline-11.0.0_r12android11-mainline-tethering-releaseandroid11-mainline-permission-releaseandroid11-mainline-os-statsd-releaseandroid11-mainline-networkstack-releaseandroid11-mainline-media-swcodec-releaseandroid11-mainline-media-releaseandroid11-mainline-extservices-releaseandroid11-mainline-documentsui-releaseandroid11-mainline-conscrypt-releaseandroid11-mainline-cellbroadcast-releaseandroid11-mainline-captiveportallogin-release
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/grpc-grpc/+/11889505
Change-Id: I3f4078149d2e3acba7cefc789404712f13e17307
-rw-r--r-- | src/core/ext/filters/client_channel/parse_address.cc | 4 | ||||
-rw-r--r-- | src/core/lib/iomgr/sockaddr_posix.h | 8 | ||||
-rw-r--r-- | src/core/lib/iomgr/unix_sockets_posix.cc | 7 | ||||
-rw-r--r-- | src/core/lib/iomgr/vm_sockets.h | 44 |
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 |