From: Ivan Maidanski Date: Thu, 23 Mar 2017 08:15:45 +0000 (+0300) Subject: Use longjmp in fault_handler_openbsd if siglongjmp unavailable (OpenBSD) X-Git-Tag: v8.0.0~823 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2da0b6f5ee3c32334f00ea05179a6335d37f5a9e;p=gc Use longjmp in fault_handler_openbsd if siglongjmp unavailable (OpenBSD) * 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). --- diff --git a/os_dep.c b/os_dep.c index fcafde6a..0900ea33 100644 --- 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 @@ -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;