[pypy-commit] pypy win32-faulthandler: Fixes
amauryfa
pypy.commits at gmail.com
Thu Apr 6 13:08:05 EDT 2017
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: win32-faulthandler
Changeset: r91005:dac86db0cb31
Date: 2017-04-06 19:07 +0200
http://bitbucket.org/pypy/pypy/changeset/dac86db0cb31/
Log: Fixes
diff --git a/pypy/module/faulthandler/faulthandler.c b/pypy/module/faulthandler/faulthandler.c
--- a/pypy/module/faulthandler/faulthandler.c
+++ b/pypy/module/faulthandler/faulthandler.c
@@ -368,10 +368,12 @@
#ifdef HAVE_SIGACTION
static void faulthandler_user(int signum, siginfo_t *info, void *ucontext)
+{
#else
static void faulthandler_user(int signum)
+{
+ void *ucontext = NULL;
#endif
-{
int save_errno;
user_signal_t *user = &user_signals[signum];
@@ -489,10 +491,12 @@
static void
#ifdef HAVE_SIGACTION
faulthandler_fatal_error(int signum, siginfo_t *info, void *ucontext)
+{
#else
faulthandler_fatal_error(int signum)
+{
+ void *ucontext = NULL;
#endif
-{
int fd = fatal_error.fd;
int i;
fault_handler_t *handler = NULL;
@@ -616,7 +620,7 @@
int err;
struct sigaction action;
fault_handler_t *handler = &faulthandler_handlers[i];
-
+#ifdef HAVE_SIGACTION
action.sa_sigaction = faulthandler_fatal_error;
sigemptyset(&action.sa_mask);
/* Do not prevent the signal from being received from within
@@ -628,6 +632,11 @@
action.sa_flags |= SA_ONSTACK;
}
err = sigaction(handler->signum, &action, &handler->previous);
+#else
+ handler->previous = signal(handler->signum,
+ faulthandler_fatal_error);
+ err = (handler->previous == SIG_ERR);
+#endif
if (err) {
return strerror(errno);
}
@@ -647,7 +656,11 @@
fault_handler_t *handler = &faulthandler_handlers[i];
if (!handler->enabled)
continue;
+#ifdef HAVE_SIGACTION
(void)sigaction(handler->signum, &handler->previous, NULL);
+#else
+ (void)signal(handler->signum, handler->previous);
+#endif
handler->enabled = 0;
}
}
More information about the pypy-commit
mailing list