1 #if __BIONIC__
2 #include <linux/vm_sockets.h>
3 #else
4 /****************************************************************************
5  ****************************************************************************
6  ***
7  ***   This header was automatically generated from a Linux kernel header
8  ***   of the same name, to make information necessary for userspace to
9  ***   call into the kernel available to libc.  It contains only constants,
10  ***   structures, and macros generated from the original header, and thus,
11  ***   contains no copyrightable information.
12  ***
13  ***   Copied and modified from bionic/libc/kernel/uapi/linux/vm_sockets.h
14  ***
15  ****************************************************************************
16  ****************************************************************************/
17 #ifndef _UAPI_VM_SOCKETS_H
18 #define _UAPI_VM_SOCKETS_H
19 #include <linux/socket.h>
20 #define SO_VM_SOCKETS_BUFFER_SIZE 0
21 #define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1
22 #define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2
23 #define SO_VM_SOCKETS_PEER_HOST_VM_ID 3
24 #define SO_VM_SOCKETS_TRUSTED 5
25 #define SO_VM_SOCKETS_CONNECT_TIMEOUT 6
26 #define SO_VM_SOCKETS_NONBLOCK_TXRX 7
27 #define VMADDR_CID_ANY -1U
28 #define VMADDR_PORT_ANY -1U
29 #define VMADDR_CID_HYPERVISOR 0
30 #define VMADDR_CID_RESERVED 1
31 #define VMADDR_CID_HOST 2
32 #define VM_SOCKETS_INVALID_VERSION -1U
33 #define VM_SOCKETS_VERSION_EPOCH(_v) (((_v)&0xFF000000) >> 24)
34 #define VM_SOCKETS_VERSION_MAJOR(_v) (((_v)&0x00FF0000) >> 16)
35 #define VM_SOCKETS_VERSION_MINOR(_v) (((_v)&0x0000FFFF))
36 struct sockaddr_vm {
37     __kernel_sa_family_t svm_family;
38     unsigned short svm_reserved1;
39     unsigned int svm_port;
40     unsigned int svm_cid;
41     unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) -
42                            sizeof(unsigned int) - sizeof(unsigned int)];
43 };
44 #define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
45 #ifndef AF_VSOCK
46 #define AF_VSOCK 40
47 #endif
48 #endif
49 #endif
50