Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 5584 invoked by uid 6000); 16 Dec 1997 07:32:11 -0000 Received: (qmail 5576 invoked from network); 16 Dec 1997 07:32:10 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 16 Dec 1997 07:32:10 -0000 Received: (qmail 1222 invoked by uid 500); 16 Dec 1997 07:33:31 -0000 Date: Mon, 15 Dec 1997 23:33:31 -0800 (PST) From: Dean Gaudet To: TLOSAP Subject: [PATCH] Re: os-linux/1542: /usr/include/bits/resource.h:113: conflicting types for `rlim_t' (fwd) In-Reply-To: Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org On Wed, 10 Dec 1997, Marc Slemko wrote: > I would suggest that the time for automatic rlim_t testing is near. > > It is easy to add a "type" test to TestCompile, but the trouble is what > include files do you use? For rlim_t, it should be sys/resource.h > normally but how do you generalize that? > > It may be possible to hardcode rlim_t, but we need to know exactly what > version of glibc has it, etc. A pain. I spent time looking into this. glibc has a few gotches that are annoying. I don't think we can support -Wall warning free compilation on all versions of glibc... For example, 2.0.0 through 2.0.4 use "size_t *" for the third paramter to accept() and other network functions, whereas 2.0.5 and later use "socklen_t *". This is due to evolution of the POSIX spec. (Using size_t is broken broken broken, and was a hideous mistake in the spec, it breaks all old programs that assume that paramter is an "int *" when compiled on 64-bit systems. socklen_t is essentially an int.) However, there is no way to detect 2.0.x < 2.0.5. Thankfully rlim_t appears only in glibc 2.1.x, and not earlier. The following patch is a reasonable attempt to get us -Wall free compiles on 2.0.5 (and later) and 2.1.x glibc. The rlim_t change is required to compile on 2.1.x. I've tested on glibc 2.0.5 alpha and ppc systems, and libc5 i386 systems. The rest I gleaned from looking at various versions of glibc. Dean Index: conf.h =================================================================== RCS file: /export/home/cvs/apachen/src/main/conf.h,v retrieving revision 1.162 diff -u -r1.162 conf.h --- conf.h 1997/12/01 12:10:14 1.162 +++ conf.h 1997/12/16 07:27:14 @@ -310,22 +310,50 @@ #define HAVE_SYSLOG #elif defined(LINUX) + #if LINUX > 1 #include + +/* libc4 systems probably still work, it probably doesn't define + * __GNU_LIBRARY__ + * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__ + * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as + * "deprecated in favour of __GLIBC__"; the value 6 will never be changed. + * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have + * __GLIBC__ < 2 + * all glibc based systems need crypt.h + */ #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 -/* it's a glibc host */ #include -#define NET_SIZE_T size_t #endif + +/* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t * + * there's no way to discern between these two libraries. But using int should + * be portable because otherwise these libs would be hopelessly broken with + * reams of existing networking code. We'll use socklen_t * for 2.1.x and + * later. + * + * int works for all the earlier libs, and is picked up by default later. + */ +#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)) +#define NET_SIZE_T socklen_t +#endif + #define HAVE_SHMGET #define USE_MMAP_FILES #define HAVE_SYS_RESOURCE_H + +/* glibc 2.1 and later finally define rlim_t */ +#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) typedef int rlim_t; +#endif /* flock is faster ... but hasn't been tested on 1.x systems */ #define USE_FLOCK_SERIALIZED_ACCEPT + #else #define USE_FCNTL_SERIALIZED_ACCEPT #endif + #undef HAVE_GMTOFF #undef NO_KILLPG #undef NO_SETSID