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

Unified Diff: src/untrusted/irt/irt.h

Issue 1212613002: Non-SFI mode: Add Linux asynchronous signal support (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Fixed a small window where signals could corrupt the stack Created 5 years, 5 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
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

Powered by Google App Engine
This is Rietveld 408576698