ngx process options函式詳解

2021-06-19 11:07:51 字數 1357 閱讀 8044

ngx_process_options是初始化init_cycle中的一些如: conf_file,prefix,conf_prefix等字段的功能, 其方法的定義在src/core/nginx.c中, 以下為詳細**:

主要功能是將ngx_prefix, 配置檔案的位置資訊, 以及命令列引數的資訊初始化到cycle物件中。

static ngx_int_t

ngx_process_options(ngx_cycle_t *cycle)

ngx_memcpy(p, ngx_prefix, len);

p[len++] = '/'; // 最後還是新增上路徑分割符'/'

}cycle->conf_prefix.len = len;

cycle->conf_prefix.data = p;

cycle->prefix.len = len;

cycle->prefix.data = p;

} else

if (ngx_getcwd(p, ngx_max_path) == 0)

len = ngx_strlen(p);

p[len++] = '/';

cycle->conf_prefix.len = len;

cycle->conf_prefix.data = p;

cycle->prefix.len = len;

cycle->prefix.data = p;

#else

#ifdef ngx_conf_prefix

ngx_str_set(&cycle->conf_prefix, ngx_conf_prefix);

#else

ngx_str_set(&cycle->conf_prefix, ngx_prefix);

#endif

ngx_str_set(&cycle->prefix, ngx_prefix);

#endif

}// 配置檔案資訊初始化到cycle物件

if (ngx_conf_file) else

if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != ngx_ok)

for (p = cycle->conf_file.data + cycle->conf_file.len - 1;

p > cycle->conf_file.data;

p--)

}// 命令列引數初始化到cycle物件

if (ngx_conf_params)

if (ngx_test_config)

return ngx_ok;

}

linux clock gettime函式詳解

注意 1.精確級別,納秒級別 原型long sys clock gettime clockid t which clock,struct timespec tp which clock引數解釋 clock realtime 系統實時時間,隨系統實時時間改變而改變,即從utc1970 1 1 0 0 ...

遞迴函式(詳例)

從函式棧的角度的運用 簡單的列印運用 includevoid function int n int main void function int n return 非空鍊錶的遞迴找最大值 lim findmax lim headptr 為了更好的理解遞迴的執行過程 在呼叫自生到最後時,if head...

Filter函式詳析

select filter product category members,measures dollar sales 900000 and measures unit sales 90000 on axis 0 from sales where time 2005 measures dollar...