Index: src/untrusted/irt/irt.h |
diff --git a/src/untrusted/irt/irt.h b/src/untrusted/irt/irt.h |
index 979614a10e02430c54e7b7c393745d06793662c3..3747c0b1acf135e2f7fcb6bec2dfea9ef1609c00 100644 |
--- a/src/untrusted/irt/irt.h |
+++ b/src/untrusted/irt/irt.h |
@@ -21,6 +21,7 @@ struct NaClMemMappingInfo; |
typedef int64_t nacl_irt_off_t; |
typedef uint32_t nacl_irt_clockid_t; |
+typedef uintptr_t nacl_irt_tid_t; |
#if defined(__cplusplus) |
extern "C" { |
@@ -240,6 +241,18 @@ struct nacl_irt_thread { |
int (*thread_nice)(const int nice); |
}; |
+#define NACL_IRT_THREAD_v0_2 "nacl-irt-thread-0.2" |
Mark Seaborn
2015/06/26 18:32:00
Please comment that this is implemented for Non-SF
Luis Héctor Chávez
2015/07/06 23:45:00
Done.
|
+struct nacl_irt_thread_v0_2 { |
+ /* |
+ * Now this interface returns the thread ID of the child thread as |
Mark Seaborn
2015/06/26 18:31:59
Nit: It assigns it to *child_tid rather than retur
Luis Héctor Chávez
2015/07/06 23:45:00
Done.
|
+ * |tid|. |tid| is valid until thread_exit is called. |
+ */ |
+ int (*thread_create)(void (*start_func)(void), void *stack, void *thread_ptr, |
+ nacl_irt_tid_t *child_tid); |
+ void (*thread_exit)(int32_t *stack_flag); |
+ int (*thread_nice)(const int nice); |
+}; |
+ |
/* |
* The irt_futex interface is based on Linux's futex() system call. |
* |
@@ -390,6 +403,37 @@ struct nacl_irt_exception_handling { |
int (*exception_clear_flag)(void); |
}; |
+#define NACL_IRT_SIGNAL_HANDLING_v0_1 "nacl-irt-signal-handling-0.1" |
Mark Seaborn
2015/06/26 18:31:59
Please comment that this is implemented for Non-SF
Luis Héctor Chávez
2015/07/06 23:45:00
Done.
|
+typedef void (*NaClIrtSignalHandler)(struct NaClExceptionContext *context); |
+struct nacl_irt_signal_handling { |
Mark Seaborn
2015/06/26 18:31:59
Let's add "async" into the name to make it clear t
Luis Héctor Chávez
2015/07/06 23:45:00
Done.
|
+ /* |
+ * When send_async_signal is called, |handler| is invoked on the thread |
+ * specified by |tid| on the thread's stack and without modifying the |
+ * underlying signal mask, so |handler| must be reentrant. |
+ * |
+ * You can safely use only async-signal-safe operations in |handler|. The |
+ * following NaCl IRT functions are async-signal-safe: |
+ * |
+ * - tls_get |
+ * - futex_wait_abs |
+ * - futex_wake |
+ * - send_async_signal |
+ * |
+ * If the thread was executing an IRT function, the suspended thread will |
+ * continue it after |handler| finishes. In other words, no IRT function will |
+ * be aborted. |
+ */ |
+ int (*set_async_signal_handler)(NaClIrtSignalHandler handler); |
+ /* |
+ * |tid| should be zero or a value returned by thread_create. If |tid| is |
+ * zero, the signal will be sent to the main thread. |
+ * |
+ * When |tid| is invalid, the result is unspecified. This IRT function |
+ * returns 0 on success or may return ESRCH or EINVAL. |
+ */ |
+ int (*send_async_signal)(nacl_irt_tid_t tid); |
+}; |
+ |
#define NACL_IRT_CODE_DATA_ALLOC_v0_1 "nacl-irt-code-data-alloc-0.1" |
struct nacl_irt_code_data_alloc { |
/* |