Use longjmp in fault_handler_openbsd if siglongjmp unavailable (OpenBSD)
authorIvan Maidanski <ivmai@mail.ru>
Thu, 23 Mar 2017 08:15:45 +0000 (11:15 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 23 Mar 2017 08:17:01 +0000 (11:17 +0300)
* os_dep.c [OPENBSD] (GC_jmp_buf_openbsd): Use JMP_BUF instead of
sigjmp_buf.
* os_dep.c [OPENBSD] (GC_fault_handler_openbsd): Use LONGJMP() instead
of siglongjmp().
* os_dep.c [OPENBSD] (GC_find_limit_openbsd, GC_skip_hole_openbsd): Use
SETJMP(buf) instead of sigsetjmp(buf, 1).

os_dep.c

index fcafde6..0900ea3 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -517,7 +517,7 @@ GC_INNER char * GC_get_maps(void)
 
 #ifdef OPENBSD
   static struct sigaction old_segv_act;
-  STATIC sigjmp_buf GC_jmp_buf_openbsd;
+  STATIC JMP_BUF GC_jmp_buf_openbsd;
 
 # ifdef THREADS
 #   include <sys/syscall.h>
@@ -531,7 +531,7 @@ GC_INNER char * GC_get_maps(void)
 
   STATIC void GC_fault_handler_openbsd(int sig GC_ATTR_UNUSED)
   {
-     siglongjmp(GC_jmp_buf_openbsd, 1);
+     LONGJMP(GC_jmp_buf_openbsd, 1);
   }
 
   /* Return the first non-addressable location > p or bound.    */
@@ -556,7 +556,7 @@ GC_INNER char * GC_get_maps(void)
     /* act.sa_restorer is deprecated and should not be initialized. */
     sigaction(SIGSEGV, &act, &old_segv_act);
 
-    if (sigsetjmp(GC_jmp_buf_openbsd, 1) == 0) {
+    if (SETJMP(GC_jmp_buf_openbsd) == 0) {
       result = (ptr_t)((word)p & ~(pgsz-1));
       for (;;) {
         if ((word)result >= (word)bound - pgsz) {
@@ -598,7 +598,7 @@ GC_INNER char * GC_get_maps(void)
 
     firstpass = 1;
     result = (ptr_t)((word)p & ~(pgsz-1));
-    if (sigsetjmp(GC_jmp_buf_openbsd, 1) != 0 || firstpass) {
+    if (SETJMP(GC_jmp_buf_openbsd) != 0 || firstpass) {
       firstpass = 0;
       if ((word)result >= (word)bound - pgsz) {
         result = bound;