-------- Original Message --------
Subject: Re: VAX Ultrix bootstrap failure with gcc-2.96
Date: Wed, 14 Jun 2000 08:07:51 -0700
From: Bruce Korb <[EMAIL PROTECTED]>
Organization: Santa Cruz Operations
To: John David Anglin <[EMAIL PROTECTED]>
CC: "Kaveh R. Ghazi" <[EMAIL PROTECTED]>, [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED]
References: <[EMAIL PROTECTED]>

John David Anglin wrote:
> 
> This shouldn't have been installed.  I thought the patch was dead after
> Bruce pointed out that the configure test is done on the build system whereas
> the fix has to be on the target.  Thus, this appoach won't work for a
> cross.  That's why Bruce didn't install it.
> 
> My original patch using an #ifdef bsd4_2 in sys-protos.h does get propagated
> through to unistd.h.  However, this also won't work for a cross.  Thus,
> I was going to work up an inclhack to fix the problem before fix-header
> does its work.  However, since the problem is more general than ultrix,
> maybe there is a better approach?

Add a c_test to fixincl that does the same test that the
configury test program does?  If the test passes, then do
appropriate hackery in unistd.h:

  /* Thanks to Mike Rendell for this test.  */
  #include <sys/types.h>
  #define NGID 256
  #undef MAX
  #define MAX(x, y) ((x) > (y) ? (x) : (y))
  int
  main ()
  {
    gid_t gidset[NGID];
    int i, n;
    union { gid_t gval; long lval; }  val;

    val.lval = -1;
    for (i = 0; i < NGID; i++)
      gidset[i] = val.gval;
    n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
                   gidset);
    /* Exit non-zero if getgroups seems to require an array of ints.  This
       happens when gid_t is short but getgroups modifies an array of ints.  */
    exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
  }

What if we were to *always* insert one of the following two
#define-s into unistd.h:

  #define __GETGROUPS_T gid_t
  #define __GETGROUPS_T int

and then *always* declare getgroups (altered as required):

  extern int getgroups _P(( int, __GETGROUPS_T* ));

Forevermore, users of GCC would be able to know the type of the
second argument.  I'm sure our autoconf friends would be happy
to help coordinate a solution.  :-)

Reply via email to