Tests, LibTest: Implement disabling core dumps on GNU Hurd
This commit is contained in:
parent
f31df017f9
commit
bba193d6a0
Notes:
sideshowbarker
2024-07-17 03:19:14 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/bba193d6a0 Pull-request: https://github.com/SerenityOS/serenity/pull/20961 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 10 additions and 4 deletions
|
@ -25,7 +25,7 @@
|
|||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN) && !defined(AK_OS_GNU_HURD)
|
||||
// Only used to disable core dumps
|
||||
# include <sys/prctl.h>
|
||||
#endif
|
||||
|
@ -573,7 +573,10 @@ int main(int argc, char** argv)
|
|||
args_parser.add_option(disable_core_dumping, "Disable core dumping", "disable-core-dump", 0);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
#ifdef AK_OS_GNU_HURD
|
||||
if (disable_core_dumping)
|
||||
setenv("CRASHSERVER", "/servers/crash-kill", true);
|
||||
#elif !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
if (disable_core_dumping && prctl(PR_SET_DUMPABLE, 0, 0, 0) < 0) {
|
||||
perror("prctl(PR_SET_DUMPABLE)");
|
||||
return exit_wrong_arguments;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN) && !defined(AK_OS_GNU_HURD)
|
||||
# include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,10 @@ bool Crash::run(RunType run_type)
|
|||
perror("fork");
|
||||
VERIFY_NOT_REACHED();
|
||||
} else if (pid == 0) {
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
#if defined(AK_OS_GNU_HURD)
|
||||
// When we crash, just kill the program, don't dump core.
|
||||
setenv("CRASHSERVER", "/servers/crash-kill", true);
|
||||
#elif !defined(AK_OS_MACOS) && !defined(AK_OS_EMSCRIPTEN)
|
||||
if (prctl(PR_SET_DUMPABLE, 0, 0, 0) < 0)
|
||||
perror("prctl(PR_SET_DUMPABLE)");
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue