]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Don't use g_atomic_int_set in old glib versions.
authorVMware, Inc <>
Thu, 18 Nov 2010 22:57:01 +0000 (14:57 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 18 Nov 2010 22:57:01 +0000 (14:57 -0800)
Also use the correct version check macro. In old versions, emulate set()
with an assignment + explicit fence.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/libvmtools/fileLogger.c
open-vm-tools/services/vmtoolsd/cmdLine.c

index 7ca0b840d6c96f1bd1d73df453148d690643e17f..fc07653b282ce062da8fb8c497bb92f9dd97631f 100644 (file)
@@ -34,6 +34,7 @@
 #endif
 
 #include "vm_assert.h"
+#include "vm_atomic.h"
 
 typedef struct FileLoggerData {
    LogHandlerData    handler;
@@ -167,7 +168,12 @@ VMFileLoggerOpen(FileLoggerData *data)
    if (g_file_test(path, G_FILE_TEST_EXISTS)) {
       struct stat fstats;
       if (g_stat(path, &fstats) > -1) {
+#if GLIB_CHECK_VERSION(2, 10, 0)
          g_atomic_int_set(&data->logSize, (gint) fstats.st_size);
+#else
+         data->logSize = (gint) fstats.st_size;
+         Atomic_MFence();
+#endif
       }
 
       if (!data->append || g_atomic_int_get(&data->logSize) >= data->maxSize) {
@@ -213,7 +219,12 @@ VMFileLoggerOpen(FileLoggerData *data)
             g_free(g_ptr_array_index(logfiles, id));
          }
          g_ptr_array_free(logfiles, TRUE);
+#if GLIB_CHECK_VERSION(2, 10, 0)
          g_atomic_int_set(&data->logSize, 0);
+#else
+         data->logSize = 0;
+         Atomic_MFence();
+#endif
          data->append = FALSE;
       }
    }
index 09fc4f0c6b06b214e14acbd93d262982bfd548a9..fe0969d2214815473789c04a3657a5e287b55ca5 100644 (file)
@@ -264,7 +264,7 @@ ToolsCore_ParseCommandLine(ToolsServiceState *state,
 #endif
 
    context = g_option_context_new(NULL);
-#if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 12
+#if GLIB_CHECK_VERSION(2, 12, 0)
    g_option_context_set_summary(context, N_("Runs the VMware Tools daemon."));
 #endif
    g_option_context_add_main_entries(context, clOptions, NULL);