Problems with 0.9.1 on not so recent Linux kernels.

Maxim Dounin mdounin at mdounin.ru
Thu Dec 2 02:52:45 MSK 2010


Hello!

On Wed, Dec 01, 2010 at 10:38:58PM +0300, Igor Sysoev wrote:

> On Wed, Dec 01, 2010 at 06:01:22PM +0000, António P. P. Almeida wrote:
> 
> > > It seems that 2.6.26 kernel does not support this syscall.
> > > In next release I will make fallback to standard accept(), if it
> > > accept4() is not implemented in kernel. This will allow to use
> > > on old kernels packages built on modern kernels.
> > 
> > Ok.
> 
> Could you try the attched patch ? It should report once
>    accept4() failed (38: Function not implemented)
> on old kernel and fallback to usual accept().

[...]

>  #if (NGX_HAVE_ACCEPT4)
> -        s = accept4(lc->fd, (struct sockaddr *) sa, &socklen, SOCK_NONBLOCK);
> +        if (use_accept4) {
> +            s = accept4(lc->fd, (struct sockaddr *) sa, &socklen,
> +                        SOCK_NONBLOCK);
> +        } else {
> +            s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
> +        }
>  #else
>          s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
>  #endif
> @@ -63,8 +71,18 @@
>  
>              ngx_log_error((ngx_uint_t) ((err == NGX_ECONNABORTED) ?
>                                               NGX_LOG_ERR : NGX_LOG_ALERT),
> -                          ev->log, err, "accept() failed");
> +                          ev->log, err,
> +#if !(NGX_HAVE_ACCEPT4)
> +                          "accept() failed");
> +#else
> +                          use_accept4 ? "accept4() failed" : "accept() failed");
>  
> +            if (use_accept4 && err == NGX_ENOSYS) {
> +                use_accept4 = 0;
> +                continue;

You have to reset ngx_inherited_nonblocking here as well.

Maxim Dounin



More information about the nginx mailing list