[PATCH 28/44] Add translate_signal() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Translating signals is common task. Currently many arch have this
open coded. This provides a common helper for all archs.

Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
 include/linux/signal.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/signal.h b/include/linux/signal.h
index ef8fcfd..5dfe4c8 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -2,6 +2,8 @@
 #define _LINUX_SIGNAL_H
 
 #include <linux/list.h>
+#include <linux/personality.h>
+#include <linux/thread_info.h>
 #include <uapi/linux/signal.h>
 
 struct task_struct;
@@ -285,6 +287,16 @@ struct ksignal {
 	int sig;
 };
 
+static inline int translate_signal(int sig)
+{
+	struct thread_info *info = current_thread_info();
+
+	if (info->exec_domain && info->exec_domain->signal_invmap && sig < 32)
+		return info->exec_domain->signal_invmap[sig];
+
+	return sig;
+}
+
 extern int get_signal(struct ksignal *ksig);
 extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
 extern void exit_signals(struct task_struct *tsk);
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux