From: VMware, Inc <> Date: Mon, 28 Sep 2009 20:21:33 +0000 (-0700) Subject: ToolsCore: Signal config file reloads. X-Git-Tag: p4-sync-929606~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2367531352105e53da557eb8d0b1010827c741e9;p=thirdparty%2Fopen-vm-tools.git ToolsCore: Signal config file reloads. This change introduces a new signal, tcs_conf_reload, which is emitted in response to a successful config file reload. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/vmtoolsApp.h b/open-vm-tools/lib/include/vmtoolsApp.h index 6a00c5a86..9c264f12f 100644 --- a/open-vm-tools/lib/include/vmtoolsApp.h +++ b/open-vm-tools/lib/include/vmtoolsApp.h @@ -81,6 +81,15 @@ */ #define TOOLS_CORE_SIG_CAPABILITIES "tcs_capabilities" +/** + * Signal sent when the config file is reloaded. + * + * @param[in] src The source object. + * @param[in] ctx ToolsAppCtx *: The application context. + * @param[in] data Client data. + */ +#define TOOLS_CORE_SIG_CONF_RELOAD "tcs_conf_reload" + /** * Signal sent when the service receives a request to dump its internal * state to the log. This is for debugging purposes, and plugins can diff --git a/open-vm-tools/services/vmtoolsd/mainLoop.c b/open-vm-tools/services/vmtoolsd/mainLoop.c index 4c6bbfc8d..bb6faf27f 100644 --- a/open-vm-tools/services/vmtoolsd/mainLoop.c +++ b/open-vm-tools/services/vmtoolsd/mainLoop.c @@ -232,6 +232,11 @@ ToolsCore_ReloadConfig(ToolsServiceState *state, &state->ctx.config, &state->configMtime)) { g_debug("Config file reloaded.\n"); + + /* Inform plugins of config file update. */ + g_signal_emit_by_name(state->ctx.serviceObj, + TOOLS_CORE_SIG_CONF_RELOAD, + &state->ctx); } else { loaded = FALSE; } diff --git a/open-vm-tools/services/vmtoolsd/serviceObj.c b/open-vm-tools/services/vmtoolsd/serviceObj.c index 0b75b6fd2..4d2e46257 100644 --- a/open-vm-tools/services/vmtoolsd/serviceObj.c +++ b/open-vm-tools/services/vmtoolsd/serviceObj.c @@ -116,6 +116,16 @@ ToolsCore_Service_class_init(gpointer _klass, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN); + g_signal_new(TOOLS_CORE_SIG_CONF_RELOAD, + G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); g_signal_new(TOOLS_CORE_SIG_DUMP_STATE, G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_LAST,