summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-30 20:06:45 (GMT)
committerGitHub <noreply@github.com>2023-09-30 20:06:45 (GMT)
commit7513994c927857679544449392744be308d36586 (patch)
tree7d8bf43e49011f210dac2d282223aa1ee88f7d01 /Modules/faulthandler.c
parent0def8c712bb6f66f1081cab71deb3681566b846d (diff)
downloadcpython-7513994c927857679544449392744be308d36586.zip
cpython-7513994c927857679544449392744be308d36586.tar.gz
cpython-7513994c927857679544449392744be308d36586.tar.bz2
gh-110014: Include explicitly <unistd.h> header (#110155)
* Remove unused <locale.h> includes. * Remove unused <fcntl.h> include in traceback.h. * Remove redundant <assert.h> and <stddef.h> includes. They are already included by "Python.h". * Remove <object.h> include in faulthandler.c. Python.h already includes it. * Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS is defined. * Fix also warnings in pthread_stubs.h: don't redefine macros if they are already defined, like the __NEED_pthread_t macro.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 4b6bf68..a2e3c23 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -6,8 +6,10 @@
#include "pycore_sysmodule.h" // _PySys_GetAttr()
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
-#include <object.h>
-#include <signal.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // _exit()
+#endif
+#include <signal.h> // sigaction()
#include <stdlib.h> // abort()
#if defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK) && defined(HAVE_PTHREAD_H)
# include <pthread.h>
@@ -16,7 +18,7 @@
# include <windows.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
+# include <sys/resource.h> // setrlimit()
#endif
#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H) && defined(HAVE_SYS_AUXV_H)
@@ -24,6 +26,7 @@
# include <sys/auxv.h> // getauxval()
#endif
+
/* Allocate at maximum 100 MiB of the stack to raise the stack overflow */
#define STACK_OVERFLOW_MAX_SIZE (100 * 1024 * 1024)