comparison src/http/ngx_http_core_module.c @ 2129:25add486e7aa

directio
author Igor Sysoev <igor@sysoev.ru>
date Wed, 30 Jul 2008 12:34:04 +0000
parents 5e954395a15e
children 7a7c9e9024dd
comparison
equal deleted inserted replaced
2128:345a014436d4 2129:25add486e7aa
51 void *conf); 51 void *conf);
52 static char *ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd, 52 static char *ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd,
53 void *conf); 53 void *conf);
54 static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 54 static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
55 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, 55 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd,
56 void *conf);
57 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd,
56 void *conf); 58 void *conf);
57 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, 59 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd,
58 void *conf); 60 void *conf);
59 static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, 61 static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd,
60 void *conf); 62 void *conf);
351 ngx_conf_set_size_slot, 353 ngx_conf_set_size_slot,
352 NGX_HTTP_LOC_CONF_OFFSET, 354 NGX_HTTP_LOC_CONF_OFFSET,
353 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), 355 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk),
354 NULL }, 356 NULL },
355 357
358 { ngx_string("directio"),
359 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
360 ngx_http_core_directio,
361 NGX_HTTP_LOC_CONF_OFFSET,
362 0,
363 NULL },
364
356 { ngx_string("tcp_nopush"), 365 { ngx_string("tcp_nopush"),
357 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 366 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
358 ngx_conf_set_flag_slot, 367 ngx_conf_set_flag_slot,
359 NGX_HTTP_LOC_CONF_OFFSET, 368 NGX_HTTP_LOC_CONF_OFFSET,
360 offsetof(ngx_http_core_loc_conf_t, tcp_nopush), 369 offsetof(ngx_http_core_loc_conf_t, tcp_nopush),
2584 lcf->satisfy = NGX_CONF_UNSET_UINT; 2593 lcf->satisfy = NGX_CONF_UNSET_UINT;
2585 lcf->internal = NGX_CONF_UNSET; 2594 lcf->internal = NGX_CONF_UNSET;
2586 lcf->client_body_in_file_only = NGX_CONF_UNSET; 2595 lcf->client_body_in_file_only = NGX_CONF_UNSET;
2587 lcf->sendfile = NGX_CONF_UNSET; 2596 lcf->sendfile = NGX_CONF_UNSET;
2588 lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; 2597 lcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
2598 lcf->directio = NGX_CONF_UNSET;
2589 lcf->tcp_nopush = NGX_CONF_UNSET; 2599 lcf->tcp_nopush = NGX_CONF_UNSET;
2590 lcf->tcp_nodelay = NGX_CONF_UNSET; 2600 lcf->tcp_nodelay = NGX_CONF_UNSET;
2591 lcf->send_timeout = NGX_CONF_UNSET_MSEC; 2601 lcf->send_timeout = NGX_CONF_UNSET_MSEC;
2592 lcf->send_lowat = NGX_CONF_UNSET_SIZE; 2602 lcf->send_lowat = NGX_CONF_UNSET_SIZE;
2593 lcf->postpone_output = NGX_CONF_UNSET_SIZE; 2603 lcf->postpone_output = NGX_CONF_UNSET_SIZE;
2772 ngx_conf_merge_value(conf->client_body_in_file_only, 2782 ngx_conf_merge_value(conf->client_body_in_file_only,
2773 prev->client_body_in_file_only, 0); 2783 prev->client_body_in_file_only, 0);
2774 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); 2784 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
2775 ngx_conf_merge_size_value(conf->sendfile_max_chunk, 2785 ngx_conf_merge_size_value(conf->sendfile_max_chunk,
2776 prev->sendfile_max_chunk, 0); 2786 prev->sendfile_max_chunk, 0);
2787 ngx_conf_merge_off_value(conf->directio, prev->directio,
2788 NGX_MAX_OFF_T_VALUE);
2777 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); 2789 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0);
2778 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); 2790 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1);
2779 2791
2780 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000); 2792 ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000);
2781 ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0); 2793 ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0);
3338 return rv; 3350 return rv;
3339 } 3351 }
3340 3352
3341 3353
3342 static char * 3354 static char *
3355 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
3356 {
3357 ngx_http_core_loc_conf_t *clcf = conf;
3358
3359 ngx_str_t *value;
3360
3361 if (clcf->directio != NGX_CONF_UNSET) {
3362 return "is duplicate";
3363 }
3364
3365 value = cf->args->elts;
3366
3367 if (ngx_strcmp(value[1].data, "off") == 0) {
3368 clcf->directio = NGX_MAX_OFF_T_VALUE;
3369 return NGX_CONF_OK;
3370 }
3371
3372 clcf->directio = ngx_parse_offset(&value[1]);
3373 if (clcf->directio == (off_t) NGX_ERROR) {
3374 return "invalid value";
3375 }
3376
3377 return NGX_CONF_OK;
3378 }
3379
3380
3381 static char *
3343 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 3382 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
3344 { 3383 {
3345 ngx_http_core_loc_conf_t *lcf = conf; 3384 ngx_http_core_loc_conf_t *lcf = conf;
3346 3385
3347 u_char *args; 3386 u_char *args;