From: VMware, Inc <> Date: Fri, 12 Apr 2013 19:47:27 +0000 (-0700) Subject: Link the VMCI socket common code into the VMX. X-Git-Tag: 2013.04.16-1098359~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6c73dd8a49beff25912c9bd2ee7e2ecf419c24d4;p=thirdparty%2Fopen-vm-tools.git Link the VMCI socket common code into the VMX. Use the common VMCI socket driver code in the VMX to provide access to raw VMCI sockets. This functionality has some limitations, for example blocking calls are not possible because blocking a VMX thread can prevent the guest from making the necessary progress and cause deadlock. A new lock parameter has been added to VSockSocket_Socket to allow the caller to provide a lock for use by the socket. This is similar to the lock provided to AsyncSocket and allows an AsyncSocket and VSockSocket to share the same lock. VMCI_DatagramSend requires a needsLock parameter. This is currently hardcoded to FALSE in all cases. This may not be correct and needs to be analyzed. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/include/loglevel_user.h b/open-vm-tools/lib/include/loglevel_user.h index 0ddb0f407..6665b5f8d 100644 --- a/open-vm-tools/lib/include/loglevel_user.h +++ b/open-vm-tools/lib/include/loglevel_user.h @@ -99,6 +99,7 @@ LOGLEVEL_VAR(vcpuNUMA), \ LOGLEVEL_VAR(heci), \ LOGLEVEL_VAR(vmiopluginlib), \ + LOGLEVEL_VAR(vsock), \ \ /* user/disk */ \ LOGLEVEL_VAR(aioMgr), \ diff --git a/open-vm-tools/modules/linux/vsock/linux/vsockCommon.h b/open-vm-tools/modules/linux/vsock/linux/vsockCommon.h index ae1053667..745c8474e 100644 --- a/open-vm-tools/modules/linux/vsock/linux/vsockCommon.h +++ b/open-vm-tools/modules/linux/vsock/linux/vsockCommon.h @@ -34,7 +34,14 @@ * than external kernel modules using VMCI Sockets api inside the kernel. */ -#if defined _WIN32 +#if defined VMX86_VMX + /* + * The VMX is a very special case because hypervisor sockets do not go + * through the host kernel and thus do not require an address family. + */ +# define VMCI_SOCKETS_AF_VALUE 0 +# define VMCISockGetAFValueInt() VMCI_SOCKETS_AF_VALUE +#elif defined _WIN32 # define VMCI_SOCKETS_AF_VALUE 28 # if defined WINNT_DDK # define _WIN2K_COMPAT_SLIST_USAGE diff --git a/open-vm-tools/modules/linux/vsock/linux/vsockPacket.h b/open-vm-tools/modules/linux/vsock/linux/vsockPacket.h index 18a6a2ecc..a301338b8 100644 --- a/open-vm-tools/modules/linux/vsock/linux/vsockPacket.h +++ b/open-vm-tools/modules/linux/vsock/linux/vsockPacket.h @@ -27,13 +27,15 @@ #include "vmci_sockets_packet.h" -#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) +#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) || defined(VMX86_VMX) # include "vsockOSInt.h" #else # define VSockOS_ClearMemory(_dst, _sz) memset(_dst, 0, _sz) # define VSockOS_Memcpy(_dst, _src, _sz) memcpy(_dst, _src, _sz) #endif +#include "vsockCommon.h" + /* *----------------------------------------------------------------------------- diff --git a/open-vm-tools/modules/linux/vsock/linux/vsockSocketWrapper.h b/open-vm-tools/modules/linux/vsock/linux/vsockSocketWrapper.h index 3517dcc9d..d7fcaf740 100644 --- a/open-vm-tools/modules/linux/vsock/linux/vsockSocketWrapper.h +++ b/open-vm-tools/modules/linux/vsock/linux/vsockSocketWrapper.h @@ -64,7 +64,7 @@ #define SO_NONBLOCKING 0x1200 #endif // __APPLE__ -#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) +#if defined(_WIN32) || defined(VMKERNEL) || defined(__APPLE__) || defined(VMX86_VMX) # define SS_FREE 0 # define SS_UNCONNECTED 1 # define SS_CONNECTING 2 @@ -87,7 +87,7 @@ # define SOCKET_EVENT_CONNECT FD_CONNECT # define SOCKET_EVENT_CLOSE FD_CLOSE #else -#if defined(VMKERNEL) || defined(__APPLE__) +#if defined(VMKERNEL) || defined(__APPLE__) || defined(VMX86_VMX) # define SOCKET_EVENT_READ 0x1 # define SOCKET_EVENT_WRITE 0x2 # define SOCKET_EVENT_ACCEPT 0x8 @@ -218,6 +218,11 @@ # define ESYSNOTREADY EOPNOTSUPP #elif defined(linux) # define ESYSNOTREADY EOPNOTSUPP +# define __ELOCALSHUTDOWN EPIPE +# define __ELOCALRCVSHUTDOWN 0 +# define __EPEERSHUTDOWN EPIPE +# define __ECONNINPROGRESS EINPROGRESS +# define __ESNDRCVTIMEDOUT EAGAIN #endif // _WIN32