| 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__ */
|
|
|