From: Ivan Maidanski <ivmai@mail.ru>
Date: Thu, 22 Aug 2013 06:58:58 +0000 (+0400)
Subject: Fix old_segv/bus_act variables initialization for FreeBSD
X-Git-Tag: gc7_4_0~23^2~6
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2cd618803fb4ebb51bf5a9418acbc92dc667fd45;p=gc

Fix old_segv/bus_act variables initialization for FreeBSD

* os_dep.c (old_segv_act): Define static variable for FREEBSD (same as
for NETBSD).
* os_dep.c (GC_set_and_save_fault_handler): Reformat code (related to
FreeBSD).
* os_dep.c (GC_reset_fault_handler): Initialize old_segv_act (and
old_bus_act) for FREEBSD (same as for NETBSD).
---

diff --git a/os_dep.c b/os_dep.c
index 08cf47ee..2730205d 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -844,7 +844,7 @@ GC_INNER word GC_page_size = 0;
     typedef void (*GC_fault_handler_t)(int);
 
 #   if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
-       || defined(HURD) || defined(NETBSD)
+       || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
         static struct sigaction old_segv_act;
 #       if defined(_sigargs) /* !Irix6.x */ \
            || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
@@ -859,8 +859,8 @@ GC_INNER word GC_page_size = 0;
 
     GC_INNER void GC_set_and_save_fault_handler(GC_fault_handler_t h)
     {
-#       if defined(SUNOS5SIGS) || defined(IRIX5) \
-           || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
+#       if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
+            || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
           struct sigaction act;
 
           act.sa_handler = h;
@@ -888,7 +888,7 @@ GC_INNER word GC_page_size = 0;
               /* don't have to worry in the threads case.       */
               (void) sigaction(SIGBUS, &act, &old_bus_act);
 #           endif
-#         endif /* GC_IRIX_THREADS */
+#         endif /* !GC_IRIX_THREADS */
 #       else
           old_segv_handler = signal(SIGSEGV, h);
 #         ifdef SIGBUS
@@ -918,8 +918,8 @@ GC_INNER word GC_page_size = 0;
 
     GC_INNER void GC_reset_fault_handler(void)
     {
-#       if defined(SUNOS5SIGS) || defined(IRIX5) \
-           || defined(OSF1) || defined(HURD) || defined(NETBSD)
+#       if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \
+           || defined(HURD) || defined(FREEBSD) || defined(NETBSD)
           (void) sigaction(SIGSEGV, &old_segv_act, 0);
 #         if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
              || defined(HURD) || defined(NETBSD)