]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Tools: GuestInfo: ESX: dynamically load libvmkmemstats.so
authorOliver Kurth <okurth@vmware.com>
Thu, 30 Nov 2017 23:17:27 +0000 (15:17 -0800)
committerOliver Kurth <okurth@vmware.com>
Thu, 30 Nov 2017 23:17:27 +0000 (15:17 -0800)
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.

open-vm-tools/services/plugins/guestInfo/guestInfoInt.h
open-vm-tools/services/plugins/guestInfo/guestInfoServer.c
open-vm-tools/services/plugins/guestInfo/perfMonLinux.c

index ad51119eb572a9ee0d66462510423595e50c3eb7..58b8e4a208b5a5698b0139973972e2c7fca2861e 100644 (file)
@@ -50,5 +50,8 @@ GuestInfo_GetDiskInfo(const ToolsAppCtx *ctx);
 void
 GuestInfo_FreeDiskInfo(GuestDiskInfo *di);
 
+void
+GuestInfo_StatProviderShutdown(void);
+
 #endif /* _GUESTINFOINT_H_ */
 
index 9ac8b2fb8dc2f40f9be0bb2fa69f8578b39151b8..7e8d9f47bd81b22c41767007d231ff4141a381fc 100644 (file)
@@ -1698,8 +1698,11 @@ GuestInfoServerShutdown(gpointer src,
       gatherStatsTimeoutSource = NULL;
    }
 
-#ifdef _WIN32
+#if !defined(__APPLE__)
    GuestInfo_StatProviderShutdown();
+#endif
+
+#ifdef _WIN32
    NetUtil_FreeIpHlpApiDll();
 #endif
 }
index 99efbe031c827c493f5e25be3aa6fa42809b38e7..d5ea9513657e68f1be70ff8ae0297fbc3e06e528 100644 (file)
@@ -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
+}