summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-04-23 21:07:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-04-23 21:07:42 (GMT)
commitdaf4ab55869c71b69a4764bd5947ba230d5da0da (patch)
treecd10e1031ee50dd6e1a0fa329b56b2e6318b3f66
parent3cdcd9dc8827685537db76556d4432b6edaf81e8 (diff)
downloadhdf5-daf4ab55869c71b69a4764bd5947ba230d5da0da.zip
hdf5-daf4ab55869c71b69a4764bd5947ba230d5da0da.tar.gz
hdf5-daf4ab55869c71b69a4764bd5947ba230d5da0da.tar.bz2
[svn-r1209] Handled another signal that the Cray T3E was generating on invalid memory
accesses.
-rw-r--r--src/H5detect.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/H5detect.c b/src/H5detect.c
index cb7cebe..6943972 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -248,12 +248,13 @@ precision (detected_t *d)
volatile TYPE _val=0; \
volatile size_t _ano=0; \
void (*_handler)(int) = signal(SIGBUS, sigbus_handler); \
+ void (*_handler2)(int) = signal(SIGSEGV, sigsegv_handler); \
\
_buf = malloc(sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
if (setjmp(jbuf_g)) _ano++; \
if (_ano<NELMTS(align_g)) { \
- *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS*/ \
- _val = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS*/ \
+ *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
+ _val = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/ \
(ALIGN)=align_g[_ano]; \
} else { \
(ALIGN)=0; \
@@ -261,6 +262,7 @@ precision (detected_t *d)
} \
free(_buf); \
signal(SIGBUS, _handler); /*restore original handler*/ \
+ signal(SIGSEGV, _handler2); /*restore original handler*/ \
}
#else
#define ALIGNMENT(TYPE,ALIGN) (ALIGN)=0
@@ -315,6 +317,31 @@ precision (detected_t *d)
/*-------------------------------------------------------------------------
+ * Function: sigsegv_handler
+ *
+ * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction()
+ * because it's more portable to non-Posix systems. Although
+ * it's not nearly as nice to work with, it does the job for
+ * this simple stuff.
+ *
+ * Return: Returns via longjmp to jbuf_g.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, March 18, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+sigsegv_handler(int UNUSED signo)
+{
+ signal(SIGSEGV, sigsegv_handler);
+ longjmp(jbuf_g, 1);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: sigbus_handler
*
* Purpose: Handler for SIGBUS. We use signal() instead of sigaction()