signalfd: add ability to return siginfo in a raw format
signalfd should be called with the flag SFD_RAW for that.
signalfd_siginfo is not full for siginfo with a negative si_code.
copy_siginfo_to_user() is copied a full siginfo to user-space, if si_code
is negative. signalfd_copyinfo() doesn't do that and can't be expanded,
because it has not compatible format with siginfo_t.
Another problem is that a constant __SI_* is removed from si_code. It's
not a problem for usual applications, because they expect a defined type
of siginfo (internal logic). When we want to dump pending signals, we
can't predict a type of siginfo, so we should get it from kernel.
The main idea of the raw format is that it should be enough for restoring
exactly the same siginfo for the current process.
This functionality is required for checkpointing pending signals.
Signed-off-by: Andrey Vagin <avagin@openvz.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: David Howells <dhowells@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>