Skip to content

Commit e044b25

Browse files
James Hogangregkh
authored andcommitted
SIGNAL: Move generic copy_siginfo() to signal.h
commit ca9eb49aa9562eaadf3cea071ec7018ad6800425 upstream. The generic copy_siginfo() is currently defined in asm-generic/siginfo.h, after including uapi/asm-generic/siginfo.h which defines the generic struct siginfo. However this makes it awkward for an architecture to use it if it has to define its own struct siginfo (e.g. MIPS and potentially IA64), since it means that asm-generic/siginfo.h can only be included after defining the arch-specific siginfo, which may be problematic if the arch-specific definition needs definitions from uapi/asm-generic/siginfo.h. It is possible to work around this by first including uapi/asm-generic/siginfo.h to get the constants before defining the arch-specific siginfo, and include asm-generic/siginfo.h after. However uapi headers can't be included by other uapi headers, so that first include has to be in an ifdef __kernel__, with the non __kernel__ case including the non-UAPI header instead. Instead of that mess, move the generic copy_siginfo() definition into linux/signal.h, which allows an arch-specific uapi/asm/siginfo.h to include asm-generic/siginfo.h and define the arch-specific siginfo, and for the generic copy_siginfo() to see that arch-specific definition. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Petr Malat <oss@malat.biz> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Christopher Ferris <cferris@google.com> Cc: linux-arch@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-ia64@vger.kernel.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/12478/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b20909f commit e044b25

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

include/asm-generic/siginfo.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@
1717
struct siginfo;
1818
void do_schedule_next_timer(struct siginfo *info);
1919

20-
#ifndef HAVE_ARCH_COPY_SIGINFO
21-
22-
#include <linux/string.h>
23-
24-
static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
25-
{
26-
if (from->si_code < 0)
27-
memcpy(to, from, sizeof(*to));
28-
else
29-
/* _sigchld is currently the largest know union member */
30-
memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
31-
}
32-
33-
#endif
34-
3520
extern int copy_siginfo_to_user(struct siginfo __user *to, const struct siginfo *from);
3621

3722
#endif

include/linux/signal.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ struct sigpending {
2828
sigset_t signal;
2929
};
3030

31+
#ifndef HAVE_ARCH_COPY_SIGINFO
32+
33+
#include <linux/string.h>
34+
35+
static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
36+
{
37+
if (from->si_code < 0)
38+
memcpy(to, from, sizeof(*to));
39+
else
40+
/* _sigchld is currently the largest know union member */
41+
memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld));
42+
}
43+
44+
#endif
45+
3146
/*
3247
* Define some primitives to manipulate sigset_t.
3348
*/

0 commit comments

Comments
 (0)