]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Minor improvements to vmtoolsd and public interfaces.
authorVMware, Inc <>
Tue, 17 Nov 2009 22:10:19 +0000 (14:10 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 17 Nov 2009 22:10:19 +0000 (14:10 -0800)
. constify ToolsAppCapability::name.
. skip files that don't end with the platform's shared library extension
when loading plugins
. compile with "-subsystem:windows" on Win32; to allow logging to a
console, add new command line flag that attaches to the parent's
console and redirects standard output streams.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/vmware/tools/plugin.h
open-vm-tools/services/vmtoolsd/cmdLine.c
open-vm-tools/services/vmtoolsd/mainLoop.c
open-vm-tools/services/vmtoolsd/pluginMgr.c
open-vm-tools/services/vmtoolsd/toolsCoreInt.h

index 4d87efe426bc8da794987b2a88f0bdc0212ac9a5..c8d6d94fccec5f53f6580de8a08a30eb6587165f 100644 (file)
@@ -259,7 +259,7 @@ typedef struct ToolsAppCapability {
     * For old-style, the capability name. The RPC message for setting the
     * capability will be "tools.capability.[name]". Ignored for TOOLS_CAP_NEW.
     */
-   gchar               *name;
+   const gchar         *name;
    /**
     * The capability entry in the enum defined in guestCaps.h.
     * Used only for TOOLS_CAP_NEW.
index 6cbd6046461205888165114146424be34d3e9740..13b13574696bc3be5bcc5c382a092a343369c4f5 100644 (file)
@@ -193,6 +193,8 @@ ToolsCore_ParseCommandLine(ToolsServiceState *state,
          N_("Uninstalls the service from the Service Control Manager."), NULL },
       { "displayname", 'd', 0, G_OPTION_ARG_STRING, &state->displayName,
          N_("Service display name (only used with -i)."), N_("name") },
+      { "console", '\0', 0, G_OPTION_ARG_NONE, &state->useConsole,
+         N_("Use the parent process's console window."), NULL },
 #else
       { "background", 'b', 0, G_OPTION_ARG_FILENAME, &state->pidFile,
          N_("Runs in the background and creates a pid file."), N_("pidfile") },
index 6ae9aa02796aa4a97183d7ebc9ac8a96c8fd8709..49b231b99729b292cd00b5404008f55b15945d6a 100644 (file)
  */
 
 #if defined(_WIN32)
-#  define MODULE_NAME(x)   #x ".dll"
-#elif defined(__APPLE__)
-#  define MODULE_NAME(x)   "lib" #x ".dylib"
+#  define MODULE_NAME(x)   #x G_MODULE_SUFFIX
 #else
-#  define MODULE_NAME(x)   "lib" #x ".so"
+#  define MODULE_NAME(x)   "lib" #x G_MODULE_SUFFIX
 #endif
 
 #include <stdlib.h>
index 95f17c4c81257e3d8290d24411040d3d94d8e588..caef9b5f3e6eef95d1bdaa10d55a76ccafa5c549 100644 (file)
@@ -384,7 +384,9 @@ ToolsCoreLoadDirectory(ToolsAppCtx *ctx,
     * regardless of how the filesystem returns entries.
     */
    while ((staticEntry = g_dir_read_name(dir)) != NULL) {
-      g_ptr_array_add(plugins, g_strdup(staticEntry));
+      if (g_str_has_suffix(staticEntry, "." G_MODULE_SUFFIX)) {
+         g_ptr_array_add(plugins, g_strdup(staticEntry));
+      }
    }
 
    g_dir_close(dir);
index 1dc8dc8a34f26c079daf5b59794d4115773a47cd..c127698aab7d60728929befeb242ae3bc9db17e6 100644 (file)
 #  define DUMP_STATE_EVENT_NAME_FMT   L"Global\\VMwareToolsDumpStateEvent_%s"
 #endif
 
+/* On Mac OS, G_MODULE_SUFFIX seems to be defined to "so"... */
+#if defined(__APPLE__)
+#  if defined(G_MODULE_SUFFIX)
+#     undef G_MODULE_SUFFIX
+#  endif
+#  define G_MODULE_SUFFIX "dylib"
+#endif
+
 /** Defines the internal data about a plugin. */
 typedef struct ToolsPlugin {
    GModule          *module;
@@ -73,6 +81,7 @@ typedef struct ToolsServiceState {
    gchar         *pluginPath;
    GPtrArray     *plugins;
 #if defined(_WIN32)
+   gboolean       useConsole;
    gchar         *displayName;
 #else
    gchar         *pidFile;