You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Sascha Schumann <sa...@schumann.cx> on 2001/01/05 19:59:15 UTC

Re: cvs commit: apr configure.in

On 5 Jan 2001 rbb@apache.org wrote:

> rbb         01/01/05 09:19:57
>
>   Modified:    .        configure.in
>   Log:
>   Some Linux's do not define TCP_CORK.

    I guess you are referring to libc 5.x.x systems?  There are
    still kernels around (2.0.x, early 2.2.x possibly) which
    don't support TCP_CORK, so I think we should not simply
    presume that TCP_CORK works.

    Would anyone mind, if the *linux* portion of the case
    statement would egrep linux/socket.h for TCP_CORK?

    - Sascha


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
> >     Unless GCC defines __GLIBC__ (which it should not do), I
> >     don't see any way how this expression can evaluate to false.
>
> GCC doesn't define __GLIBC__, glibc header files do

    Don't worry, that was a sort-of rhetorical statement. =)

    I expected the AC_EGREP_HEADER macro to do something
    different.  So, confusion was the source of error here.  I've
    fixed it in CVS already.

    - Sascha


Re: cvs commit: apr configure.in

Posted by Jeff Trawick <tr...@bellsouth.net>.
Sascha Schumann <sa...@schumann.cx> writes:

> > Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
> > the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
> > because TCP_CORK is hidden by a check for the libc version.
> 
>     Hm, here it looks that way:
> 
>     #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> 
>     Unless GCC defines __GLIBC__ (which it should not do), I
>     don't see any way how this expression can evaluate to false.

GCC doesn't define __GLIBC__, glibc header files do (<features.h>).

Try

#include <stdio.h>
#if defined(__GLIBC__)
#error gobble
#endif

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: apr configure.in

Posted by Jeff Trawick <tr...@bellsouth.net>.
Sascha Schumann <sa...@schumann.cx> writes:

> > Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
> > the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
> > because TCP_CORK is hidden by a check for the libc version.
> 
>     Hm, here it looks that way:
> 
>     #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> 
>     Unless GCC defines __GLIBC__ (which it should not do), I
>     don't see any way how this expression can evaluate to false.

GCC doesn't define __GLIBC__, glibc header files do (<features.h>).

Try

#include <stdio.h>
#if defined(__GLIBC__)
#error gobble
#endif

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> > It's false on Mandrake 7.1 too.  I am in the middle of testing a patch
> > that just looks for sendfile.  I think that is the safest way to code
> > this.
> 
>     Yeah, instead of curing the problem the Right Way, we just
>     work around it by relying on "well-established" assumptions.
>     Great solution.

So find the real solution, but in the meantime, let's do what works right
now.  Nobody is stoping you from figuring out why the EGREP doesn't work,
but I am trying to test the server right now, and I can't compile easily,
because we don't have the autoconf stuff working.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
> It's false on Mandrake 7.1 too.  I am in the middle of testing a patch
> that just looks for sendfile.  I think that is the safest way to code
> this.

    Yeah, instead of curing the problem the Right Way, we just
    work around it by relying on "well-established" assumptions.
    Great solution.

    - Sascha


Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> > Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
> > the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
> > because TCP_CORK is hidden by a check for the libc version.
> 
>     Hm, here it looks that way:
> 
>     #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> 
>     Unless GCC defines __GLIBC__ (which it should not do), I
>     don't see any way how this expression can evaluate to false.

It's false on Mandrake 7.1 too.  I am in the middle of testing a patch
that just looks for sendfile.  I think that is the safest way to code
this.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
> Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
> the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
> because TCP_CORK is hidden by a check for the libc version.

    Hm, here it looks that way:

    #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

    Unless GCC defines __GLIBC__ (which it should not do), I
    don't see any way how this expression can evaluate to false.

    - Sascha


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
> Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
> the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
> because TCP_CORK is hidden by a check for the libc version.

    Hm, here it looks that way:

    #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

    Unless GCC defines __GLIBC__ (which it should not do), I
    don't see any way how this expression can evaluate to false.

    - Sascha


Re: cvs commit: apr configure.in

Posted by Jeff Trawick <tr...@bellsouth.net>.
Sascha Schumann <sa...@schumann.cx> writes:

> On 5 Jan 2001 rbb@apache.org wrote:
> 
> > rbb         01/01/05 09:19:57
> >
> >   Modified:    .        configure.in
> >   Log:
> >   Some Linux's do not define TCP_CORK.
> 
>     I guess you are referring to libc 5.x.x systems?  There are
>     still kernels around (2.0.x, early 2.2.x possibly) which
>     don't support TCP_CORK, so I think we should not simply
>     presume that TCP_CORK works.
> 
>     Would anyone mind, if the *linux* portion of the case
>     statement would egrep linux/socket.h for TCP_CORK?

Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
because TCP_CORK is hidden by a check for the libc version.
sendrecv.c won't compile for Linux because APR_HAVE_CORKABLE_TCP is
not set but APR_HAS_SENDFILE is and the Linux-specific code won't
handle that case.

For quite a while we made do with the code below:

#if APR_HAS_SENDFILE
(uninteresting code omitted)

/* Glibc2.1.1 fails to define TCP_CORK.  This is a bug that will be
 *fixed in the next release.  It should be 3
 */
#if !defined(TCP_CORK) && defined(__linux__)
#define TCP_CORK 3
#endif

#endif /* APR_HAS_SENDFILE */

We can put the equivalent logic in configure.in (i.e., if Linux with
sendfile() and we can't find TCP_CORK, fake it).  Nobody found a
problem with that assumption yet, and apache-2.0 has been built on
quite a few Linux distributions while that code was around.  Maybe
some ancient Linux dev kernel has sendfile() but not TCP_CORK, but it
seems remote that somebody would get bit by that problem (don't know
such a kernel exists and it is ancient and whoever had it loves to
upgrade anyway :) ).

I also wonder why we need APR_HAVE_CORKABLE_TCP defined in apr.h.  Do
we expect an APR app to use this?

Have fun...
  
-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: apr configure.in

Posted by Jeff Trawick <tr...@bellsouth.net>.
Sascha Schumann <sa...@schumann.cx> writes:

> On 5 Jan 2001 rbb@apache.org wrote:
> 
> > rbb         01/01/05 09:19:57
> >
> >   Modified:    .        configure.in
> >   Log:
> >   Some Linux's do not define TCP_CORK.
> 
>     I guess you are referring to libc 5.x.x systems?  There are
>     still kernels around (2.0.x, early 2.2.x possibly) which
>     don't support TCP_CORK, so I think we should not simply
>     presume that TCP_CORK works.
> 
>     Would anyone mind, if the *linux* portion of the case
>     statement would egrep linux/socket.h for TCP_CORK?

Okay, what you committed looks nice but on RedHat 6.0 and RedHat 6.1
the AC_EGREP_HEADER doesn't find TCP_CORK in the kernel header file
because TCP_CORK is hidden by a check for the libc version.
sendrecv.c won't compile for Linux because APR_HAVE_CORKABLE_TCP is
not set but APR_HAS_SENDFILE is and the Linux-specific code won't
handle that case.

For quite a while we made do with the code below:

#if APR_HAS_SENDFILE
(uninteresting code omitted)

/* Glibc2.1.1 fails to define TCP_CORK.  This is a bug that will be
 *fixed in the next release.  It should be 3
 */
#if !defined(TCP_CORK) && defined(__linux__)
#define TCP_CORK 3
#endif

#endif /* APR_HAS_SENDFILE */

We can put the equivalent logic in configure.in (i.e., if Linux with
sendfile() and we can't find TCP_CORK, fake it).  Nobody found a
problem with that assumption yet, and apache-2.0 has been built on
quite a few Linux distributions while that code was around.  Maybe
some ancient Linux dev kernel has sendfile() but not TCP_CORK, but it
seems remote that somebody would get bit by that problem (don't know
such a kernel exists and it is ancient and whoever had it loves to
upgrade anyway :) ).

I also wonder why we need APR_HAVE_CORKABLE_TCP defined in apr.h.  Do
we expect an APR app to use this?

Have fun...
  
-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> > >     I guess you are referring to libc 5.x.x systems?  There are
> > >     still kernels around (2.0.x, early 2.2.x possibly) which
> > >     don't support TCP_CORK, so I think we should not simply
> > >     presume that TCP_CORK works.
> > >
> > >     Would anyone mind, if the *linux* portion of the case
> > >     statement would egrep linux/socket.h for TCP_CORK?
> >
> > Sounds good.  Or, we could just check to see if we are on linux and
> > sendfile is defined.  Is that a good enough check?
> 
>     Was TCP_CORK and sendfile introduced at the same time?  I
>     don't know.. anyway, I've committed the small egrep addition
>     which should properly exclude older kernels (tested on a 2.0
>     system).

I don't know either.  I would kind of hope so, plus in the old code, we
were searching for sendfile() and if that was defined, we assumed TCP_CORK
was defined or at least available.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> > >     I guess you are referring to libc 5.x.x systems?  There are
> > >     still kernels around (2.0.x, early 2.2.x possibly) which
> > >     don't support TCP_CORK, so I think we should not simply
> > >     presume that TCP_CORK works.
> > >
> > >     Would anyone mind, if the *linux* portion of the case
> > >     statement would egrep linux/socket.h for TCP_CORK?
> >
> > Sounds good.  Or, we could just check to see if we are on linux and
> > sendfile is defined.  Is that a good enough check?
> 
>     Was TCP_CORK and sendfile introduced at the same time?  I
>     don't know.. anyway, I've committed the small egrep addition
>     which should properly exclude older kernels (tested on a 2.0
>     system).

I don't know either.  I would kind of hope so, plus in the old code, we
were searching for sendfile() and if that was defined, we assumed TCP_CORK
was defined or at least available.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
On Fri, 5 Jan 2001 rbb@covalent.net wrote:

>
> > >   Some Linux's do not define TCP_CORK.
> >
> >     I guess you are referring to libc 5.x.x systems?  There are
> >     still kernels around (2.0.x, early 2.2.x possibly) which
> >     don't support TCP_CORK, so I think we should not simply
> >     presume that TCP_CORK works.
> >
> >     Would anyone mind, if the *linux* portion of the case
> >     statement would egrep linux/socket.h for TCP_CORK?
>
> Sounds good.  Or, we could just check to see if we are on linux and
> sendfile is defined.  Is that a good enough check?

    Was TCP_CORK and sendfile introduced at the same time?  I
    don't know.. anyway, I've committed the small egrep addition
    which should properly exclude older kernels (tested on a 2.0
    system).

    - Sascha


Re: cvs commit: apr configure.in

Posted by Sascha Schumann <sa...@schumann.cx>.
On Fri, 5 Jan 2001 rbb@covalent.net wrote:

>
> > >   Some Linux's do not define TCP_CORK.
> >
> >     I guess you are referring to libc 5.x.x systems?  There are
> >     still kernels around (2.0.x, early 2.2.x possibly) which
> >     don't support TCP_CORK, so I think we should not simply
> >     presume that TCP_CORK works.
> >
> >     Would anyone mind, if the *linux* portion of the case
> >     statement would egrep linux/socket.h for TCP_CORK?
>
> Sounds good.  Or, we could just check to see if we are on linux and
> sendfile is defined.  Is that a good enough check?

    Was TCP_CORK and sendfile introduced at the same time?  I
    don't know.. anyway, I've committed the small egrep addition
    which should properly exclude older kernels (tested on a 2.0
    system).

    - Sascha


Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> >   Some Linux's do not define TCP_CORK.
> 
>     I guess you are referring to libc 5.x.x systems?  There are
>     still kernels around (2.0.x, early 2.2.x possibly) which
>     don't support TCP_CORK, so I think we should not simply
>     presume that TCP_CORK works.
> 
>     Would anyone mind, if the *linux* portion of the case
>     statement would egrep linux/socket.h for TCP_CORK?

Sounds good.  Or, we could just check to see if we are on linux and
sendfile is defined.  Is that a good enough check?

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apr configure.in

Posted by rb...@covalent.net.
> >   Some Linux's do not define TCP_CORK.
> 
>     I guess you are referring to libc 5.x.x systems?  There are
>     still kernels around (2.0.x, early 2.2.x possibly) which
>     don't support TCP_CORK, so I think we should not simply
>     presume that TCP_CORK works.
> 
>     Would anyone mind, if the *linux* portion of the case
>     statement would egrep linux/socket.h for TCP_CORK?

Sounds good.  Or, we could just check to see if we are on linux and
sendfile is defined.  Is that a good enough check?

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------