From: VMware, Inc <> Date: Thu, 24 Feb 2011 22:46:20 +0000 (-0800) Subject: Condition some code on the glib version. X-Git-Tag: 2011.02.23-368700~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b313bd6dfe5ca78518bc00d482324ef290177cf;p=thirdparty%2Fopen-vm-tools.git Condition some code on the glib version. So open-vm-tools can compile with older glib (since its baseline is glib 2.6.0 still). Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index eb46ca96e..905fcc435 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -972,6 +972,10 @@ TARGET_OS="$os" MODULES_DIR="" buildHgfsmounter=no +if test "$have_glib_2_14" = "yes"; then + CPPFLAGS="$CPPFLAGS -DHAVE_GLIB_REGEX" +fi + if test "$os" = "linux"; then MODULES_DIR="$LINUXDIR/kernel/" diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 6dff451c8..1d4c6d6da 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -5364,6 +5364,7 @@ VixToolsListFiles(VixCommandRequestHeader *requestMsg, // IN size_t maxBufferSize, // IN char **result) // OUT { +#if !defined(OPEN_VM_TOOLS) || defined(HAVE_GLIB_REGEX) VixError err = VIX_OK; const char *dirPathName = NULL; char *fileList = NULL; @@ -5619,6 +5620,9 @@ abort: } return err; +#else + return VIX_E_NOT_SUPPORTED; +#endif } // VixToolsListFiles diff --git a/open-vm-tools/services/vmtoolsd/threadPool.c b/open-vm-tools/services/vmtoolsd/threadPool.c index f6f0520b8..79e177f32 100644 --- a/open-vm-tools/services/vmtoolsd/threadPool.c +++ b/open-vm-tools/services/vmtoolsd/threadPool.c @@ -477,8 +477,6 @@ void ToolsCorePool_Init(ToolsAppCtx *ctx) { gint maxThreads; - gint maxIdleTime; - gint maxUnused; GError *err = NULL; ToolsServiceProperty prop = { TOOLS_CORE_PROP_TPOOL }; @@ -488,20 +486,6 @@ ToolsCorePool_Init(ToolsAppCtx *ctx) gState.funcs.start = ToolsCorePoolStart; gState.ctx = ctx; - maxIdleTime = g_key_file_get_integer(ctx->config, ctx->name, - "pool.maxIdleTime", &err); - if (err != NULL || maxIdleTime <= 0) { - maxIdleTime = DEFAULT_MAX_IDLE_TIME; - g_clear_error(&err); - } - - maxUnused = g_key_file_get_integer(ctx->config, ctx->name, - "pool.maxUnusedThreads", &err); - if (err != NULL || maxUnused < 0) { - maxUnused = DEFAULT_MAX_UNUSED_THREADS; - g_clear_error(&err); - } - maxThreads = g_key_file_get_integer(ctx->config, ctx->name, "pool.maxThreads", &err); if (err != NULL) { @@ -513,8 +497,27 @@ ToolsCorePool_Init(ToolsAppCtx *ctx) gState.pool = g_thread_pool_new(ToolsCorePoolRunWorker, NULL, maxThreads, FALSE, &err); if (err == NULL) { +#if GLIB_CHECK_VERSION(2, 10, 0) + gint maxIdleTime; + gint maxUnused; + + maxIdleTime = g_key_file_get_integer(ctx->config, ctx->name, + "pool.maxIdleTime", &err); + if (err != NULL || maxIdleTime <= 0) { + maxIdleTime = DEFAULT_MAX_IDLE_TIME; + g_clear_error(&err); + } + + maxUnused = g_key_file_get_integer(ctx->config, ctx->name, + "pool.maxUnusedThreads", &err); + if (err != NULL || maxUnused < 0) { + maxUnused = DEFAULT_MAX_UNUSED_THREADS; + g_clear_error(&err); + } + g_thread_pool_set_max_idle_time(maxIdleTime); g_thread_pool_set_max_unused_threads(maxUnused); +#endif } else { g_warning("error initializing thread pool, running single threaded: %s", err->message);