Commit a71c1ab50a2a0f4dd9834bf5a917a2f064535c6b

Authored by Stephen Rothwell
Committed by Linus Torvalds
1 parent 696f9486d0

[PATCH] consolidate SIGEV_PAD_SIZE

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>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 7 changed files with 11 additions and 20 deletions Side-by-side Diff

include/asm-alpha/siginfo.h
... ... @@ -4,8 +4,6 @@
4 4 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
5 5 #define __ARCH_SI_TRAPNO
6 6  
7   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
8   -
9 7 #include <asm-generic/siginfo.h>
10 8  
11 9 #endif
include/asm-generic/siginfo.h
... ... @@ -236,10 +236,17 @@
236 236 #define SIGEV_THREAD 2 /* deliver via thread creation */
237 237 #define SIGEV_THREAD_ID 4 /* deliver to thread */
238 238  
239   -#define SIGEV_MAX_SIZE 64
240   -#ifndef SIGEV_PAD_SIZE
241   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
  239 +/*
  240 + * This works because the alignment is ok on all current architectures
  241 + * but we leave open this being overridden in the future
  242 + */
  243 +#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
  244 +#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
242 245 #endif
  246 +
  247 +#define SIGEV_MAX_SIZE 64
  248 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
  249 + / sizeof(int))
243 250  
244 251 typedef struct sigevent {
245 252 sigval_t sigev_value;
include/asm-ia64/siginfo.h
... ... @@ -8,9 +8,7 @@
8 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 9 */
10 10  
11   -#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4)
12   -
13   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
  11 +#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
14 12  
15 13 #define HAVE_ARCH_SIGINFO_T
16 14 #define HAVE_ARCH_COPY_SIGINFO
include/asm-mips/siginfo.h
... ... @@ -11,8 +11,6 @@
11 11  
12 12 #include <linux/config.h>
13 13  
14   -#define SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
15   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE-SIGEV_HEAD_SIZE) / sizeof(int))
16 14 #undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
17 15  
18 16 #define HAVE_ARCH_SIGINFO_T
include/asm-s390/siginfo.h
... ... @@ -13,12 +13,6 @@
13 13 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
14 14 #endif
15 15  
16   -#ifdef CONFIG_ARCH_S390X
17   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
18   -#else
19   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
20   -#endif
21   -
22 16 #include <asm-generic/siginfo.h>
23 17  
24 18 #endif
include/asm-sparc64/siginfo.h
... ... @@ -3,8 +3,6 @@
3 3  
4 4 #define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
5 5  
6   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
7   -
8 6 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
9 7 #define __ARCH_SI_TRAPNO
10 8 #define __ARCH_SI_BAND_T int
include/asm-x86_64/siginfo.h
... ... @@ -3,8 +3,6 @@
3 3  
4 4 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
5 5  
6   -#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
7   -
8 6 #include <asm-generic/siginfo.h>
9 7  
10 8 #endif