leaks tracer: use G_OS_UNIX to check for signal support

Checking for signal.h is not good enough as it's present in Windows.
Those signals are UNIX specific anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=767857
This commit is contained in:
Guillaume Desmottes 2016-07-08 11:15:06 +02:00 committed by Sebastian Dröge
parent 17c37efa83
commit 1ed4140d00
2 changed files with 14 additions and 21 deletions

View file

@ -719,13 +719,6 @@ fi
AC_SUBST(GST_HAVE_POSIX_TIMERS_DEFINE) AC_SUBST(GST_HAVE_POSIX_TIMERS_DEFINE)
AM_CONDITIONAL(GST_HAVE_POSIX_TIMERS, test "$gst_cv_posix_timers" = "yes") AM_CONDITIONAL(GST_HAVE_POSIX_TIMERS, test "$gst_cv_posix_timers" = "yes")
dnl Check for posix signals
AC_CHECK_FUNC(signal, [
AC_CHECK_HEADERS([signal.h], [
AC_DEFINE(HAVE_POSIX_SIGNALS,1,[Have posix signals])
], [], [])
])
AC_CACHE_CHECK(for monotonic clock, gst_cv_monotonic_clock, AC_CACHE_CHECK(for monotonic clock, gst_cv_monotonic_clock,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <time.h> #include <time.h>

View file

@ -45,9 +45,9 @@
#include "gstleaks.h" #include "gstleaks.h"
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
#include <signal.h> #include <signal.h>
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
GST_DEBUG_CATEGORY_STATIC (gst_leaks_debug); GST_DEBUG_CATEGORY_STATIC (gst_leaks_debug);
#define GST_CAT_DEFAULT gst_leaks_debug #define GST_CAT_DEFAULT gst_leaks_debug
@ -59,10 +59,10 @@ G_DEFINE_TYPE_WITH_CODE (GstLeaksTracer, gst_leaks_tracer,
GST_TYPE_TRACER, _do_init); GST_TYPE_TRACER, _do_init);
static GstTracerRecord *tr_alive; static GstTracerRecord *tr_alive;
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
static GstTracerRecord *tr_added = NULL; static GstTracerRecord *tr_added = NULL;
static GstTracerRecord *tr_removed = NULL; static GstTracerRecord *tr_removed = NULL;
#endif #endif /* G_OS_UNIX */
static GQueue instances = G_QUEUE_INIT; static GQueue instances = G_QUEUE_INIT;
static void static void
@ -118,7 +118,7 @@ should_handle_object_type (GstLeaksTracer * self, GType object_type)
return FALSE; return FALSE;
} }
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
/* The object may be destroyed when we log it using the checkpointing system so /* The object may be destroyed when we log it using the checkpointing system so
* we have to save its type name */ * we have to save its type name */
typedef struct typedef struct
@ -147,17 +147,17 @@ object_log_free (ObjectLog * obj)
{ {
g_slice_free (ObjectLog, obj); g_slice_free (ObjectLog, obj);
} }
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
static void static void
handle_object_destroyed (GstLeaksTracer * self, gpointer object) handle_object_destroyed (GstLeaksTracer * self, gpointer object)
{ {
GST_OBJECT_LOCK (self); GST_OBJECT_LOCK (self);
g_hash_table_remove (self->objects, object); g_hash_table_remove (self->objects, object);
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
if (self->removed) if (self->removed)
g_hash_table_add (self->removed, object_log_new (object)); g_hash_table_add (self->removed, object_log_new (object));
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
GST_OBJECT_UNLOCK (self); GST_OBJECT_UNLOCK (self);
} }
@ -271,10 +271,10 @@ handle_object_created (GstLeaksTracer * self, gpointer object, GType type,
g_hash_table_insert (self->objects, object, trace); g_hash_table_insert (self->objects, object, trace);
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
if (self->added) if (self->added)
g_hash_table_add (self->added, object_log_new (object)); g_hash_table_add (self->added, object_log_new (object));
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
GST_OBJECT_UNLOCK (self); GST_OBJECT_UNLOCK (self);
} }
@ -502,7 +502,7 @@ gst_leaks_tracer_finalize (GObject * object)
"related-to", GST_TYPE_TRACER_VALUE_SCOPE, GST_TRACER_VALUE_SCOPE_PROCESS, \ "related-to", GST_TYPE_TRACER_VALUE_SCOPE, GST_TRACER_VALUE_SCOPE_PROCESS, \
NULL) NULL)
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
static void static void
sig_usr1_handler_foreach (gpointer data, gpointer user_data) sig_usr1_handler_foreach (gpointer data, gpointer user_data)
{ {
@ -588,7 +588,7 @@ setup_signals (void)
signal (SIGUSR1, sig_usr1_handler); signal (SIGUSR1, sig_usr1_handler);
signal (SIGUSR2, sig_usr2_handler); signal (SIGUSR2, sig_usr2_handler);
} }
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
static void static void
gst_leaks_tracer_class_init (GstLeaksTracerClass * klass) gst_leaks_tracer_class_init (GstLeaksTracerClass * klass)
@ -604,10 +604,10 @@ gst_leaks_tracer_class_init (GstLeaksTracerClass * klass)
GST_OBJECT_FLAG_SET (tr_alive, GST_OBJECT_FLAG_MAY_BE_LEAKED); GST_OBJECT_FLAG_SET (tr_alive, GST_OBJECT_FLAG_MAY_BE_LEAKED);
if (g_getenv ("GST_LEAKS_TRACER_SIG")) { if (g_getenv ("GST_LEAKS_TRACER_SIG")) {
#ifdef HAVE_POSIX_SIGNALS #ifdef G_OS_UNIX
setup_signals (); setup_signals ();
#else #else
g_warning ("System doesn't support POSIX signals"); g_warning ("System doesn't support POSIX signals");
#endif /* HAVE_POSIX_SIGNALS */ #endif /* G_OS_UNIX */
} }
} }