From: Russ Allbery Date: Tue, 20 Apr 2010 05:01:27 +0000 (-0700) Subject: Fix UCONTEXT detection on ppc_linux26 via include order X-Git-Tag: openafs-devel-1_5_74_1~12 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=54226e9ad45003f4f54b1a7ba2b13003dcf1edb7;p=packages%2Fo%2Fopenafs.git Fix UCONTEXT detection on ppc_linux26 via include order param.linux26.h defines USE_UCONTEXT for all Linux platforms for glibc 2.4 and higher, but it does this by testing __GLIBC__ and __GLIBC_MINOR__. These are defined by features.h, which is included by any system header. At least one system header must be included before those are defined. lwp/process.c was including and before any other headers, leading to those macros being undefined. Most of the Linux architectures either have their own implementation or were explicitly defining USE_UCONTEXT in the per-architecture param file, but ppc_linux26 was relying on the default. Fix this by reordering the includes to include the various system headers before and add a comment explaining why. This previously worked in earlier versions because the old param.ppc_linux26.h file included , which included "stds.h", which included a system header prior to the check for ucontext. The new generic param file reverses that order. Change-Id: I214e54f684afdef07e6e2dec5b6e6e4d255ab4ec Reviewed-on: http://gerrit.openafs.org/1791 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/lwp/process.c b/src/lwp/process.c index edf4971e6..1aabe7b11 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -10,16 +10,22 @@ /* process.c - manage lwp context switches be means of setjmp/longjmp. */ #include -#include - +/* + * We must include at least one system header on Linux prior to including + * afs/param.h, or the __GLIBC__ and __GLIBC_MINOR__ macros will not yet be + * defined and we won't know whether we're using ucontext. + */ #include #include -#include "lwp.h" #ifdef HAVE_STDLIB_H -#include +# include #endif +#include + +#include "lwp.h" + #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV) extern int PRE_Block; /* used in lwp.c and process.s */ #else