Incorrect value for SIGRTMAX in the kernel
I was having a problem with signals with POSIX timers, and it turns out that the value of SIGRTMAX is incorrect. Remember that there is no signal 0, so the signals should go from 1-_NSIG. However, SIGRTMAX is defined as (_NSIG-1) in all architectures. The following patch fixes this.
This define is only used in drivers/usb/core/devio.c and kernel/posix-timers.c, and both are incorrect without this fix. There's also no check for zero in posix-timers.c, that fix is part of the diff.
Also, shouldn't do_sigaction() use this value instead of _NSIG? It's not a big deal, but some architectures have different values for _NSIG and SIGRTMAX.
-Corey
Index: include/asm-alpha/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-alpha/signal.h,v retrieving revision 1.7
include/asm-alpha/signal.h +1 -1
@@ -71,7 +71,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-arm/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-arm/signal.h,v retrieving revision 1.7
include/asm-arm/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG#define SIGSWI 32
Index: include/asm-arm26/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-arm26/signal.h,v retrieving revision 1.2
include/asm-arm26/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG#define SIGSWI 32
Index: include/asm-cris/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-cris/signal.h,v retrieving revision 1.5
include/asm-cris/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-h8300/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-h8300/signal.h,v retrieving revision 1.2
include/asm-h8300/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-i386/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-i386/signal.h,v retrieving revision 1.9
include/asm-i386/signal.h +1 -1
@@ -70,7 +70,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-ia64/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-ia64/signal.h,v retrieving revision 1.11
include/asm-ia64/signal.h +1 -1
@@ -50,7 +50,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-m68k/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-m68k/signal.h,v retrieving revision 1.5
include/asm-m68k/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-m68knommu/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-m68knommu/signal.h,v retrieving revision 1.4
include/asm-m68knommu/signal.h +1 -1
@@ -68,7 +68,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-mips/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-mips/signal.h,v retrieving revision 1.6
include/asm-mips/signal.h +1 -1
@@ -59,7 +59,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-parisc/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-parisc/signal.h,v retrieving revision 1.4
include/asm-parisc/signal.h +1 -1
@@ -42,7 +42,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 37 -#define SIGRTMAX (_NSIG-1)/* it's 44 under HP/UX */ +#define SIGRTMAX _NSIG/* it's 44 under HP/UX */ /* * SA_FLAGS values:
Index: include/asm-ppc/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-ppc/signal.h,v retrieving revision 1.7
include/asm-ppc/signal.h +1 -1
@@ -61,7 +61,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-ppc64/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-ppc64/signal.h,v retrieving revision 1.7
include/asm-ppc64/signal.h +1 -1
@@ -57,7 +57,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-s390/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-s390/signal.h,v retrieving revision 1.9
include/asm-s390/signal.h +1 -1
@@ -78,7 +78,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-sh/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-sh/signal.h,v retrieving revision 1.6
include/asm-sh/signal.h +1 -1
@@ -57,7 +57,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-sparc/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-sparc/signal.h,v retrieving revision 1.7
include/asm-sparc/signal.h +1 -1
@@ -89,7 +89,7 @@#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)#define SIGRTMIN 32 -#define SIGRTMAX (__NEW_NSIG - 1) +#define SIGRTMAX __NEW_NSIG#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)#define _NSIG __NEW_NSIG
Index: include/asm-sparc64/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-sparc64/signal.h,v retrieving revision 1.10
include/asm-sparc64/signal.h +1 -1
@@ -89,7 +89,7 @@#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)#define SIGRTMIN 32 -#define SIGRTMAX (__NEW_NSIG - 1) +#define SIGRTMAX __NEW_NSIG#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)#define _NSIG __NEW_NSIG
Index: include/asm-v850/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-v850/signal.h,v retrieving revision 1.4
include/asm-v850/signal.h +1 -1
@@ -71,7 +71,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: include/asm-x86_64/signal.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-x86_64/signal.h,v retrieving revision 1.8
include/asm-x86_64/signal.h +1 -1
@@ -77,7 +77,7 @@/* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG/* * SA_FLAGS values:
Index: kernel/posix-timers.c
===================================================================
RCS file: /home/cvs/linux-2.5/kernel/posix-timers.c,v retrieving revision 1.21
kernel/posix-timers.c +1 -0
@@ -344,6 +344,7 @@return NULL ;if ((event->sigev_notify & ~SIGEV_NONE &MIPS_SIGEV ) && + event->sigev_signo && ((unsigned ) (event->sigev_signo >SIGRTMAX )))return NULL ;