Changeset 6006:942283a53c28 in nginx


Ignore:
Timestamp:
03/13/15 13:42:52 (5 years ago)
Author:
Ruslan Ermilov <ru@…>
Branch:
default
Phase:
public
Message:

The "aio" directive parser made smarter.

It now prints meaningful warnings on all platforms.

No functional changes.

Location:
src/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/http/ngx_http_core_module.c

    r6004 r6006  
    5454static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
    5555static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd,
     56    void *conf);
     57static char *ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd,
    5658    void *conf);
    5759static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd,
     
    115117
    116118
    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 
    131119static ngx_conf_enum_t  ngx_http_core_satisfy[] = {
    132120    { ngx_string("all"), NGX_HTTP_SATISFY_ALL },
     
    424412      NULL },
    425413
    426 #if (NGX_HAVE_FILE_AIO)
    427 
    428414    { ngx_string("aio"),
    429415      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
    430       ngx_conf_set_enum_slot,
    431       NGX_HTTP_LOC_CONF_OFFSET,
    432       offsetof(ngx_http_core_loc_conf_t, aio),
    433       &ngx_http_core_aio },
    434 
    435 #endif
     416      ngx_http_core_set_aio,
     417      NGX_HTTP_LOC_CONF_OFFSET,
     418      0,
     419      NULL },
    436420
    437421    { ngx_string("read_ahead"),
     
    36403624    clcf->sendfile = NGX_CONF_UNSET;
    36413625    clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
    3642 #if (NGX_HAVE_FILE_AIO)
    36433626    clcf->aio = NGX_CONF_UNSET;
    3644 #endif
    36453627    clcf->read_ahead = NGX_CONF_UNSET_SIZE;
    36463628    clcf->directio = NGX_CONF_UNSET;
     
    38583840    ngx_conf_merge_size_value(conf->sendfile_max_chunk,
    38593841                              prev->sendfile_max_chunk, 0);
    3860 #if (NGX_HAVE_FILE_AIO)
    38613842    ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF);
    3862 #endif
    38633843    ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0);
    38643844    ngx_conf_merge_off_value(conf->directio, prev->directio,
     
    46554635
    46564636static char *
     4637ngx_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
     4683static char *
    46574684ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
    46584685{
  • src/http/ngx_http_core_module.h

    r6004 r6006  
    396396    ngx_flag_t    internal;                /* internal */
    397397    ngx_flag_t    sendfile;                /* sendfile */
    398 #if (NGX_HAVE_FILE_AIO)
    399398    ngx_flag_t    aio;                     /* aio */
    400 #endif
    401399    ngx_flag_t    tcp_nopush;              /* tcp_nopush */
    402400    ngx_flag_t    tcp_nodelay;             /* tcp_nodelay */
Note: See TracChangeset for help on using the changeset viewer.