
From: Stephen Rothwell <sfr@canb.auug.org.au>

Discussing with Matthew Wilcox some of his outstanding patches lead me to
this patch (among others).

The preamble in struct sigevent can be expressed independently of the
architecture.

Also use __ARCH_SI_PREAMBLE_SIZE on ia64.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/asm-alpha/siginfo.h   |    2 --
 include/asm-generic/siginfo.h |   13 ++++++++++---
 include/asm-ia64/siginfo.h    |    4 +---
 include/asm-mips/siginfo.h    |    2 --
 include/asm-s390/siginfo.h    |    6 ------
 include/asm-sparc64/siginfo.h |    2 --
 include/asm-x86_64/siginfo.h  |    2 --
 7 files changed, 11 insertions(+), 20 deletions(-)

diff -puN include/asm-alpha/siginfo.h~consolidate-sigev_pad_size include/asm-alpha/siginfo.h
--- 25/include/asm-alpha/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.508446056 -0700
+++ 25-akpm/include/asm-alpha/siginfo.h	2005-04-25 21:51:10.520444232 -0700
@@ -4,8 +4,6 @@
 #define __ARCH_SI_PREAMBLE_SIZE		(4 * sizeof(int))
 #define __ARCH_SI_TRAPNO
 
-#define SIGEV_PAD_SIZE			((SIGEV_MAX_SIZE/sizeof(int)) - 4)
-
 #include <asm-generic/siginfo.h>
 
 #endif
diff -puN include/asm-generic/siginfo.h~consolidate-sigev_pad_size include/asm-generic/siginfo.h
--- 25/include/asm-generic/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.509445904 -0700
+++ 25-akpm/include/asm-generic/siginfo.h	2005-04-25 21:51:10.520444232 -0700
@@ -236,11 +236,18 @@ typedef struct siginfo {
 #define SIGEV_THREAD	2	/* deliver via thread creation */
 #define SIGEV_THREAD_ID 4	/* deliver to thread */
 
-#define SIGEV_MAX_SIZE	64
-#ifndef SIGEV_PAD_SIZE
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 3)
+/*
+ * This works because the alignment is ok on all current architectures
+ * but we leave open this being overridden in the future
+ */
+#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
+#define __ARCH_SIGEV_PREAMBLE_SIZE	(sizeof(int) * 2 + sizeof(sigval_t))
 #endif
 
+#define SIGEV_MAX_SIZE	64
+#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
+		/ sizeof(int))
+
 typedef struct sigevent {
 	sigval_t sigev_value;
 	int sigev_signo;
diff -puN include/asm-ia64/siginfo.h~consolidate-sigev_pad_size include/asm-ia64/siginfo.h
--- 25/include/asm-ia64/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.510445752 -0700
+++ 25-akpm/include/asm-ia64/siginfo.h	2005-04-25 21:51:10.520444232 -0700
@@ -8,9 +8,7 @@
  *	David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
  */
 
-#define SI_PAD_SIZE	((SI_MAX_SIZE/sizeof(int)) - 4)
-
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 4)
+#define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
 
 #define HAVE_ARCH_SIGINFO_T
 #define HAVE_ARCH_COPY_SIGINFO
diff -puN include/asm-mips/siginfo.h~consolidate-sigev_pad_size include/asm-mips/siginfo.h
--- 25/include/asm-mips/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.512445448 -0700
+++ 25-akpm/include/asm-mips/siginfo.h	2005-04-25 21:51:10.521444080 -0700
@@ -11,8 +11,6 @@
 
 #include <linux/config.h>
 
-#define SIGEV_HEAD_SIZE	(sizeof(long) + 2*sizeof(int))
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE-SIGEV_HEAD_SIZE) / sizeof(int))
 #undef __ARCH_SI_TRAPNO	/* exception code needs to fill this ...  */
 
 #define HAVE_ARCH_SIGINFO_T
diff -puN include/asm-s390/siginfo.h~consolidate-sigev_pad_size include/asm-s390/siginfo.h
--- 25/include/asm-s390/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.513445296 -0700
+++ 25-akpm/include/asm-s390/siginfo.h	2005-04-25 21:51:10.521444080 -0700
@@ -13,12 +13,6 @@
 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
 #endif
 
-#ifdef CONFIG_ARCH_S390X
-#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
-#else
-#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
-#endif
-
 #include <asm-generic/siginfo.h>
 
 #endif
diff -puN include/asm-sparc64/siginfo.h~consolidate-sigev_pad_size include/asm-sparc64/siginfo.h
--- 25/include/asm-sparc64/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.515444992 -0700
+++ 25-akpm/include/asm-sparc64/siginfo.h	2005-04-25 21:51:10.521444080 -0700
@@ -3,8 +3,6 @@
 
 #define SI_PAD_SIZE32	((SI_MAX_SIZE/sizeof(int)) - 3)
 
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 4)
-
 #define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
 #define __ARCH_SI_TRAPNO
 #define __ARCH_SI_BAND_T int
diff -puN include/asm-x86_64/siginfo.h~consolidate-sigev_pad_size include/asm-x86_64/siginfo.h
--- 25/include/asm-x86_64/siginfo.h~consolidate-sigev_pad_size	2005-04-25 21:51:10.516444840 -0700
+++ 25-akpm/include/asm-x86_64/siginfo.h	2005-04-25 21:51:10.522443928 -0700
@@ -3,8 +3,6 @@
 
 #define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
 
-#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
-
 #include <asm-generic/siginfo.h>
 
 #endif
_
