Add two functions to check and change the SIGSEGV behaviour when loading plugins.

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (gst_segtrap_is_enabled), (gst_segtrap_set_enabled):
* gst/gst.h:
* gst/gstplugin.c: (_gst_plugin_fault_handler_restore):
Add two functions to check and change the SIGSEGV behaviour
when loading plugins.
Don't mess with the SIGSEGV handler when we were told not to.
Fixes #347794.
API: gst_segtrap_is_enabled
API: gst_segtrap_set_enabled
This commit is contained in:
Wim Taymans 2006-07-17 17:40:52 +00:00
parent 21b8eaeab5
commit c0a3f9e697
5 changed files with 59 additions and 1 deletions

View file

@ -1,3 +1,16 @@
2006-07-17 Wim Taymans <wim@fluendo.com>
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (gst_segtrap_is_enabled), (gst_segtrap_set_enabled):
* gst/gst.h:
* gst/gstplugin.c: (_gst_plugin_fault_handler_restore):
Add two functions to check and change the SIGSEGV behaviour
when loading plugins.
Don't mess with the SIGSEGV handler when we were told not to.
Fixes #347794.
API: gst_segtrap_is_enabled
API: gst_segtrap_set_enabled
2006-07-14 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasesrc.c: (gst_base_src_update_length):

View file

@ -25,6 +25,8 @@ gst_init_get_option_group
gst_deinit
gst_version
gst_version_string
gst_segtrap_is_enabled
gst_segtrap_set_enabled
<SUBSECTION Private>
</SECTION>

View file

@ -131,7 +131,6 @@ extern gint _gst_trace_on;
/* set to TRUE when segfaults need to be left as is */
gboolean _gst_disable_segtrap = FALSE;
static void load_plugin_func (gpointer data, gpointer user_data);
static gboolean init_pre (void);
static gboolean init_post (void);
@ -1055,3 +1054,40 @@ gst_version_string ()
return g_strdup_printf ("GStreamer %d.%d.%d (prerelease)", major, minor,
micro);
}
/**
* gst_segtrap_is_enabled:
*
* Some functions in the GStreamer core might install a custom SIGSEGV handler to
* better catch and report errors to the application. Currently this feature is
* enabled by default when loading plugins.
*
* Applications might want to disable this behaviour with the
* gst_segtrap_set_enabled() function. This is typically done if the application
* wants to install its own handler without GStreamer interfering.
*
* Returns: %TRUE if GStreamer is allowed to install a custom SIGSEGV handler.
*
* Since: 0.10.10
*/
gboolean
gst_segtrap_is_enabled (void)
{
/* yeps, it's enabled when it's not disabled */
return !_gst_disable_segtrap;
}
/**
* gst_segtrap_set_enabled:
* @enabled: whether a custom SIGSEGV handler should be installed.
*
* Applications might want to disable/enable the SIGSEGV handling of
* the GStreamer core. See gst_segtrap_is_enabled() for more information.
*
* Since: 0.10.10
*/
void
gst_segtrap_set_enabled (gboolean enabled)
{
_gst_disable_segtrap = !enabled;
}

View file

@ -85,6 +85,9 @@ void gst_version (guint *major, guint *minor,
guint *micro, guint *nano);
gchar * gst_version_string (void);
gboolean gst_segtrap_is_enabled (void);
void gst_segtrap_set_enabled (gboolean enabled);
G_END_DECLS
#endif /* __GST_H__ */

View file

@ -279,6 +279,10 @@ _gst_plugin_fault_handler_restore (void)
{
struct sigaction action;
/* if asked to leave segfaults alone, just return */
if (_gst_disable_segtrap)
return;
memset (&action, 0, sizeof (action));
action.sa_handler = SIG_DFL;