[PATCH] consolidate SIGEV_PAD_SIZE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

-- 

 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                    [email protected]
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 <[email protected]>, 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: pgpnC5Iu4lFYi.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux