summaryrefslogtreecommitdiff
path: root/misc/gstreamer/patches/patch-ab
blob: d96df3e3a27c2c67142099fc7276c6d6cc71442c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$NetBSD: patch-ab,v 1.2 2003/05/11 21:03:37 jmc Exp $

--- tools/gst-launch.c.orig	Sun Feb  2 00:05:42 2003
+++ tools/gst-launch.c	Sun May 11 15:35:14 2003
@@ -1,7 +1,9 @@
+#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <sys/wait.h>
+#include <sys/signal.h>
 #include <gst/gst.h>
 
 static guint64 iterations = 0;
@@ -10,6 +12,15 @@
 static guint64 max = 0;
 static GstClock *s_clock;
 
+#ifndef SA_SIGINFO
+typedef struct {
+	char *si_addr;
+	int si_signo;
+	int si_errno;
+	int si_code;
+} siginfo_t;
+#endif
+
 gboolean
 idle_func (gpointer data)
 {
@@ -158,6 +169,20 @@
 
 }
 
+#ifndef SA_SIGINFO
+void si_handler(int sig, int code, struct sigcontext *scp)
+{
+	siginfo_t si;
+
+	si.si_addr = NULL;
+	si.si_signo = sig;
+	si.si_errno = errno;
+	si.si_code = code;
+
+	fault_handler(sig, &si, scp);
+}
+#endif
+
 static void 
 fault_restore (void)
 {
@@ -176,8 +201,13 @@
   struct sigaction action;
 
   memset (&action, 0, sizeof (action));
+#ifdef SA_SIGINFO
   action.sa_sigaction = fault_handler;
   action.sa_flags = SA_SIGINFO;
+#else
+  action.sa_handler = (void (*)(int))si_handler;
+  action.sa_flags = 0;
+#endif
 
   sigaction (SIGSEGV, &action, NULL);
   sigaction (SIGQUIT, &action, NULL);