Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 6006:942283a53c28
The "aio" directive parser made smarter.
It now prints meaningful warnings on all platforms.
No functional changes.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 13 Mar 2015 16:42:52 +0300 |
parents | 2dac6ae6d703 |
children | 1fdba317ee6d |
comparison
equal
deleted
inserted
replaced
6005:d84f0abd4a53 | 6006:942283a53c28 |
---|---|
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_set_aio(ngx_conf_t *cf, ngx_command_t *cmd, | |
56 void *conf); | 58 void *conf); |
57 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, | 59 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, |
58 void *conf); | 60 void *conf); |
59 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, | 61 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, |
60 void *conf); | 62 void *conf); |
112 { ngx_string("clean"), NGX_HTTP_REQUEST_BODY_FILE_CLEAN }, | 114 { ngx_string("clean"), NGX_HTTP_REQUEST_BODY_FILE_CLEAN }, |
113 { ngx_null_string, 0 } | 115 { ngx_null_string, 0 } |
114 }; | 116 }; |
115 | 117 |
116 | 118 |
117 #if (NGX_HAVE_FILE_AIO) | |
118 | |
119 static ngx_conf_enum_t ngx_http_core_aio[] = { | |
120 { ngx_string("off"), NGX_HTTP_AIO_OFF }, | |
121 { ngx_string("on"), NGX_HTTP_AIO_ON }, | |
122 #if (NGX_HAVE_AIO_SENDFILE) | |
123 { ngx_string("sendfile"), NGX_HTTP_AIO_ON }, | |
124 #endif | |
125 { ngx_null_string, 0 } | |
126 }; | |
127 | |
128 #endif | |
129 | |
130 | |
131 static ngx_conf_enum_t ngx_http_core_satisfy[] = { | 119 static ngx_conf_enum_t ngx_http_core_satisfy[] = { |
132 { ngx_string("all"), NGX_HTTP_SATISFY_ALL }, | 120 { ngx_string("all"), NGX_HTTP_SATISFY_ALL }, |
133 { ngx_string("any"), NGX_HTTP_SATISFY_ANY }, | 121 { ngx_string("any"), NGX_HTTP_SATISFY_ANY }, |
134 { ngx_null_string, 0 } | 122 { ngx_null_string, 0 } |
135 }; | 123 }; |
421 ngx_conf_set_size_slot, | 409 ngx_conf_set_size_slot, |
422 NGX_HTTP_LOC_CONF_OFFSET, | 410 NGX_HTTP_LOC_CONF_OFFSET, |
423 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), | 411 offsetof(ngx_http_core_loc_conf_t, sendfile_max_chunk), |
424 NULL }, | 412 NULL }, |
425 | 413 |
426 #if (NGX_HAVE_FILE_AIO) | |
427 | |
428 { ngx_string("aio"), | 414 { ngx_string("aio"), |
429 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 415 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
430 ngx_conf_set_enum_slot, | 416 ngx_http_core_set_aio, |
431 NGX_HTTP_LOC_CONF_OFFSET, | 417 NGX_HTTP_LOC_CONF_OFFSET, |
432 offsetof(ngx_http_core_loc_conf_t, aio), | 418 0, |
433 &ngx_http_core_aio }, | 419 NULL }, |
434 | |
435 #endif | |
436 | 420 |
437 { ngx_string("read_ahead"), | 421 { ngx_string("read_ahead"), |
438 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 422 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
439 ngx_conf_set_size_slot, | 423 ngx_conf_set_size_slot, |
440 NGX_HTTP_LOC_CONF_OFFSET, | 424 NGX_HTTP_LOC_CONF_OFFSET, |
3637 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; | 3621 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3638 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | 3622 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; |
3639 clcf->internal = NGX_CONF_UNSET; | 3623 clcf->internal = NGX_CONF_UNSET; |
3640 clcf->sendfile = NGX_CONF_UNSET; | 3624 clcf->sendfile = NGX_CONF_UNSET; |
3641 clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; | 3625 clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; |
3642 #if (NGX_HAVE_FILE_AIO) | |
3643 clcf->aio = NGX_CONF_UNSET; | 3626 clcf->aio = NGX_CONF_UNSET; |
3644 #endif | |
3645 clcf->read_ahead = NGX_CONF_UNSET_SIZE; | 3627 clcf->read_ahead = NGX_CONF_UNSET_SIZE; |
3646 clcf->directio = NGX_CONF_UNSET; | 3628 clcf->directio = NGX_CONF_UNSET; |
3647 clcf->directio_alignment = NGX_CONF_UNSET; | 3629 clcf->directio_alignment = NGX_CONF_UNSET; |
3648 clcf->tcp_nopush = NGX_CONF_UNSET; | 3630 clcf->tcp_nopush = NGX_CONF_UNSET; |
3649 clcf->tcp_nodelay = NGX_CONF_UNSET; | 3631 clcf->tcp_nodelay = NGX_CONF_UNSET; |
3855 prev->client_body_in_single_buffer, 0); | 3837 prev->client_body_in_single_buffer, 0); |
3856 ngx_conf_merge_value(conf->internal, prev->internal, 0); | 3838 ngx_conf_merge_value(conf->internal, prev->internal, 0); |
3857 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); | 3839 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); |
3858 ngx_conf_merge_size_value(conf->sendfile_max_chunk, | 3840 ngx_conf_merge_size_value(conf->sendfile_max_chunk, |
3859 prev->sendfile_max_chunk, 0); | 3841 prev->sendfile_max_chunk, 0); |
3860 #if (NGX_HAVE_FILE_AIO) | |
3861 ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF); | 3842 ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF); |
3862 #endif | |
3863 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); | 3843 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); |
3864 ngx_conf_merge_off_value(conf->directio, prev->directio, | 3844 ngx_conf_merge_off_value(conf->directio, prev->directio, |
3865 NGX_OPEN_FILE_DIRECTIO_OFF); | 3845 NGX_OPEN_FILE_DIRECTIO_OFF); |
3866 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, | 3846 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, |
3867 512); | 3847 512); |
4652 return rv; | 4632 return rv; |
4653 } | 4633 } |
4654 | 4634 |
4655 | 4635 |
4656 static char * | 4636 static char * |
4637 ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4638 { | |
4639 ngx_http_core_loc_conf_t *clcf = conf; | |
4640 | |
4641 ngx_str_t *value; | |
4642 | |
4643 if (clcf->aio != NGX_CONF_UNSET) { | |
4644 return "is duplicate"; | |
4645 } | |
4646 | |
4647 value = cf->args->elts; | |
4648 | |
4649 if (ngx_strcmp(value[1].data, "off") == 0) { | |
4650 clcf->aio = NGX_HTTP_AIO_OFF; | |
4651 return NGX_CONF_OK; | |
4652 } | |
4653 | |
4654 if (ngx_strcmp(value[1].data, "on") == 0) { | |
4655 #if (NGX_HAVE_FILE_AIO) | |
4656 clcf->aio = NGX_HTTP_AIO_ON; | |
4657 return NGX_CONF_OK; | |
4658 #else | |
4659 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4660 "\"aio on\" " | |
4661 "is unsupported on this platform"); | |
4662 return NGX_CONF_ERROR; | |
4663 #endif | |
4664 } | |
4665 | |
4666 #if (NGX_HAVE_AIO_SENDFILE) | |
4667 | |
4668 if (ngx_strcmp(value[1].data, "sendfile") == 0) { | |
4669 clcf->aio = NGX_HTTP_AIO_ON; | |
4670 | |
4671 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
4672 "the \"sendfile\" parameter of " | |
4673 "the \"aio\" directive is deprecated"); | |
4674 return NGX_CONF_OK; | |
4675 } | |
4676 | |
4677 #endif | |
4678 | |
4679 return "invalid value"; | |
4680 } | |
4681 | |
4682 | |
4683 static char * | |
4657 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 4684 ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4658 { | 4685 { |
4659 ngx_http_core_loc_conf_t *clcf = conf; | 4686 ngx_http_core_loc_conf_t *clcf = conf; |
4660 | 4687 |
4661 ngx_str_t *value; | 4688 ngx_str_t *value; |