[PATCH 1/2] os: Introduce OsAbort for proper core dumps.

Rami Ylimaki ext-rami.ylimaki at nokia.com
Tue Jan 12 06:03:13 PST 2010


Signed-off-by: Rami Ylimaki <ext-rami.ylimaki at nokia.com>
---
 include/os.h |    2 ++
 os/utils.c   |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/os.h b/include/os.h
index dad1af7..831498a 100644
--- a/include/os.h
+++ b/include/os.h
@@ -262,6 +262,8 @@ extern _X_EXPORT void OsBlockSignals (void);
 
 extern _X_EXPORT void OsReleaseSignals (void);
 
+extern _X_EXPORT void OsAbort (BOOL /* blockSignals */);
+
 #if !defined(WIN32)
 extern _X_EXPORT int System(char *);
 extern _X_EXPORT pointer Popen(char *, char *);
diff --git a/os/utils.c b/os/utils.c
index d7c8388..c00dc92 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1314,6 +1314,19 @@ OsReleaseSignals (void)
 #endif
 }
 
+/*
+ * Pending signals may interfere with core dumping. Provide a
+ * mechanism to block signals when aborting.
+ */
+
+void
+OsAbort (BOOL blockSignals)
+{
+    if (blockSignals)
+        OsBlockSignals();
+    abort();
+}
+
 #if !defined(WIN32)
 /*
  * "safer" versions of system(3), popen(3) and pclose(3) which give up
-- 
1.6.0.4



More information about the xorg-devel mailing list