From: Oliver Kurth Date: Thu, 30 Nov 2017 23:17:27 +0000 (-0800) Subject: Tools: GuestInfo: ESX: dynamically load libvmkmemstats.so X-Git-Tag: stable-10.2.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e7058028ce4352c39dcc2d3a012aa32ed50c421;p=thirdparty%2Fopen-vm-tools.git Tools: GuestInfo: ESX: dynamically load libvmkmemstats.so The new version of the vmware tools will be installed on older version of ESX. But these older versions do not come with libvmkmemstats.so and a dynamic linking error occurs. This patch changes the code to deal with the case where the lib is not available. Instead of relying on the linker to dynamically link with libvmkmemstats.so, g_module_open() is used to open the library, if available, and gracefully handle any eventual errors. Before the patch, the whole libguestinfo would stop working and after the patch only the memory stats are unavailable. --- diff --git a/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h b/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h index ad51119eb..58b8e4a20 100644 --- a/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h +++ b/open-vm-tools/services/plugins/guestInfo/guestInfoInt.h @@ -50,5 +50,8 @@ GuestInfo_GetDiskInfo(const ToolsAppCtx *ctx); void GuestInfo_FreeDiskInfo(GuestDiskInfo *di); +void +GuestInfo_StatProviderShutdown(void); + #endif /* _GUESTINFOINT_H_ */ diff --git a/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c b/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c index 9ac8b2fb8..7e8d9f47b 100644 --- a/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c +++ b/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c @@ -1698,8 +1698,11 @@ GuestInfoServerShutdown(gpointer src, gatherStatsTimeoutSource = NULL; } -#ifdef _WIN32 +#if !defined(__APPLE__) GuestInfo_StatProviderShutdown(); +#endif + +#ifdef _WIN32 NetUtil_FreeIpHlpApiDll(); #endif } diff --git a/open-vm-tools/services/plugins/guestInfo/perfMonLinux.c b/open-vm-tools/services/plugins/guestInfo/perfMonLinux.c index 99efbe031..d5ea95136 100644 --- a/open-vm-tools/services/plugins/guestInfo/perfMonLinux.c +++ b/open-vm-tools/services/plugins/guestInfo/perfMonLinux.c @@ -1309,3 +1309,27 @@ GuestInfo_StatProviderPoll(gpointer data) DynBuf_Destroy(&stats); return TRUE; } + + +/* + *---------------------------------------------------------------------- + * + * GuestInfo_StatProviderShutdown -- + * + * Clean up the resource acquired by perfMonLinux. + * Nothing to do at the moment. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +GuestInfo_StatProviderShutdown(void) +{ + // Nothing to do here for now +}