[nginx] Removed the obsolete aio module.

Ruslan Ermilov ru at nginx.com
Thu Apr 23 11:18:16 UTC 2015


details:   http://hg.nginx.org/nginx/rev/4dc8e7b62216
branches:  
changeset: 6125:4dc8e7b62216
user:      Ruslan Ermilov <ru at nginx.com>
date:      Wed Apr 22 18:57:32 2015 +0300
description:
Removed the obsolete aio module.

diffstat:

 auto/options                        |    2 -
 auto/os/freebsd                     |   20 ----
 auto/os/win32                       |    1 -
 auto/sources                        |    7 -
 src/core/ngx_connection.c           |    2 +-
 src/core/ngx_resolver.c             |    2 +-
 src/event/modules/ngx_aio_module.c  |  171 ------------------------------------
 src/event/modules/ngx_iocp_module.c |    2 +-
 src/event/ngx_event.c               |    4 +-
 src/event/ngx_event.h               |   10 +-
 src/event/ngx_event_accept.c        |    9 +-
 src/event/ngx_event_connect.c       |    4 +-
 src/http/ngx_http_request.c         |    2 +-
 src/http/ngx_http_upstream.c        |    2 +-
 src/os/unix/ngx_aio_read.c          |  109 ----------------------
 src/os/unix/ngx_aio_read_chain.c    |   78 ----------------
 src/os/unix/ngx_aio_write.c         |  109 ----------------------
 src/os/unix/ngx_aio_write_chain.c   |  100 ---------------------
 src/os/unix/ngx_freebsd_config.h    |    2 +-
 src/os/unix/ngx_os.h                |    8 -
 20 files changed, 14 insertions(+), 630 deletions(-)

diffs (truncated from 860 to 300 lines):

diff -r f1f222db290b -r 4dc8e7b62216 auto/options
--- a/auto/options	Wed Apr 22 19:55:04 2015 +0300
+++ b/auto/options	Wed Apr 22 18:57:32 2015 +0300
@@ -41,7 +41,6 @@ EVENT_FOUND=NO
 EVENT_RTSIG=NO
 EVENT_SELECT=NO
 EVENT_POLL=NO
-EVENT_AIO=NO
 
 USE_THREADS=NO
 
@@ -195,7 +194,6 @@ do
         --without-select_module)         EVENT_SELECT=NONE          ;;
         --with-poll_module)              EVENT_POLL=YES             ;;
         --without-poll_module)           EVENT_POLL=NONE            ;;
-        --with-aio_module)               EVENT_AIO=YES              ;;
 
         --with-threads)                  USE_THREADS=YES            ;;
 
diff -r f1f222db290b -r 4dc8e7b62216 auto/os/freebsd
--- a/auto/os/freebsd	Wed Apr 22 19:55:04 2015 +0300
+++ b/auto/os/freebsd	Wed Apr 22 18:57:32 2015 +0300
@@ -99,26 +99,6 @@ then
 fi
 
 
-if [ $EVENT_AIO = YES ]; then
-    if [ \( $version -lt 500000 -a $version -ge 430000 \) \
-         -o $version -ge 500014 ]
-    then
-        have=NGX_HAVE_AIO . auto/have
-        EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
-        CORE_SRCS="$CORE_SRCS $AIO_SRCS"
-    else
-
-cat << END
-
-$0: error: the kqueue does not support AIO on this FreeBSD version
-
-END
-
-        exit 1
-    fi
-fi
-
-
 # cpuset_setaffinity()
 
 if [ $version -ge 701000 ]; then
diff -r f1f222db290b -r 4dc8e7b62216 auto/os/win32
--- a/auto/os/win32	Wed Apr 22 19:55:04 2015 +0300
+++ b/auto/os/win32	Wed Apr 22 18:57:32 2015 +0300
@@ -36,5 +36,4 @@ if [ $NGX_IPV6 = YES ]; then
     have=NGX_HAVE_INET6 . auto/have
 fi
 
-have=NGX_HAVE_AIO . auto/have
 have=NGX_HAVE_IOCP . auto/have
diff -r f1f222db290b -r 4dc8e7b62216 auto/sources
--- a/auto/sources	Wed Apr 22 19:55:04 2015 +0300
+++ b/auto/sources	Wed Apr 22 18:57:32 2015 +0300
@@ -130,13 +130,6 @@ RTSIG_SRCS=src/event/modules/ngx_rtsig_m
 IOCP_MODULE=ngx_iocp_module
 IOCP_SRCS=src/event/modules/ngx_iocp_module.c
 
-AIO_MODULE=ngx_aio_module
-AIO_SRCS="src/event/modules/ngx_aio_module.c \
-          src/os/unix/ngx_aio_read.c \
-          src/os/unix/ngx_aio_write.c \
-          src/os/unix/ngx_aio_read_chain.c \
-          src/os/unix/ngx_aio_write_chain.c"
-
 FILE_AIO_SRCS="src/os/unix/ngx_file_aio_read.c"
 LINUX_AIO_SRCS="src/os/unix/ngx_linux_aio_read.c"
 
diff -r f1f222db290b -r 4dc8e7b62216 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c	Wed Apr 22 19:55:04 2015 +0300
+++ b/src/core/ngx_connection.c	Wed Apr 22 18:57:32 2015 +0300
@@ -389,7 +389,7 @@ ngx_open_listening_sockets(ngx_cycle_t *
 #endif
             /* TODO: close on exit */
 
-            if (!(ngx_event_flags & NGX_USE_AIO_EVENT)) {
+            if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
                 if (ngx_nonblocking(s) == -1) {
                     ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
                                   ngx_nonblocking_n " %V failed",
diff -r f1f222db290b -r 4dc8e7b62216 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c	Wed Apr 22 19:55:04 2015 +0300
+++ b/src/core/ngx_resolver.c	Wed Apr 22 18:57:32 2015 +0300
@@ -3092,7 +3092,7 @@ ngx_udp_connect(ngx_udp_connection_t *uc
 
     rc = connect(s, uc->sockaddr, uc->socklen);
 
-    /* TODO: aio, iocp */
+    /* TODO: iocp */
 
     if (rc == -1) {
         ngx_log_error(NGX_LOG_CRIT, &uc->log, ngx_socket_errno,
diff -r f1f222db290b -r 4dc8e7b62216 src/event/modules/ngx_aio_module.c
--- a/src/event/modules/ngx_aio_module.c	Wed Apr 22 19:55:04 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) Nginx, Inc.
- */
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <ngx_event.h>
-
-
-extern ngx_event_module_t  ngx_kqueue_module_ctx;
-
-
-static ngx_int_t ngx_aio_init(ngx_cycle_t *cycle, ngx_msec_t timer);
-static void ngx_aio_done(ngx_cycle_t *cycle);
-static ngx_int_t ngx_aio_add_event(ngx_event_t *ev, ngx_int_t event,
-    ngx_uint_t flags);
-static ngx_int_t ngx_aio_del_event(ngx_event_t *ev, ngx_int_t event,
-    ngx_uint_t flags);
-static ngx_int_t ngx_aio_del_connection(ngx_connection_t *c, ngx_uint_t flags);
-static ngx_int_t ngx_aio_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
-    ngx_uint_t flags);
-
-
-ngx_os_io_t ngx_os_aio = {
-    ngx_aio_read,
-    ngx_aio_read_chain,
-    NULL,
-    ngx_aio_write,
-    ngx_aio_write_chain,
-    0
-};
-
-
-static ngx_str_t      aio_name = ngx_string("aio");
-
-ngx_event_module_t  ngx_aio_module_ctx = {
-    &aio_name,
-    NULL,                                  /* create configuration */
-    NULL,                                  /* init configuration */
-
-    {
-        ngx_aio_add_event,                 /* add an event */
-        ngx_aio_del_event,                 /* delete an event */
-        NULL,                              /* enable an event */
-        NULL,                              /* disable an event */
-        NULL,                              /* add an connection */
-        ngx_aio_del_connection,            /* delete an connection */
-        NULL,                              /* trigger a notify */
-        ngx_aio_process_events,            /* process the events */
-        ngx_aio_init,                      /* init the events */
-        ngx_aio_done                       /* done the events */
-    }
-
-};
-
-ngx_module_t  ngx_aio_module = {
-    NGX_MODULE_V1,
-    &ngx_aio_module_ctx,                   /* module context */
-    NULL,                                  /* module directives */
-    NGX_EVENT_MODULE,                      /* module type */
-    NULL,                                  /* init master */
-    NULL,                                  /* init module */
-    NULL,                                  /* init process */
-    NULL,                                  /* init thread */
-    NULL,                                  /* exit thread */
-    NULL,                                  /* exit process */
-    NULL,                                  /* exit master */
-    NGX_MODULE_V1_PADDING
-};
-
-
-#if (NGX_HAVE_KQUEUE)
-
-static ngx_int_t
-ngx_aio_init(ngx_cycle_t *cycle, ngx_msec_t timer)
-{
-    if (ngx_kqueue_module_ctx.actions.init(cycle, timer) == NGX_ERROR) {
-        return NGX_ERROR;
-    }
-
-    ngx_io = ngx_os_aio;
-
-    ngx_event_flags = NGX_USE_AIO_EVENT;
-    ngx_event_actions = ngx_aio_module_ctx.actions;
-
-
-    return NGX_OK;
-}
-
-
-static void
-ngx_aio_done(ngx_cycle_t *cycle)
-{
-    ngx_kqueue_module_ctx.actions.done(cycle);
-}
-
-
-/* the event adding and deleting are needed for the listening sockets */
-
-static ngx_int_t
-ngx_aio_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
-{
-    return ngx_kqueue_module_ctx.actions.add(ev, event, flags);
-}
-
-
-static ngx_int_t
-ngx_aio_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
-{
-    return ngx_kqueue_module_ctx.actions.del(ev, event, flags);
-}
-
-
-static ngx_int_t
-ngx_aio_del_connection(ngx_connection_t *c, ngx_uint_t flags)
-{
-    int  rc;
-
-    if (c->read->active == 0 && c->write->active == 0) {
-        return NGX_OK;
-    }
-
-    if (flags & NGX_CLOSE_EVENT) {
-        return NGX_OK;
-    }
-
-    rc = aio_cancel(c->fd, NULL);
-
-    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "aio_cancel: %d", rc);
-
-    if (rc == AIO_CANCELED) {
-        c->read->active = 0;
-        c->write->active = 0;
-        return NGX_OK;
-    }
-
-    if (rc == AIO_ALLDONE) {
-        c->read->active = 0;
-        c->write->active = 0;
-        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
-                      "aio_cancel() returned AIO_ALLDONE");
-        return NGX_OK;
-    }
-
-    if (rc == -1) {
-        ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
-                      "aio_cancel() failed");
-        return NGX_ERROR;
-    }
-
-    if (rc == AIO_NOTCANCELED) {
-        ngx_log_error(NGX_LOG_ALERT, c->log, 0,
-                      "aio_cancel() returned AIO_NOTCANCELED");
-
-        return NGX_ERROR;
-    }
-
-    return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_aio_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
-{
-    return ngx_kqueue_module_ctx.actions.process_events(cycle, timer, flags);
-}
-
-#endif /* NGX_HAVE_KQUEUE */
diff -r f1f222db290b -r 4dc8e7b62216 src/event/modules/ngx_iocp_module.c
--- a/src/event/modules/ngx_iocp_module.c	Wed Apr 22 19:55:04 2015 +0300
+++ b/src/event/modules/ngx_iocp_module.c	Wed Apr 22 18:57:32 2015 +0300
@@ -125,7 +125,7 @@ ngx_iocp_init(ngx_cycle_t *cycle, ngx_ms
 
     ngx_event_actions = ngx_iocp_module_ctx.actions;
 
-    ngx_event_flags = NGX_USE_AIO_EVENT|NGX_USE_IOCP_EVENT;
+    ngx_event_flags = NGX_USE_IOCP_EVENT;
 
     if (timer == 0) {
         return NGX_OK;
diff -r f1f222db290b -r 4dc8e7b62216 src/event/ngx_event.c
--- a/src/event/ngx_event.c	Wed Apr 22 19:55:04 2015 +0300
+++ b/src/event/ngx_event.c	Wed Apr 22 18:57:32 2015 +0300
@@ -330,7 +330,7 @@ ngx_handle_read_event(ngx_event_t *rev, 
         }
     }
 
-    /* aio, iocp, rtsig */
+    /* iocp, rtsig */
 
     return NGX_OK;
 }
@@ -409,7 +409,7 @@ ngx_handle_write_event(ngx_event_t *wev,
         }



More information about the nginx-devel mailing list