open_file_cache_events

This commit is contained in:
Igor Sysoev 2007-09-03 08:41:42 +00:00
parent 1b982e1c00
commit 9afd58ffe5
9 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -23,6 +23,7 @@ typedef struct {
unsigned test_dir:1;
unsigned errors:1;
unsigned events:1;
unsigned is_dir:1;
unsigned is_file:1;

View File

@ -109,6 +109,7 @@ ngx_http_flv_handler(ngx_http_request_t *r)
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);

View File

@ -236,6 +236,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
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);

View File

@ -100,6 +100,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
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);

View File

@ -641,6 +641,7 @@ sendfile(r, filename, offset = -1, bytes = 0)
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);

View File

@ -471,6 +471,13 @@ static ngx_command_t ngx_http_core_commands[] = {
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 *cf)
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 *cf, void *parent, void *child)
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;
}

View File

@ -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;

View File

@ -977,6 +977,7 @@ ngx_http_script_file_code(ngx_http_script_engine_t *e)
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)