Mercurial > hg > nginx
changeset 1457:223e92651ca5
open_file_cache_events
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 03 Sep 2007 08:41:42 +0000 |
parents | 698ea64f71e1 |
children | 614090b26fbf |
files | src/core/ngx_open_file_cache.c src/core/ngx_open_file_cache.h src/http/modules/ngx_http_flv_module.c src/http/modules/ngx_http_index_module.c src/http/modules/ngx_http_static_module.c src/http/modules/perl/nginx.xs src/http/ngx_http_core_module.c src/http/ngx_http_core_module.h src/http/ngx_http_script.c |
diffstat | 9 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -353,8 +353,10 @@ create: update: - if (ngx_event_flags & NGX_USE_VNODE_EVENT && of->fd != NGX_INVALID_FILE) { - + if ((ngx_event_flags & NGX_USE_VNODE_EVENT) + && of->events + && of->fd != NGX_INVALID_FILE) + { file->event = ngx_calloc(sizeof(ngx_event_t), pool->log); if (file->event== NULL) { goto failed;
--- a/src/core/ngx_open_file_cache.h +++ b/src/core/ngx_open_file_cache.h @@ -23,6 +23,7 @@ typedef struct { unsigned test_dir:1; unsigned errors:1; + unsigned events:1; unsigned is_dir:1; unsigned is_file:1;
--- a/src/http/modules/ngx_http_flv_module.c +++ b/src/http/modules/ngx_http_flv_module.c @@ -109,6 +109,7 @@ ngx_http_flv_handler(ngx_http_request_t of.test_dir = 0; of.retest = clcf->open_file_cache_retest; of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
--- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c @@ -236,6 +236,7 @@ ngx_http_index_handler(ngx_http_request_ of.test_dir = 0; of.retest = clcf->open_file_cache_retest; of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
--- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -100,6 +100,7 @@ ngx_http_static_handler(ngx_http_request of.test_dir = 0; of.retest = clcf->open_file_cache_retest; of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
--- a/src/http/modules/perl/nginx.xs +++ b/src/http/modules/perl/nginx.xs @@ -641,6 +641,7 @@ sendfile(r, filename, offset = -1, bytes of.test_dir = 0; of.retest = clcf->open_file_cache_retest; of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; path.len = ngx_strlen(filename);
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -471,6 +471,13 @@ static ngx_command_t ngx_http_core_comm offsetof(ngx_http_core_loc_conf_t, open_file_cache_errors), NULL }, + { ngx_string("open_file_cache_events"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, open_file_cache_events), + NULL }, + ngx_null_command }; @@ -2375,6 +2382,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t lcf->open_file_cache = NGX_CONF_UNSET_PTR; lcf->open_file_cache_retest = NGX_CONF_UNSET; lcf->open_file_cache_errors = NGX_CONF_UNSET; + lcf->open_file_cache_events = NGX_CONF_UNSET; return lcf; } @@ -2567,6 +2575,9 @@ ngx_http_core_merge_loc_conf(ngx_conf_t ngx_conf_merge_sec_value(conf->open_file_cache_errors, prev->open_file_cache_errors, 0); + ngx_conf_merge_sec_value(conf->open_file_cache_events, + prev->open_file_cache_events, 0); + return NGX_CONF_OK; }
--- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -293,6 +293,7 @@ struct ngx_http_core_loc_conf_s { ngx_open_file_cache_t *open_file_cache; time_t open_file_cache_retest; ngx_flag_t open_file_cache_errors; + ngx_flag_t open_file_cache_events; ngx_log_t *err_log;
--- a/src/http/ngx_http_script.c +++ b/src/http/ngx_http_script.c @@ -977,6 +977,7 @@ ngx_http_script_file_code(ngx_http_scrip of.test_dir = 0; of.retest = clcf->open_file_cache_retest; of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) == NGX_ERROR)