]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/signal.c
ARM: dts: imx6ul: add support for Ka-Ro electronics TXUL mainboard
[karo-tx-linux.git] / kernel / signal.c
index 0508544c8ced0d96913905dc53af68f38b6ee618..d17c5385c38ccbd201c4215c60d526656952cf55 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/compat.h>
 #include <linux/cn_proc.h>
 #include <linux/compiler.h>
+#include <linux/aio.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/signal.h>
@@ -1422,6 +1423,25 @@ int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
        return do_send_sig_info(sig, info, p, false);
 }
 
+/* io_send_sig: send a signal caused by an i/o operation
+ *
+ * Use this helper when a signal is being sent to the task that is responsible
+ * for aer initiated operation.  Most commonly this is used to send signals
+ * like SIGPIPE or SIGXFS that are the result of attempting a read or write
+ * operation.  This is used by aio to direct a signal to the correct task in
+ * the case of async operations.
+ */
+int io_send_sig(int sig)
+{
+       struct task_struct *task = current;
+#if IS_ENABLED(CONFIG_AIO)
+       if (task->kiocb)
+               task = aio_get_task(task->kiocb);
+#endif
+       return send_sig(sig, task, 0);
+}
+EXPORT_SYMBOL(io_send_sig);
+
 #define __si_special(priv) \
        ((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)
 
@@ -3581,6 +3601,10 @@ __weak const char *arch_vma_name(struct vm_area_struct *vma)
 
 void __init signals_init(void)
 {
+       /* If this check fails, the __ARCH_SI_PREAMBLE_SIZE value is wrong! */
+       BUILD_BUG_ON(__ARCH_SI_PREAMBLE_SIZE
+               != offsetof(struct siginfo, _sifields._pad));
+
        sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
 }