[PATCH] consolidate SIGEV_PAD_SIZE

From: Stephen Rothwell
Date: Mon Apr 18 2005 - 02:51:14 EST


Hi Andrew,

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@xxxxxxxxxxxxxxxx>

--

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

Please apply and send upstream.
--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
http://www.canb.auug.org.au/~sfr/

diff -ruN linus/include/asm-alpha/siginfo.h linus-willy.1/include/asm-alpha/siginfo.h
--- linus/include/asm-alpha/siginfo.h 2003-08-20 08:58:40.000000000 +1000
+++ linus-willy.1/include/asm-alpha/siginfo.h 2005-03-10 18:39:40.000000000 +1100
@@ -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 -ruN linus/include/asm-generic/siginfo.h linus-willy.1/include/asm-generic/siginfo.h
--- linus/include/asm-generic/siginfo.h 2005-03-14 13:07:09.000000000 +1100
+++ linus-willy.1/include/asm-generic/siginfo.h 2005-03-14 15:46:09.000000000 +1100
@@ -236,11 +236,18 @@
#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 -ruN linus/include/asm-ia64/siginfo.h linus-willy.1/include/asm-ia64/siginfo.h
--- linus/include/asm-ia64/siginfo.h 2004-10-09 15:46:34.000000000 +1000
+++ linus-willy.1/include/asm-ia64/siginfo.h 2005-03-10 18:42:36.000000000 +1100
@@ -8,9 +8,7 @@
* David Mosberger-Tang <davidm@xxxxxxxxxx>, 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 -ruN linus/include/asm-mips/siginfo.h linus-willy.1/include/asm-mips/siginfo.h
--- linus/include/asm-mips/siginfo.h 2004-12-02 13:08:10.000000000 +1100
+++ linus-willy.1/include/asm-mips/siginfo.h 2005-03-10 18:44:51.000000000 +1100
@@ -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 -ruN linus/include/asm-s390/siginfo.h linus-willy.1/include/asm-s390/siginfo.h
--- linus/include/asm-s390/siginfo.h 2004-12-04 04:05:03.000000000 +1100
+++ linus-willy.1/include/asm-s390/siginfo.h 2005-03-10 18:45:29.000000000 +1100
@@ -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 -ruN linus/include/asm-sparc64/siginfo.h linus-willy.1/include/asm-sparc64/siginfo.h
--- linus/include/asm-sparc64/siginfo.h 2005-03-11 05:08:55.000000000 +1100
+++ linus-willy.1/include/asm-sparc64/siginfo.h 2005-03-11 16:08:17.000000000 +1100
@@ -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 -ruN linus/include/asm-x86_64/siginfo.h linus-willy.1/include/asm-x86_64/siginfo.h
--- linus/include/asm-x86_64/siginfo.h 2004-04-04 16:06:05.000000000 +1000
+++ linus-willy.1/include/asm-x86_64/siginfo.h 2005-03-10 18:46:14.000000000 +1100
@@ -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

Attachment: pgp00000.pgp
Description: PGP signature