$OpenBSD: patch-runtime_flangrti_trace_lin_c,v 1.3 2019/08/27 16:02:47 bcallah Exp $

We don't have sys/ucontext.h
No gregset_t, make them void
Remove the /proc dance they need for Linux

Index: runtime/flangrti/trace_lin.c
--- runtime/flangrti/trace_lin.c.orig
+++ runtime/flangrti/trace_lin.c
@@ -17,7 +17,9 @@
 
 #include <stdint.h>
 #include <signal.h>
+#if !defined(__OpenBSD__)
 #include <sys/ucontext.h>
+#endif
 #include <execinfo.h>
 #include <stdioInterf.h>
 #include "dumpregs.h"
@@ -25,7 +27,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <linux/limits.h>
+#include <limits.h>
 #include <inttypes.h>
 
 /* codes and strings for signals */
@@ -92,7 +94,7 @@ static struct sigs sigs[] = {
     {0, CODNULL, NULL} /* end of list */
 };
 
-static gregset_t *regs; /* pointer to regs at signal  */
+static void *regs; /* pointer to regs at signal  */
 
 extern char **__io_get_argv();
 static char ** saved_argv = NULL;
@@ -115,6 +117,7 @@ print_back_trace_line(char * bt_str, void const * cons
     saved_argv = __io_get_argv();
   }
 
+#ifndef __OpenBSD__
   if (NULL == saved_argv) {
     /*
      * Most likely a C program where __io_set_argv() was not called on startup.
@@ -143,6 +146,7 @@ print_back_trace_line(char * bt_str, void const * cons
     fclose(f);
     saved_argv = &pexec_name;
   }
+#endif
 
   sprintf(addr2line_cmd,"addr2line -e %s %p", saved_argv[0], addr);
 
@@ -182,7 +186,7 @@ __abort_trace(int skip)
   char **strings;
   size_t i;
 
-  if (regs != (gregset_t *)0) {
+  if (regs != (void *)0) {
     dumpregs(regs);
   }
 
