Linux accept4() support

This commit is contained in:
Igor Sysoev 2010-11-25 10:15:04 +00:00
parent 601ca7cd6e
commit 40747ad861
3 changed files with 14 additions and 1 deletions

View File

@ -305,6 +305,15 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
. auto/feature
ngx_feature="accept4()"
ngx_feature_name="NGX_HAVE_ACCEPT4"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK)"
. auto/feature
if [ $NGX_FILE_AIO = YES ]; then
ngx_feature="kqueue AIO support"

View File

@ -46,7 +46,11 @@ ngx_event_accept(ngx_event_t *ev)
do {
socklen = NGX_SOCKADDRLEN;
#if (NGX_HAVE_ACCEPT4)
s = accept4(lc->fd, (struct sockaddr *) sa, &socklen, SOCK_NONBLOCK);
#else
s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
#endif
if (s == -1) {
err = ngx_socket_errno;

View File

@ -60,7 +60,7 @@ ngx_os_init(ngx_log_t *log)
ngx_max_sockets = (ngx_int_t) rlmt.rlim_cur;
#if (NGX_HAVE_INHERITED_NONBLOCK)
#if (NGX_HAVE_INHERITED_NONBLOCK || NGX_HAVE_ACCEPT4)
ngx_inherited_nonblocking = 1;
#else
ngx_inherited_nonblocking = 0;