Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: src/include/nacl/nacl_exception.h

Issue 14876015: Add wrapper library for the nacl_irt_exception_handling IRT interface (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Cleanup + remove minidump_generator.gyp for now because of pthread.h problem in Gyp build Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « site_scons/site_tools/library_deps.py ('k') | src/untrusted/crash_dump/untrusted_crash_dump.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/include/nacl/nacl_exception.h
diff --git a/src/include/nacl/nacl_exception.h b/src/include/nacl/nacl_exception.h
index ac5f5b875a1ced0bc1a5e9831860c28f51656497..0b7814438e1d1aa8e5f15d4e1acee2a53363965a 100644
--- a/src/include/nacl/nacl_exception.h
+++ b/src/include/nacl/nacl_exception.h
@@ -11,12 +11,18 @@
#ifndef __NATIVE_CLIENT_SRC_SERVICE_RUNTIME_INCLUDE_SYS_NACL_EXCEPTION_H__
#define __NATIVE_CLIENT_SRC_SERVICE_RUNTIME_INCLUDE_SYS_NACL_EXCEPTION_H__ 1
+#include <stdlib.h>
+
#if defined(__native_client__)
# include <stdint.h>
#else
# include "native_client/src/include/portability.h"
#endif
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
/*
* NaClUserRegisterState is similar to NaClSignalContext except that:
*
@@ -233,4 +239,44 @@ nacl_exception_context_get_portable(struct NaClExceptionContext *context) {
}
#endif
+typedef void (*nacl_exception_handler_t)(struct NaClExceptionContext *context);
+
+/*
+ * The following functions return 0 on success or an errno value on
+ * failure.
+ */
+
+/*
+ * Set the exception handler function. This applies to all threads in
+ * the process. In this regard, this API is similar to signal() or
+ * sigaction() in POSIX.
+ */
+int nacl_exception_set_handler(nacl_exception_handler_t handler);
+
+/*
+ * Set the stack that the exception handler will run on. This applies
+ * to the current thread only. This API is similar to sigaltstack()
+ * in POSIX.
+ */
+int nacl_exception_set_stack(void *stack, size_t size);
+
+/*
+ * Clear the current thread's exception flag.
+ *
+ * The purpose of the exception flag is to prevent the exception
+ * handler from being re-entered if an exception occurs while handling
+ * an exception. If an exception occurs on a thread while the
+ * thread's exception flag is set, the process is terminated. The
+ * exception flag is set when an exception occurs and the exception
+ * handler is invoked.
+ *
+ * The exception flag is similar to signal masks in POSIX.
+ * nacl_exception_clear_flag() is similar to sigprocmask() in POSIX.
+ */
+int nacl_exception_clear_flag(void);
+
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NATIVE_CLIENT_SRC_SERVICE_RUNTIME_INCLUDE_SYS_NACL_EXCEPTION_H__ */
« no previous file with comments | « site_scons/site_tools/library_deps.py ('k') | src/untrusted/crash_dump/untrusted_crash_dump.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698