linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Jakub Jelinek <jakub@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	David Mosberger <davidm@napali.hpl.hp.com>,
	anton@samba.org, ak@muc.de, schwidefsky@de.ibm.com,
	matthew@wil.cx
Subject: Re: sizeof (siginfo_t) problem
Date: Tue, 15 Jul 2003 02:52:52 +1000	[thread overview]
Message-ID: <20030715025252.17ec8d6f.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20030714084000.J15481@devserv.devel.redhat.com>

On Mon, 14 Jul 2003 08:40:00 -0400 Jakub Jelinek <jakub@redhat.com> wrote:
>
> The kernel unfortunately does this right on sparc64 and alpha from 64-bit
> arches only; ia64, s390x, ppc64 etc. got it wrong.

David Mosberger is correct that ia64 is OK (because it basically uses its
own siginfo.h as does mips64).  The following is an update of a patch that
was lost a while ago (when __ARCH_SI_PREAMBLE_SIZE was invented).

I am not sure if the s390 fix is correct (since s390x has been merged) or
if x86_64 needs this (as I cannot remember the alignment needs of the
x86_64 compiler - though I suspect it is needed).

I have no idea if parisc is correct on 64 bit platforms (probably not).

This has been neither compiled or tested, but should be close.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff -ruN 2.6.0-test1/include/asm-generic/siginfo.h 2.6.0-test1-sfr.1/include/asm-generic/siginfo.h
--- 2.6.0-test1/include/asm-generic/siginfo.h	2003-04-20 14:12:49.000000000 +1000
+++ 2.6.0-test1-sfr.1/include/asm-generic/siginfo.h	2003-07-15 02:41:47.000000000 +1000
@@ -142,7 +142,6 @@
 #define SI_FROMUSER(siptr)	((siptr)->si_code <= 0)
 #define SI_FROMKERNEL(siptr)	((siptr)->si_code > 0)
 
-#ifndef HAVE_ARCH_SI_CODES
 /*
  * SIGILL si_codes
  */
@@ -213,8 +212,6 @@
 #define POLL_HUP	(__SI_POLL|6)	/* device disconnected */
 #define NSIGPOLL	6
 
-#endif
-
 /*
  * sigevent definitions
  * 
diff -ruN 2.6.0-test1/include/asm-ppc64/siginfo.h 2.6.0-test1-sfr.1/include/asm-ppc64/siginfo.h
--- 2.6.0-test1/include/asm-ppc64/siginfo.h	2002-11-05 17:00:34.000000000 +1100
+++ 2.6.0-test1-sfr.1/include/asm-ppc64/siginfo.h	2003-07-15 02:28:22.000000000 +1000
@@ -8,8 +8,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#define SI_PAD_SIZE    ((SI_MAX_SIZE/sizeof(int)) - 4)
-#define SI_PAD_SIZE32  ((SI_MAX_SIZE/sizeof(int)) - 3)
+#define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+#define SI_PAD_SIZE32		((SI_MAX_SIZE/sizeof(int)) - 3)
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.6.0-test1/include/asm-s390/siginfo.h 2.6.0-test1-sfr.1/include/asm-s390/siginfo.h
--- 2.6.0-test1/include/asm-s390/siginfo.h	2002-11-05 16:58:19.000000000 +1100
+++ 2.6.0-test1-sfr.1/include/asm-s390/siginfo.h	2003-07-15 02:34:55.000000000 +1000
@@ -9,78 +9,12 @@
 #ifndef _S390_SIGINFO_H
 #define _S390_SIGINFO_H
 
-#define HAVE_ARCH_SI_CODES
+#include <linux/config.h>
 
-#include <asm-generic/siginfo.h>
-
-/*
- * SIGILL si_codes
- */
-#define ILL_ILLOPC	(__SI_FAULT|1)	/* illegal opcode */
-#define ILL_ILLOPN	(__SI_FAULT|2)	/* illegal operand */
-#define ILL_ILLADR	(__SI_FAULT|3)	/* illegal addressing mode */
-#define ILL_ILLTRP	(__SI_FAULT|4)	/* illegal trap */
-#define ILL_PRVOPC	(__SI_FAULT|5)	/* privileged opcode */
-#define ILL_PRVREG	(__SI_FAULT|6)	/* privileged register */
-#define ILL_COPROC	(__SI_FAULT|7)	/* coprocessor error */
-#define ILL_BADSTK	(__SI_FAULT|8)	/* internal stack error */
-#define NSIGILL		8
-
-/*
- * SIGFPE si_codes
- */
-#define FPE_INTDIV	(__SI_FAULT|1)	/* integer divide by zero */
-#define FPE_INTOVF	(__SI_FAULT|2)	/* integer overflow */
-#define FPE_FLTDIV	(__SI_FAULT|3)	/* floating point divide by zero */
-#define FPE_FLTOVF	(__SI_FAULT|4)	/* floating point overflow */
-#define FPE_FLTUND	(__SI_FAULT|5)	/* floating point underflow */
-#define FPE_FLTRES	(__SI_FAULT|6)	/* floating point inexact result */
-#define FPE_FLTINV	(__SI_FAULT|7)	/* floating point invalid operation */
-#define FPE_FLTSUB	(__SI_FAULT|8)	/* subscript out of range */
-#define NSIGFPE		8
-
-/*
- * SIGSEGV si_codes
- */
-#define SEGV_MAPERR	(__SI_FAULT|1)	/* address not mapped to object */
-#define SEGV_ACCERR	(__SI_FAULT|2)	/* invalid permissions for mapped object */
-#define NSIGSEGV	2
-
-/*
- * SIGBUS si_codes
- */
-#define BUS_ADRALN	(__SI_FAULT|1)	/* invalid address alignment */
-#define BUS_ADRERR	(__SI_FAULT|2)	/* non-existant physical address */
-#define BUS_OBJERR	(__SI_FAULT|3)	/* object specific hardware error */
-#define NSIGBUS		3
-
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRKPT	(__SI_FAULT|1)	/* process breakpoint */
-#define TRAP_TRACE	(__SI_FAULT|2)	/* process trace trap */
-#define NSIGTRAP	2
-
-/*
- * SIGCHLD si_codes
- */
-#define CLD_EXITED	(__SI_CHLD|1)	/* child has exited */
-#define CLD_KILLED	(__SI_CHLD|2)	/* child was killed */
-#define CLD_DUMPED	(__SI_CHLD|3)	/* child terminated abnormally */
-#define CLD_TRAPPED	(__SI_CHLD|4)	/* traced child has trapped */
-#define CLD_STOPPED	(__SI_CHLD|5)	/* child has stopped */
-#define CLD_CONTINUED	(__SI_CHLD|6)	/* stopped child has continued */
-#define NSIGCHLD	6
+#ifdef CONFIG_ARCH_S390X
+#define	__ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+#endif
 
-/*
- * SIGPOLL si_codes
- */
-#define POLL_IN		(__SI_POLL|1)	/* data input available */
-#define POLL_OUT	(__SI_POLL|2)	/* output buffers available */
-#define POLL_MSG	(__SI_POLL|3)	/* input message available */
-#define POLL_ERR	(__SI_POLL|4)	/* i/o error */
-#define POLL_PRI	(__SI_POLL|5)	/* high priority input available */
-#define POLL_HUP	(__SI_POLL|6)	/* device disconnected */
-#define NSIGPOLL	6
+#include <asm-generic/siginfo.h>
 
 #endif
diff -ruN 2.6.0-test1/include/asm-x86_64/siginfo.h 2.6.0-test1-sfr.1/include/asm-x86_64/siginfo.h
--- 2.6.0-test1/include/asm-x86_64/siginfo.h	2002-11-05 16:58:09.000000000 +1100
+++ 2.6.0-test1-sfr.1/include/asm-x86_64/siginfo.h	2003-07-15 02:38:49.000000000 +1000
@@ -1,6 +1,9 @@
 #ifndef _X8664_SIGINFO_H
 #define _X8664_SIGINFO_H
 
+#define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
+#define SIGEV_PAD_SIZE		((SIGEV_MAX_SIZE/sizeof(int)) - 4)
+
 #include <asm-generic/siginfo.h>
 
 #endif

  parent reply	other threads:[~2003-07-14 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-14 12:40 sizeof (siginfo_t) problem Jakub Jelinek
2003-07-14 13:55 ` Jamie Lokier
2003-07-14 15:02   ` Andreas Schwab
2003-07-14 15:48 ` David Mosberger
2003-07-14 15:57   ` Jakub Jelinek
2003-07-14 16:52 ` Stephen Rothwell [this message]
2003-07-14 17:00   ` Jakub Jelinek
2003-07-14 17:11     ` Stephen Rothwell
2003-07-14 17:14       ` Jakub Jelinek
2003-07-14 17:25         ` Stephen Rothwell
2003-07-14 17:45           ` Jakub Jelinek
2003-07-19 18:32   ` Anton Blanchard
2003-07-21  0:08     ` Stephen Rothwell
2003-07-22 13:42       ` Russell King
2003-07-22 13:57         ` Stephen Rothwell
2003-07-14 18:31 Ulrich Weigand
2003-07-14 18:35 ` Jakub Jelinek
2003-07-14 18:52 Ulrich Weigand
2003-07-15 11:58 Martin Schwidefsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030715025252.17ec8d6f.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=ak@muc.de \
    --cc=anton@samba.org \
    --cc=davidm@napali.hpl.hp.com \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).