FatalSignalHandler: simplify SA_RESETHAND code
And remove the unreachable code after std::abort() that was meant to mimic that in INTEGRITY. The next commit will fix this properly. Pick-to: 6.3 Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb772018add694 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
3e596da488
commit
c4600b2e25
@ -88,6 +88,9 @@
|
|||||||
# if !defined(Q_OS_INTEGRITY)
|
# if !defined(Q_OS_INTEGRITY)
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
# endif
|
# endif
|
||||||
|
# ifndef SA_RESETHAND
|
||||||
|
# define SA_RESETHAND 0
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
@ -1843,6 +1846,9 @@ public:
|
|||||||
|
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
|
// Remove the handler after it is invoked.
|
||||||
|
act.sa_flags = SA_RESETHAND;
|
||||||
|
|
||||||
# ifdef SA_SIGINFO
|
# ifdef SA_SIGINFO
|
||||||
act.sa_flags |= SA_SIGINFO;
|
act.sa_flags |= SA_SIGINFO;
|
||||||
act.sa_sigaction = FatalSignalHandler::actionHandler;
|
act.sa_sigaction = FatalSignalHandler::actionHandler;
|
||||||
@ -1850,11 +1856,6 @@ public:
|
|||||||
act.sa_handler = FatalSignalHandler::regularHandler;
|
act.sa_handler = FatalSignalHandler::regularHandler;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// Remove the handler after it is invoked.
|
|
||||||
# if !defined(Q_OS_INTEGRITY)
|
|
||||||
act.sa_flags = SA_RESETHAND;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
|
// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
|
||||||
// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
|
// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
|
||||||
# if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS)
|
# if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS)
|
||||||
@ -1954,14 +1955,6 @@ private:
|
|||||||
"\n Function time: ", asyncSafeToString(msecsFunctionTime),
|
"\n Function time: ", asyncSafeToString(msecsFunctionTime),
|
||||||
"ms Total time: ", asyncSafeToString(msecsTotalTime), "ms\n");
|
"ms Total time: ", asyncSafeToString(msecsTotalTime), "ms\n");
|
||||||
std::abort();
|
std::abort();
|
||||||
# if defined(Q_OS_INTEGRITY)
|
|
||||||
{
|
|
||||||
struct sigaction act;
|
|
||||||
memset(&act, 0, sizeof(struct sigaction));
|
|
||||||
act.sa_handler = SIG_DFL;
|
|
||||||
sigaction(signum, &act, NULL);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] static void regularHandler(int signum)
|
[[maybe_unused]] static void regularHandler(int signum)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user