This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 06/29] Allow some fields of siginfo to be different from the generic one


On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> In AARCH64:ILP32, we want to use the layout for siginfo as AARCH64:LP64,
> so we need to add a few hooks into siginfo.h to support this.
>
> * sysdeps/unix/sysv/linux/bits/siginfo.h (__SIGINFO_VOIDPTR): New define.
> (__SIGINFO_BAND): New define.
> (union sigval): Use __SIGINFO_VOIDPTR for the pointer.
> (__SI_PAD_SIZE): Don't define if it is already defined.
> (struct siginfo): Use __SIGINFO_VOIDPTR for the pointer types.
> Use __SIGINFO_BAND for the si_band field.
> (struct sigevent): Add a comment on why the remaining fields
> don't need special handling.
> ---
>  sysdeps/unix/sysv/linux/bits/siginfo.h |   26 +++++++++++++++++++-------
>  1 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
> index ae603e8..f319d44 100644
> --- a/sysdeps/unix/sysv/linux/bits/siginfo.h
> +++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
> @@ -23,6 +23,14 @@
>
>  #include <bits/wordsize.h>
>
> +#ifndef __SIGINFO_VOIDPTR
> +#define __SIGINFO_VOIDPTR(field) void *field
> +#endif
> +
> +#ifndef __SIGINFO_BAND
> +#define __SIGINFO_BAND(field) long field
> +#endif
> +

These #defines need indenting.

>  #if (!defined __have_sigval_t \
>       && (defined _SIGNAL_H || defined __need_siginfo_t \
>          || defined __need_sigevent_t))
> @@ -32,7 +40,7 @@
>  typedef union sigval
>    {
>      int sival_int;
> -    void *sival_ptr;
> +    __SIGINFO_VOIDPTR (sival_ptr);
>    } sigval_t;
>  #endif
>
> @@ -41,10 +49,13 @@ typedef union sigval
>  # define __have_siginfo_t      1
>
>  # define __SI_MAX_SIZE     128
> -# if __WORDSIZE == 64
> -#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
> +
> +# ifndef __SI_PAD_SIZE
> +#  if __WORDSIZE == 64
> +#   define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
>  # else

This #else needs indenting further too.

Otherwise this looks ok to me.

> -#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
> +#   define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
> +#  endif
>  # endif
>
>  typedef struct
> @@ -94,21 +105,21 @@ typedef struct
>         /* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
>         struct
>           {
> -           void *si_addr;      /* Faulting insn/memory ref.  */
> +           __SIGINFO_VOIDPTR (si_addr);        /* Faulting insn/memory ref.  */
>             short int si_addr_lsb;      /* Valid LSB of the reported address.  */
>           } _sigfault;
>
>         /* SIGPOLL.  */
>         struct
>           {
> -           long int si_band;   /* Band event for SIGPOLL.  */
> +           __SIGINFO_BAND (si_band);   /* Band event for SIGPOLL.  */
>             int si_fd;
>           } _sigpoll;
>
>         /* SIGSYS.  */
>         struct
>           {
> -           void *_call_addr;   /* Calling user insn.  */
> +           __SIGINFO_VOIDPTR (_call_addr);     /* Calling user insn.  */
>             int _syscall;       /* Triggering system call number.  */
>             unsigned int _arch; /* AUDIT_ARCH_* of syscall.  */
>           } _sigsys;
> @@ -312,6 +323,7 @@ typedef struct sigevent
>            thread to receive the signal.  */
>         __pid_t _tid;
>
> +       /* Note these two are handled only in userspace. */
>         struct
>           {
>             void (*_function) (sigval_t);       /* Function to start.  */
> --
> 1.7.2.5
>



-- 
Will Newton
Toolchain Working Group, Linaro


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]