Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/event
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-11-20 22:52:20 +0300
committerIgor Sysoev <igor@sysoev.ru>2004-11-20 22:52:20 +0300
commitd43bee8ee939992404d59ae0fec248ce46abecb0 (patch)
tree6eb79a6902f147bedb8c85350cbdc68543115907 /src/event
parent13376e1538e2b29e436805c626f6837b34a482c5 (diff)
nginx-0.1.8-RELEASE importrelease-0.1.8
*) Bugfix: in the ngx_http_autoindex_module if the long file names were in the listing. *) Feature: the "^~" modifier in the location directive. *) Feature: the proxy_max_temp_file_size directive.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/ngx_event.c176
-rw-r--r--src/event/ngx_event.h9
-rw-r--r--src/event/ngx_event_pipe.c12
-rw-r--r--src/event/ngx_event_timer.h4
4 files changed, 103 insertions, 98 deletions
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index 563cf4213..b3bf530a3 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -12,31 +12,12 @@
#define DEFAULT_CONNECTIONS 512
-extern ngx_module_t ngx_select_module;
-extern ngx_event_module_t ngx_select_module_ctx;
-
-#if (HAVE_KQUEUE)
-#include <ngx_kqueue_module.h>
-#endif
-
-#if (HAVE_DEVPOLL)
+extern ngx_module_t ngx_kqueue_module;
extern ngx_module_t ngx_devpoll_module;
-extern ngx_event_module_t ngx_devpoll_module_ctx;
-#endif
-
-#if (HAVE_EPOLL)
extern ngx_module_t ngx_epoll_module;
-extern ngx_event_module_t ngx_epoll_module_ctx;
-#endif
-
-#if (HAVE_RTSIG)
extern ngx_module_t ngx_rtsig_module;
-extern ngx_event_module_t ngx_rtsig_module_ctx;
-#endif
+extern ngx_module_t ngx_select_module;
-#if (HAVE_AIO)
-#include <ngx_aio_module.h>
-#endif
static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle);
static ngx_int_t ngx_event_process_init(ngx_cycle_t *cycle);
@@ -631,13 +612,13 @@ static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
&& old_ecf->use != ecf->use)
{
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "when the server runs without a master process "
- "the \"%V\" event type must be the same as "
- "in previous configuration - \"%s\" "
- "and it can not be changed on the fly, "
- "to change it you need to stop server "
- "and start it again",
- &value[1], old_ecf->name);
+ "when the server runs without a master process "
+ "the \"%V\" event type must be the same as "
+ "in previous configuration - \"%s\" "
+ "and it can not be changed on the fly, "
+ "to change it you need to stop server "
+ "and start it again",
+ &value[1], old_ecf->name);
return NGX_CONF_ERROR;
}
@@ -726,99 +707,122 @@ static void *ngx_event_create_conf(ngx_cycle_t *cycle)
static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
{
ngx_event_conf_t *ecf = conf;
-#if (HAVE_RTSIG)
- ngx_core_conf_t *ccf;
-#endif
-#if (HAVE_KQUEUE)
+ int fd, rtsig;
+ ngx_int_t i, connections;
+ ngx_module_t *module;
+ ngx_core_conf_t *ccf;
+ ngx_event_module_t *event_module;
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_unsigned_value(ecf->use, ngx_kqueue_module.ctx_index);
- ngx_conf_init_ptr_value(ecf->name, ngx_kqueue_module_ctx.name->data);
+ connections = NGX_CONF_UNSET_UINT;
+ module = NULL;
+ rtsig = 0;
+ fd = 0;
-#elif (HAVE_DEVPOLL)
+#if (HAVE_EPOLL) && !(TEST_BUILD_EPOLL)
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_unsigned_value(ecf->use, ngx_devpoll_module.ctx_index);
- ngx_conf_init_ptr_value(ecf->name, ngx_devpoll_module_ctx.name->data);
+ fd = epoll_create(100);
-#elif (HAVE_EPOLL)
+ if (fd != -1) {
+ close(fd);
+ connections = DEFAULT_CONNECTIONS;
+ module = &ngx_epoll_module;
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_unsigned_value(ecf->use, ngx_epoll_module.ctx_index);
- ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data);
+ } else if (ngx_errno != NGX_ENOSYS) {
+ connections = DEFAULT_CONNECTIONS;
+ module = &ngx_epoll_module;
+ }
-#elif (HAVE_RTSIG)
+#endif
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
- ngx_conf_init_unsigned_value(ecf->use, ngx_rtsig_module.ctx_index);
- ngx_conf_init_ptr_value(ecf->name, ngx_rtsig_module_ctx.name->data);
+#if (HAVE_RTSIG)
-#elif (HAVE_SELECT)
+ if (module == NULL) {
+ connections = DEFAULT_CONNECTIONS;
+ module = &ngx_rtsig_module;
+ rtsig = 1;
+ }
-#if (NGX_WIN32)
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
-#else
- ngx_conf_init_unsigned_value(ecf->connections,
- FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
#endif
- ngx_conf_init_unsigned_value(ecf->use, ngx_select_module.ctx_index);
- ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
+#if (HAVE_DEVPOLL)
+
+ connections = DEFAULT_CONNECTIONS;
+ module = &ngx_devpoll_module;
+
+#endif
+
+#if (HAVE_KQUEUE)
+ connections = DEFAULT_CONNECTIONS;
+ module = &ngx_kqueue_module;
+
+#endif
+
+#if (HAVE_SELECT)
+
+ if (module == NULL) {
+
+#if (NGX_WIN32)
+ connections = DEFAULT_CONNECTIONS;
#else
+ connections = FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE:
+ DEFAULT_CONNECTIONS;
+#endif
+ module = &ngx_select_module;
+ }
- ngx_int_t i, m;
- ngx_event_module_t *module;
+#endif
- m = -1;
- module = NULL;
+ if (module == NULL) {
+ for (i = 0; ngx_modules[i]; i++) {
+ if (ngx_modules[i]->type == NGX_EVENT_MODULE) {
+ event_module = ngx_modules[i]->ctx;
- for (i = 0; ngx_modules[i]; i++) {
- if (ngx_modules[i]->type == NGX_EVENT_MODULE) {
- module = ngx_modules[i]->ctx;
+ if (ngx_strcmp(event_module->name->data, event_core_name.data)
+ == 0)
+ {
+ continue;
+ }
- if (ngx_strcmp(module->name->data, event_core_name.data) == 0) {
- continue;
+ module = ngx_modules[i];
+ break;
}
-
- m = ngx_modules[i]->ctx_index;
- break;
}
}
- if (m == -1) {
+ if (module == NULL) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found");
return NGX_CONF_ERROR;
}
- ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS);
-
- ngx_conf_init_unsigned_value(ecf->use, m);
- ngx_conf_init_ptr_value(ecf->name, module->name->data);
+ ngx_conf_init_unsigned_value(ecf->connections, connections);
+ cycle->connection_n = ecf->connections;
-#endif
+ ngx_conf_init_unsigned_value(ecf->use, module->ctx_index);
- cycle->connection_n = ecf->connections;
+ event_module = module->ctx;
+ ngx_conf_init_ptr_value(ecf->name, event_module->name->data);
ngx_conf_init_value(ecf->multi_accept, 0);
ngx_conf_init_value(ecf->accept_mutex, 1);
ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500);
-#if (HAVE_RTSIG)
- if (ecf->use == ngx_rtsig_module.ctx_index && ecf->accept_mutex == 0) {
- ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
- ngx_core_module);
- if (ccf->worker_processes) {
- ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
- "the \"rtsig\" method requires "
- "\"accept_mutex\" to be on");
- return NGX_CONF_ERROR;
- }
+
+ if (!rtsig || ecf->accept_mutex) {
+ return NGX_CONF_OK;
}
-#endif
- return NGX_CONF_OK;
+ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
+
+ if (ccf->worker_processes == 0) {
+ return NGX_CONF_OK;
+ }
+
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
+ "the \"rtsig\" method requires \"accept_mutex\" to be on");
+
+ return NGX_CONF_ERROR;
}
diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
index 191b492d6..44728e381 100644
--- a/src/event/ngx_event.h
+++ b/src/event/ngx_event.h
@@ -496,7 +496,7 @@ ngx_int_t ngx_send_lowat(ngx_connection_t *c, size_t lowat);
-ngx_inline static int ngx_handle_read_event(ngx_event_t *rev, u_int flags)
+static ngx_inline ngx_int_t ngx_handle_read_event(ngx_event_t *rev, u_int flags)
{
if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
@@ -540,7 +540,7 @@ ngx_inline static int ngx_handle_read_event(ngx_event_t *rev, u_int flags)
}
-ngx_inline static int ngx_handle_level_read_event(ngx_event_t *rev)
+static ngx_inline ngx_int_t ngx_handle_level_read_event(ngx_event_t *rev)
{
if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
if (!rev->active && !rev->ready) {
@@ -566,7 +566,8 @@ ngx_inline static int ngx_handle_level_read_event(ngx_event_t *rev)
}
-ngx_inline static int ngx_handle_write_event(ngx_event_t *wev, size_t lowat)
+static ngx_inline ngx_int_t ngx_handle_write_event(ngx_event_t *wev,
+ size_t lowat)
{
ngx_connection_t *c;
@@ -622,7 +623,7 @@ ngx_inline static int ngx_handle_write_event(ngx_event_t *wev, size_t lowat)
}
-ngx_inline static int ngx_handle_level_write_event(ngx_event_t *wev)
+static ngx_inline ngx_int_t ngx_handle_level_write_event(ngx_event_t *wev)
{
if (ngx_event_flags & NGX_USE_LEVEL_EVENT) {
if (!wev->active && !wev->ready) {
diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c
index 273941908..a2edc7129 100644
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -14,10 +14,10 @@ static ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p);
static ngx_int_t ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p);
static ngx_int_t ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p);
-ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf);
-ngx_inline static void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free,
+static ngx_inline void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf);
+static ngx_inline void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free,
ngx_buf_t *buf);
-ngx_inline static void ngx_event_pipe_add_free_buf(ngx_chain_t **chain,
+static ngx_inline void ngx_event_pipe_add_free_buf(ngx_chain_t **chain,
ngx_chain_t *cl);
static ngx_int_t ngx_event_pipe_drain_chains(ngx_event_pipe_t *p);
@@ -676,7 +676,7 @@ ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
}
-ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
+static ngx_inline void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
{
ngx_buf_t *b, *next;
@@ -706,7 +706,7 @@ ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
}
-ngx_inline static void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free,
+static ngx_inline void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free,
ngx_buf_t *buf)
{
ngx_buf_t *s;
@@ -735,7 +735,7 @@ ngx_inline static void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free,
}
-ngx_inline static void ngx_event_pipe_add_free_buf(ngx_chain_t **chain,
+static ngx_inline void ngx_event_pipe_add_free_buf(ngx_chain_t **chain,
ngx_chain_t *cl)
{
if (*chain == NULL) {
diff --git a/src/event/ngx_event_timer.h b/src/event/ngx_event_timer.h
index 9d6319a34..090d4046a 100644
--- a/src/event/ngx_event_timer.h
+++ b/src/event/ngx_event_timer.h
@@ -42,7 +42,7 @@ extern ngx_thread_volatile ngx_rbtree_t *ngx_event_timer_rbtree;
extern ngx_rbtree_t ngx_event_timer_sentinel;
-ngx_inline static void ngx_event_del_timer(ngx_event_t *ev)
+static ngx_inline void ngx_event_del_timer(ngx_event_t *ev)
{
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
"event timer del: %d: %d",
@@ -68,7 +68,7 @@ ngx_inline static void ngx_event_del_timer(ngx_event_t *ev)
}
-ngx_inline static void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
+static ngx_inline void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
{
ngx_int_t key;