You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@gmail.com> on 2004/10/01 20:31:37 UTC

Re: cvs commit: httpd-2.0/os/unix os.h unixd.c

On 1 Oct 2004 16:03:09 -0000, jfclere@apache.org <jf...@apache.org> wrote:
> jfclere     2004/10/01 09:03:09
> 
>   Modified:    os       config.m4
>                os/unix  os.h unixd.c
>   Log:
>   Move the few BS2000 specific in unixd.c

>   Index: unixd.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
>   retrieving revision 1.69
>   retrieving revision 1.70
>   diff -u -r1.69 -r1.70
>   --- unixd.c   24 Apr 2004 19:42:52 -0000      1.69
>   +++ unixd.c   1 Oct 2004 16:03:08 -0000       1.70
>   @@ -457,11 +457,26 @@
>    {
>        apr_socket_t *csd;
>        apr_status_t status;
>   +#ifdef _OSD_POSIX
>   +    int sockdes;
>   +#endif
> 
>        *accepted = NULL;
>        status = apr_socket_accept(&csd, lr->sd, ptrans);
>        if (status == APR_SUCCESS) {
>            *accepted = csd;
>   +#ifdef _OSD_POSIX
>   +        apr_os_sock_get(&sockdes, csd);
>   +        if (sockdes >= FD_SETSIZE) {
>   +            ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
>   +                         "new file descriptor %d is too large; you probably need "
>   +                         "to rebuild Apache with a larger FD_SETSIZE "
>   +                         "(currently %d)",
>   +                         sockdes, FD_SETSIZE);
>   +            apr_socket_close(csd);
>   +            return APR_EINTR;
>   +        }
>   +#endif

the old logic was removed on purpose

an analogous check is in APR at the point where select() is actually
needed; an error will be returned from the apr poll call or the apr
send/recv call

the APR check covers not just sockets but also pipes used to
communicate with CGIs

it would be nice if there was a special APR error code to use there
with a unique error message though

(btw, it is APR that would need to be rebuilt)

Re: cvs commit: httpd-2.0/os/unix os.h unixd.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, 04 Oct 2004 10:35:47 +0200, jean-frederic clere
<jf...@fujitsu-siemens.com> wrote:
> 
> 
> Jeff Trawick wrote:
> > On 1 Oct 2004 16:03:09 -0000, jfclere@apache.org <jf...@apache.org> wrote:
> >
> >>jfclere     2004/10/01 09:03:09
> >>
> >>  Modified:    os       config.m4
> >>               os/unix  os.h unixd.c
> >>  Log:
> >>  Move the few BS2000 specific in unixd.c
> >
> >
> >>  Index: unixd.c
> >>  ===================================================================
> >>  RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
> >>  retrieving revision 1.69
> >>  retrieving revision 1.70
> >>  diff -u -r1.69 -r1.70
> >>  --- unixd.c   24 Apr 2004 19:42:52 -0000      1.69
> >>  +++ unixd.c   1 Oct 2004 16:03:08 -0000       1.70
> >>  @@ -457,11 +457,26 @@
> >>   {
> >>       apr_socket_t *csd;
> >>       apr_status_t status;
> >>  +#ifdef _OSD_POSIX
> >>  +    int sockdes;
> >>  +#endif
> >>
> >>       *accepted = NULL;
> >>       status = apr_socket_accept(&csd, lr->sd, ptrans);
> >>       if (status == APR_SUCCESS) {
> >>           *accepted = csd;
> >>  +#ifdef _OSD_POSIX
> >>  +        apr_os_sock_get(&sockdes, csd);
> >>  +        if (sockdes >= FD_SETSIZE) {
> >>  +            ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
> >>  +                         "new file descriptor %d is too large; you probably need "
> >>  +                         "to rebuild Apache with a larger FD_SETSIZE "
> >>  +                         "(currently %d)",
> >>  +                         sockdes, FD_SETSIZE);
> >>  +            apr_socket_close(csd);
> >>  +            return APR_EINTR;
> >>  +        }
> >>  +#endif
> >
> >
> > the old logic was removed on purpose
> >
> > an analogous check is in APR at the point where select() is actually
> > needed; an error will be returned from the apr poll call or the apr
> > send/recv call
> >
> > the APR check covers not just sockets but also pipes used to
> > communicate with CGIs
> >
> > it would be nice if there was a special APR error code to use there
> > with a unique error message though
> >
> > (btw, it is APR that would need to be rebuilt)
> >
> >
> 
> In poll/unix/poll.c:
> +++
>          if (fd >= FD_SETSIZE) {
>              /* XXX invent new error code so application has a clue */
>              return APR_EBADF;
>          }
> +++
> 

yes, introducing a unique error code for this special condition would
result in a meaningful error message that doesn't require browsing the
source to understand the situation

the handling of this is better left to APR so that it applies to all
platforms where a select() with this limitation is used; if we need to
make the information about needing to compile apr differently more
transparent, so be it, as multiple applications can take advantage of
such an enhancement

Re: cvs commit: httpd-2.0/os/unix os.h unixd.c

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Jeff Trawick wrote:
> On 1 Oct 2004 16:03:09 -0000, jfclere@apache.org <jf...@apache.org> wrote:
> 
>>jfclere     2004/10/01 09:03:09
>>
>>  Modified:    os       config.m4
>>               os/unix  os.h unixd.c
>>  Log:
>>  Move the few BS2000 specific in unixd.c
> 
> 
>>  Index: unixd.c
>>  ===================================================================
>>  RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
>>  retrieving revision 1.69
>>  retrieving revision 1.70
>>  diff -u -r1.69 -r1.70
>>  --- unixd.c   24 Apr 2004 19:42:52 -0000      1.69
>>  +++ unixd.c   1 Oct 2004 16:03:08 -0000       1.70
>>  @@ -457,11 +457,26 @@
>>   {
>>       apr_socket_t *csd;
>>       apr_status_t status;
>>  +#ifdef _OSD_POSIX
>>  +    int sockdes;
>>  +#endif
>>
>>       *accepted = NULL;
>>       status = apr_socket_accept(&csd, lr->sd, ptrans);
>>       if (status == APR_SUCCESS) {
>>           *accepted = csd;
>>  +#ifdef _OSD_POSIX
>>  +        apr_os_sock_get(&sockdes, csd);
>>  +        if (sockdes >= FD_SETSIZE) {
>>  +            ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
>>  +                         "new file descriptor %d is too large; you probably need "
>>  +                         "to rebuild Apache with a larger FD_SETSIZE "
>>  +                         "(currently %d)",
>>  +                         sockdes, FD_SETSIZE);
>>  +            apr_socket_close(csd);
>>  +            return APR_EINTR;
>>  +        }
>>  +#endif
> 
> 
> the old logic was removed on purpose
> 
> an analogous check is in APR at the point where select() is actually
> needed; an error will be returned from the apr poll call or the apr
> send/recv call
> 
> the APR check covers not just sockets but also pipes used to
> communicate with CGIs
> 
> it would be nice if there was a special APR error code to use there
> with a unique error message though
> 
> (btw, it is APR that would need to be rebuilt)
> 
> 

In poll/unix/poll.c:
+++
         if (fd >= FD_SETSIZE) {
             /* XXX invent new error code so application has a clue */
             return APR_EBADF;
         }
+++