sigcontext_struct

Andrew Haley aph@pasanda.cygnus.co.uk
Mon Oct 18 12:05:00 GMT 1999


> From: Godmar Back <gback@cs.utah.edu>
> Date: Mon, 18 Oct 1999 12:58:11 -0600 (MDT)
> 
> I'm just reporting on what we've learned in Kaffe.  (I should credit
> Edouard Parmelan specifically for finding this out.)

Yes, thanks indeed, I do appreciate the info even though it's bad
news!

> I know that major distributions were affected, so I don't think it
> was individual people's fault.  Unfortunately, unlike in systems like
> FreeBSD, if you upgrade a Linux kernel and/or glibc, there's no 
> mechanism to ensure that the two are in sync.
> 
> Our work-around was to not use siginfo for the time being.
> But you're right that it's slowly dying.

It's a bullet that we'll have to bite, sooner or later.  Okay, perhaps
I can #ifdef on Linux version number and libc version #.  This is
getting really gaggy.

> Some architectures don't even properly implement the old 
> sigcontext.  Linux on the ARM is one such example where the kernel doesn't
> properly establish the signal context.  But their implementation of
> siginfo was broken too, the last time I checked.

This is what Boehm does:

# if defined(LINUX) && !defined(POWERPC)
#   include <linux/version.h>
#   if (LINUX_VERSION_CODE <= 0x10400)
      /* Ugly hack to get struct sigcontext_struct definition.  Required      */
      /* for some early 1.3.X releases.  Will hopefully go away soon. */
      /* in some later Linux releases, asm/sigcontext.h may have to   */
      /* be included instead.                                         */
#     define __KERNEL__
#     include <asm/signal.h>
#     undef __KERNEL__
#   else
      /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
      /* struct sigcontext.  libc6 (glibc2) uses "struct sigcontext" in     */
      /* prototypes, so we have to include the top-level sigcontext.h to    */
      /* make sure the former gets defined to be the latter if appropriate. */
#     include <features.h>
#     if 2 <= __GLIBC__ && 0 == __GLIBC_MINOR__
#       include <sigcontext.h>
#     else /* not 2 <= __GLIBC__ */
        /* libc5 doesn't have <sigcontext.h>: go directly with the kernel   */
        /* one.  Check LINUX_VERSION_CODE to see which we should reference. */
       include <asm/sigcontext.h>
#     endif /* 2 <= __GLIBC__ */
#   endif
# endif

#if defined(LINUX)
#   include <linux/version.h>
#   if (LINUX_VERSION_CODE >= 0x20100)
      typedef void (* REAL_SIG_PF)(int, struct sigcontext);
#   else
      typedef void (* REAL_SIG_PF)(int, struct sigcontext_struct);
#   endif
# endif

...!

Andrew.


More information about the Java mailing list