Current-Users archive

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

Moving compat linux si_code definitions from MD to MI siginfo.h ?



Hi,

I just had a closer look on compat linux siginfo si_code definitions,
which are spread across all MD siginfo.h files; and was thinking about
moving them to the MI siginfo.h file. All archs, except mips for 3
values, use the same definitions.

While here, i removed all the SI_CODE() stuff that we don't really
care about. We do only require the lower 16-bits for all this stuff,
to be returned for userland si_code. The remaining upper 16-bits are
for internal Linux kernel use, and i think that we should better use
native si_code values instead if possible.

Comments ?

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: sys/compat/linux/arch/alpha/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/alpha/linux_siginfo.h,v
retrieving revision 1.4
diff -u -p -r1.4 linux_siginfo.h
--- sys/compat/linux/arch/alpha/linux_siginfo.h 28 Apr 2008 20:23:42 -0000      
1.4
+++ sys/compat/linux/arch/alpha/linux_siginfo.h 22 Oct 2008 18:55:32 -0000
@@ -90,15 +90,4 @@ typedef struct linux_siginfo {
 #define lsi_pid                _sidata._kill._pid
 #define lsi_uid                _sidata._kill._uid
 
-#define LINUX_SI_USER          0
-#define        LINUX_SI_KERNEL         0x80
-#define LINUX_SI_QUEUE         -1
-#define LINUX_SI_TIMER         -2
-#define LINUX_SI_MESGQ         -3
-#define LINUX_SI_ASYNCIO       -4
-
-#define LINUX_SI_FROMUSER(sp)  ((sp)->si_code <= 0)
-#define LINUX_SI_FROMKERENL(sp)        ((sp)->si_code > 0)
-
-
 #endif /* !_ALPHA_LINUX_SIGINFO_H */
Index: sys/compat/linux/arch/amd64/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_siginfo.h,v
retrieving revision 1.3
diff -u -p -r1.3 linux_siginfo.h
--- sys/compat/linux/arch/amd64/linux_siginfo.h 21 Oct 2008 20:24:15 -0000      
1.3
+++ sys/compat/linux/arch/amd64/linux_siginfo.h 22 Oct 2008 18:55:32 -0000
@@ -83,17 +83,4 @@ struct linux_siginfo {
        } _sifields;
 } linux_siginfo_t;
 
-/*
- * si_code values for non-signals
- */
-#define LINUX_SI_USER          0
-#define LINUX_SI_KERNEL                0x80
-#define LINUX_SI_QUEUE         -1
-#define LINUX_SI_TIMER         -2
-#define LINUX_SI_MESGQ         -3
-#define LINUX_SI_ASYNCIO       -4
-#define LINUX_SI_SIGIO         -5
-#define LINUX_SI_TKILL         -6
-#define LINUX_SI_DETHREAD      -7
-
 #endif /* !_AMD64_LINUX_SIGINFO_H */
Index: sys/compat/linux/arch/i386/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/i386/linux_siginfo.h,v
retrieving revision 1.5
diff -u -p -r1.5 linux_siginfo.h
--- sys/compat/linux/arch/i386/linux_siginfo.h  28 Apr 2008 20:23:42 -0000      
1.5
+++ sys/compat/linux/arch/i386/linux_siginfo.h  22 Oct 2008 18:55:32 -0000
@@ -100,68 +100,4 @@ typedef struct linux_siginfo {
 #define lsi_band        _sidata._sigpoll._band
 #define lsi_fd          _sidata._sigpoll._fd
 
-/*
- * si_code values for non-signals
- */
-#define LINUX_SI_USER          0
-#define        LINUX_SI_KERNEL         0x80
-#define LINUX_SI_QUEUE         -1
-#define LINUX_SI_TIMER         -2
-#define LINUX_SI_MESGQ         -3
-#define LINUX_SI_ASYNCIO       -4
-#define LINUX_SI_SIGIO         -5
-#define LINUX_SI_SIGNL         -6
-
-/* si_code values for SIGILL */
-#define        LINUX_ILL_ILLOPC        1
-#define        LINUX_ILL_ILLOPN        2
-#define        LINUX_ILL_ILLADR        3
-#define        LINUX_ILL_ILLTRP        4
-#define        LINUX_ILL_PRVOPC        5
-#define        LINUX_ILL_PRVREG        6
-#define        LINUX_ILL_COPROC        7
-#define        LINUX_ILL_BADSTK        8
-
-/* si_code values for SIGFPE */
-#define        LINUX_FPE_INTDIV        1
-#define        LINUX_FPE_INTOVF        2
-#define        LINUX_FPE_FLTDIV        3
-#define        LINUX_FPE_FLTOVF        4
-#define        LINUX_FPE_FLTUND        5
-#define        LINUX_FPE_FLTRES        6
-#define        LINUX_FPE_FLTINV        7
-#define        LINUX_FPE_FLTSUB        8
-
-/* si_code values for SIGSEGV */
-#define        LINUX_SEGV_MAPERR       1
-#define        LINUX_SEGV_ACCERR       2
-
-/* si_code values for SIGBUS */
-#define        LINUX_BUS_ADRALN        1
-#define        LINUX_BUS_ADRERR        2
-#define        LINUX_BUS_OBJERR        3
-
-/* si_code values for SIGTRAP */
-#define        LINUX_TRAP_BRKPT        1
-#define        LINUX_TRAP_TRACE        2
-
-/* si_code values for SIGCHLD */
-#define        LINUX_CLD_EXITED        1
-#define        LINUX_CLD_KILLED        2
-#define        LINUX_CLD_DUMPED        3
-#define        LINUX_CLD_TRAPPED       4
-#define        LINUX_CLD_STOPPED       5
-#define        LINUX_CLD_CONTINUED     6
-
-/* si_code values for SIGPOLL */
-#define        LINUX_POLL_IN           1
-#define        LINUX_POLL_OUT          2
-#define        LINUX_POLL_MSG          3
-#define        LINUX_POLL_ERR          4
-#define        LINUX_POLL_PRI          5
-#define        LINUX_POLL_HUP          6
-
-#define LINUX_SI_FROMUSER(sp)  ((sp)->si_code <= 0)
-#define LINUX_SI_FROMKERNEL(sp)        ((sp)->si_code > 0)
-
 #endif /* !_I386_LINUX_SIGINFO_H */
Index: sys/compat/linux/arch/m68k/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/m68k/linux_siginfo.h,v
retrieving revision 1.4
diff -u -p -r1.4 linux_siginfo.h
--- sys/compat/linux/arch/m68k/linux_siginfo.h  28 Apr 2008 20:23:42 -0000      
1.4
+++ sys/compat/linux/arch/m68k/linux_siginfo.h  22 Oct 2008 18:55:32 -0000
@@ -91,16 +91,4 @@ typedef struct linux_siginfo {
 #define lsi_pid                _sidata._kill._pid
 #define lsi_uid                _sidata._kill._uid
 
-#define LINUX_SI_USER          0
-#define        LINUX_SI_KERNEL         0x80
-#define LINUX_SI_QUEUE         -1
-#define LINUX_SI_TIMER         -2
-#define LINUX_SI_MESGQ         -3
-#define LINUX_SI_ASYNCIO       -4
-#define LINUX_SI_SIGIO         -5
-
-#define LINUX_SI_FROMUSER(sp)  ((sp)->lsi_code <= 0)
-#define LINUX_SI_FROMKERENL(sp)        ((sp)->lsi_code > 0)
-
-
 #endif /* !_M68K_LINUX_SIGINFO_H */
Index: sys/compat/linux/arch/mips/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/mips/linux_siginfo.h,v
retrieving revision 1.5
diff -u -p -r1.5 linux_siginfo.h
--- sys/compat/linux/arch/mips/linux_siginfo.h  28 Apr 2008 20:23:43 -0000      
1.5
+++ sys/compat/linux/arch/mips/linux_siginfo.h  22 Oct 2008 18:55:32 -0000
@@ -103,22 +103,11 @@ typedef struct linux_siginfo {
 #define lsi_pid _sidata._kill._pid
 #define lsi_uid _sidata._kill._uid
 
-/*
- * si_code values
- * Digital reserves positive values for kernel-generated signals.
- */
-#define LINUX__SI_CODE(T,N)  ((T) << 16 | ((N) & 0xffff))
+/* si_code specific values (IRIX compatible) */
+#define LINUX_SI_CODE_ARCH
 
-#define LINUX_SI_USER          0
-#define LINUX_SI_KERNEL                0x80
-#define LINUX_SI_QUEUE         -1
 #define LINUX_SI_ASYNCIO       -2
-#define LINUX_SI_TIMER         LINUX__SI_CODE(__SI_TIMER,-3)
+#define LINUX_SI_TIMER         -3
 #define LINUX_SI_MESGQ         -4
-#define LINUX_SI_SIGIO         -5
-
-#define LINUX_SI_FROMUSER(siptr)       ((siptr)->si_code <= 0)
-#define LINUX_SI_FROMKERENL(siptr)     ((siptr)->si_code > 0)
-
 
 #endif /* !_MIPS_LINUX_SIGINFO_H */
Index: sys/compat/linux/arch/powerpc/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/powerpc/linux_siginfo.h,v
retrieving revision 1.4
diff -u -p -r1.4 linux_siginfo.h
--- sys/compat/linux/arch/powerpc/linux_siginfo.h       28 Apr 2008 20:23:43 
-0000      1.4
+++ sys/compat/linux/arch/powerpc/linux_siginfo.h       22 Oct 2008 18:55:32 
-0000
@@ -95,22 +95,4 @@ typedef struct linux_siginfo {
 #define lsi_pid _sidata._kill._pid
 #define lsi_uid _sidata._kill._uid
 
-/*
- * si_code values
- * Digital reserves positive values for kernel-generated signals.
- */
-#define LINUX__SI_CODE(T,N)  ((T) << 16 | ((N) & 0xffff))
-
-#define LINUX_SI_USER          0
-#define LINUX_SI_KERNEL                0x80
-#define LINUX_SI_QUEUE         -1
-#define LINUX_SI_TIMER         LINUX__SI_CODE(__SI_TIMER,-2)
-#define LINUX_SI_MESGQ         -3
-#define LINUX_SI_ASYNCIO       -4
-#define LINUX_SI_SIGIO         -5
-
-#define LINUX_SI_FROMUSER(sp)  ((sp)->si_code <= 0)
-#define LINUX_SI_FROMKERENL(sp) ((sp)->si_code > 0)
-
-
 #endif /* !_POWERPC_LINUX_SIGINFO_H */
Index: sys/compat/linux/common/linux_siginfo.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/common/linux_siginfo.h,v
retrieving revision 1.13
diff -u -p -r1.13 linux_siginfo.h
--- sys/compat/linux/common/linux_siginfo.h     21 Oct 2008 20:24:15 -0000      
1.13
+++ sys/compat/linux/common/linux_siginfo.h     22 Oct 2008 18:55:33 -0000
@@ -48,9 +48,69 @@
 #include <compat/linux/arch/amd64/linux_siginfo.h>
 #endif
 
-/* From linux/include/asm-generic/siginfo.h */
-#define LINUX_CLD_EXITED       1
-#define LINUX_CLD_KILLED       2
-#define LINUX_CLD_DUMPED       3
+/* si_code values for non signal */
+#define        LINUX_SI_USER           0
+#define        LINUX_SI_KERNEL         0x80
+#define        LINUX_SI_QUEUE          -1
+#ifndef LINUX_SI_CODE_ARCH /* all except mips */
+#define        LINUX_SI_TIMER          -2
+#define        LINUX_SI_MESGQ          -3
+#define        LINUX_SI_ASYNCIO        -4
+#endif /* LINUX_SI_CODE_ARCH */
+#define        LINUX_SI_SIGIO          -5
+#define        LINUX_SI_TKILL          -6
+#define        LINUX_SI_DETHREAD       -7
+
+/* si_code values for SIGILL */
+#define        LINUX_ILL_ILLOPC        1
+#define        LINUX_ILL_ILLOPN        2
+#define        LINUX_ILL_ILLADR        3
+#define        LINUX_ILL_ILLTRP        4
+#define        LINUX_ILL_PRVOPC        5
+#define        LINUX_ILL_PRVREG        6
+#define        LINUX_ILL_COPROC        7
+#define        LINUX_ILL_BADSTK        8
+
+/* si_code values for SIGFPE */
+#define        LINUX_FPE_INTDIV        1
+#define        LINUX_FPE_INTOVF        2
+#define        LINUX_FPE_FLTDIV        3
+#define        LINUX_FPE_FLTOVF        4
+#define        LINUX_FPE_FLTUND        5
+#define        LINUX_FPE_FLTRES        6
+#define        LINUX_FPE_FLTINV        7
+#define        LINUX_FPE_FLTSUB        8
+
+/* si_code values for SIGSEGV */
+#define        LINUX_SEGV_MAPERR       1
+#define        LINUX_SEGV_ACCERR       2
+
+/* si_code values for SIGBUS */
+#define        LINUX_BUS_ADRALN        1
+#define        LINUX_BUS_ADRERR        2
+#define        LINUX_BUS_OBJERR        3
+
+/* si_code values for SIGTRAP */
+#define        LINUX_TRAP_BRKPT        1
+#define        LINUX_TRAP_TRACE        2
+
+/* si_code values for SIGCHLD */
+#define        LINUX_CLD_EXITED        1
+#define        LINUX_CLD_KILLED        2
+#define        LINUX_CLD_DUMPED        3
+#define        LINUX_CLD_TRAPPED       4
+#define        LINUX_CLD_STOPPED       5
+#define        LINUX_CLD_CONTINUED     6
+
+/* si_code values for SIGPOLL */
+#define        LINUX_POLL_IN           1
+#define        LINUX_POLL_OUT          2
+#define        LINUX_POLL_MSG          3
+#define        LINUX_POLL_ERR          4
+#define        LINUX_POLL_PRI          5
+#define        LINUX_POLL_HUP          6
+
+#define        LINUX_SI_FROMUSER(sp)   ((sp)->si_code <= 0)
+#define        LINUX_SI_FROMKERNEL(sp) ((sp)->si_code > 0)
 
 #endif /* !_LINUX_SIGINFO_H */


Home | Main Index | Thread Index | Old Index