Re: sizeof (siginfo_t) problem

From: David Mosberger (davidm@napali.hpl.hp.com)
Date: Mon Jul 14 2003 - 10:48:00 EST


>>>>> On Mon, 14 Jul 2003 08:40:00 -0400, Jakub Jelinek <jakub@redhat.com> said:

  Jakub> # if __WORDSIZE == 64
  Jakub> # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
  Jakub> # else
  Jakub> # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
  Jakub> # endif

  Jakub> typedef struct siginfo
  Jakub> {
  Jakub> int si_signo; /* Signal number. */
  Jakub> int si_errno; /* If non-zero, an errno value associated with
  Jakub> this signal, as defined in <errno.h>. */
  Jakub> int si_code; /* Signal code. */

  Jakub> union
  Jakub> {
  Jakub> int _pad[__SI_PAD_SIZE];
  Jakub> ...
  Jakub> struct
  Jakub> {
  Jakub> void *si_addr; /* Faulting insn/memory ref. */
  Jakub> } _sigfault;
  Jakub> ...
  Jakub> } _sifields;
  Jakub> } siginfo_t;

  Jakub> The kernel unfortunately does this right on sparc64 and alpha
  Jakub> from 64-bit arches only; ia64, s390x, ppc64 etc. got it
  Jakub> wrong.

The ia64 kernel defines in asm-ia64/siginfo.h:

#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4)

typedef struct siginfo {
        int si_signo;
        int si_errno;
        int si_code;
        int __pad0;

What's wrong with that?

        --david
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 15 2003 - 22:00:52 EST