Chromium Code Reviews| Index: src/untrusted/irt/irt.h |
| diff --git a/src/untrusted/irt/irt.h b/src/untrusted/irt/irt.h |
| index 979614a10e02430c54e7b7c393745d06793662c3..aedf0adac2fb00883e2eb38b0e6d379b5ae0b9d7 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" { |
| @@ -241,6 +242,22 @@ struct nacl_irt_thread { |
| }; |
| /* |
| + * This interface is only available on Non-SFI Mode. |
| + */ |
| +#define NACL_IRT_THREAD_v0_2 "nacl-irt-thread-0.2" |
| +struct nacl_irt_thread_v0_2 { |
| + /* |
| + * Now this interface assigns the thread ID of the child thread into |
| + * |child_tid| atomically when the thread is created. It will be the |
| + * |parent_tid| argument to the clone() system call. |
| + */ |
| + int (*thread_create)(void (*start_func)(void), void *stack, void *thread_ptr, |
| + nacl_irt_tid_t *child_tid); |
|
Mark Seaborn
2015/07/16 23:21:16
Can the child_tid pointer be NULL? Please clarify
Luis Héctor Chávez
2015/07/20 18:13:47
Done.
|
| + 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. |
| * |
| * irt_futex provides process-private futexes, so futex wait queues are |
| @@ -436,6 +453,40 @@ struct nacl_irt_icache { |
| int (*clear_cache)(void *addr, size_t size); |
| }; |
| +/* |
| + * This interface is only available on Non-SFI Mode. |
| + */ |
| +#define NACL_IRT_ASYNC_SIGNAL_HANDLING_v0_1 "nacl-irt-async-signal-handling-0.1" |
| +typedef void (*NaClIrtSignalHandler)(struct NaClExceptionContext *context); |
| +struct nacl_irt_async_signal_handling { |
| + /* |
| + * 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); |
| +}; |
| + |
| #if defined(__cplusplus) |
| } |
| #endif |