comparison src/core/nginx.c @ 635:e67b227c8dbb default tip

Merge with current.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 25 Apr 2011 04:07:55 +0400
parents 428c6e58046a
children
comparison
equal deleted inserted replaced
578:f3a9e57d2e17 635:e67b227c8dbb
108 offsetof(ngx_core_conf_t, rlimit_nofile), 108 offsetof(ngx_core_conf_t, rlimit_nofile),
109 NULL }, 109 NULL },
110 110
111 { ngx_string("worker_rlimit_core"), 111 { ngx_string("worker_rlimit_core"),
112 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, 112 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
113 ngx_conf_set_size_slot, 113 ngx_conf_set_off_slot,
114 0, 114 0,
115 offsetof(ngx_core_conf_t, rlimit_core), 115 offsetof(ngx_core_conf_t, rlimit_core),
116 NULL }, 116 NULL },
117 117
118 { ngx_string("worker_rlimit_sigpending"), 118 { ngx_string("worker_rlimit_sigpending"),
201 ngx_int_t i; 201 ngx_int_t i;
202 ngx_log_t *log; 202 ngx_log_t *log;
203 ngx_cycle_t *cycle, init_cycle; 203 ngx_cycle_t *cycle, init_cycle;
204 ngx_core_conf_t *ccf; 204 ngx_core_conf_t *ccf;
205 205
206 if (ngx_strerror_init() != NGX_OK) {
207 return 1;
208 }
209
206 if (ngx_get_options(argc, argv) != NGX_OK) { 210 if (ngx_get_options(argc, argv) != NGX_OK) {
207 return 1; 211 return 1;
208 } 212 }
209 213
210 if (ngx_show_version) { 214 if (ngx_show_version) {
211 ngx_log_stderr(0, "nginx version: " NGINX_VER); 215 ngx_log_stderr(0, "nginx version: " NGINX_VER);
212 216
213 if (ngx_show_help) { 217 if (ngx_show_help) {
214 ngx_log_stderr(0, 218 ngx_log_stderr(0,
215 "Usage: nginx [-?hvVt] [-s signal] [-c filename] " 219 "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
216 "[-p prefix] [-g directives]" CRLF CRLF 220 "[-p prefix] [-g directives]" CRLF CRLF
217 "Options:" CRLF 221 "Options:" CRLF
218 " -?,-h : this help" CRLF 222 " -?,-h : this help" CRLF
219 " -v : show version and exit" CRLF 223 " -v : show version and exit" CRLF
220 " -V : show version and configure options then exit" 224 " -V : show version and configure options then exit"
221 CRLF 225 CRLF
222 " -t : test configuration and exit" CRLF 226 " -t : test configuration and exit" CRLF
227 " -q : suppress non-error messages "
228 "during configuration testing" CRLF
223 " -s signal : send signal to a master process: " 229 " -s signal : send signal to a master process: "
224 "stop, quit, reopen, reload" CRLF 230 "stop, quit, reopen, reload" CRLF
225 #ifdef NGX_PREFIX 231 #ifdef NGX_PREFIX
226 " -p prefix : set prefix path (default: " 232 " -p prefix : set prefix path (default: "
227 NGX_PREFIX ")" CRLF 233 NGX_PREFIX ")" CRLF
330 336
331 return 1; 337 return 1;
332 } 338 }
333 339
334 if (ngx_test_config) { 340 if (ngx_test_config) {
335 ngx_log_stderr(0, "configuration file %s test is successful", 341 if (!ngx_quiet_mode) {
336 cycle->conf_file.data); 342 ngx_log_stderr(0, "configuration file %s test is successful",
343 cycle->conf_file.data);
344 }
345
337 return 0; 346 return 0;
338 } 347 }
339 348
340 if (ngx_signal) { 349 if (ngx_signal) {
341 return ngx_signal_process(cycle, ngx_signal); 350 return ngx_signal_process(cycle, ngx_signal);
683 692
684 case 't': 693 case 't':
685 ngx_test_config = 1; 694 ngx_test_config = 1;
686 break; 695 break;
687 696
697 case 'q':
698 ngx_quiet_mode = 1;
699 break;
700
688 case 'p': 701 case 'p':
689 if (*p) { 702 if (*p) {
690 ngx_prefix = p; 703 ngx_prefix = p;
691 goto next; 704 goto next;
692 } 705 }
857 cycle->prefix.data = p; 870 cycle->prefix.data = p;
858 871
859 #else 872 #else
860 873
861 #ifdef NGX_CONF_PREFIX 874 #ifdef NGX_CONF_PREFIX
862 cycle->conf_prefix.len = sizeof(NGX_CONF_PREFIX) - 1; 875 ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX);
863 cycle->conf_prefix.data = (u_char *) NGX_CONF_PREFIX;
864 #else 876 #else
865 cycle->conf_prefix.len = sizeof(NGX_PREFIX) - 1; 877 ngx_str_set(&cycle->conf_prefix, NGX_PREFIX);
866 cycle->conf_prefix.data = (u_char *) NGX_PREFIX; 878 #endif
867 #endif 879 ngx_str_set(&cycle->prefix, NGX_PREFIX);
868 cycle->prefix.len = sizeof(NGX_PREFIX) - 1;
869 cycle->prefix.data = (u_char *) NGX_PREFIX;
870 880
871 #endif 881 #endif
872 } 882 }
873 883
874 if (ngx_conf_file) { 884 if (ngx_conf_file) {
875 cycle->conf_file.len = ngx_strlen(ngx_conf_file); 885 cycle->conf_file.len = ngx_strlen(ngx_conf_file);
876 cycle->conf_file.data = ngx_conf_file; 886 cycle->conf_file.data = ngx_conf_file;
877 887
878 } else { 888 } else {
879 cycle->conf_file.len = sizeof(NGX_CONF_PATH) - 1; 889 ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
880 cycle->conf_file.data = (u_char *) NGX_CONF_PATH;
881 } 890 }
882 891
883 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) { 892 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
884 return NGX_ERROR; 893 return NGX_ERROR;
885 } 894 }
917 if (ccf == NULL) { 926 if (ccf == NULL) {
918 return NULL; 927 return NULL;
919 } 928 }
920 929
921 /* 930 /*
922 * set by pcalloc() 931 * set by ngx_pcalloc()
923 * 932 *
924 * ccf->pid = NULL; 933 * ccf->pid = NULL;
925 * ccf->oldpid = NULL; 934 * ccf->oldpid = NULL;
926 * ccf->priority = 0; 935 * ccf->priority = 0;
927 * ccf->cpu_affinity_n = 0; 936 * ccf->cpu_affinity_n = 0;
934 943
935 ccf->worker_processes = NGX_CONF_UNSET; 944 ccf->worker_processes = NGX_CONF_UNSET;
936 ccf->debug_points = NGX_CONF_UNSET; 945 ccf->debug_points = NGX_CONF_UNSET;
937 946
938 ccf->rlimit_nofile = NGX_CONF_UNSET; 947 ccf->rlimit_nofile = NGX_CONF_UNSET;
939 ccf->rlimit_core = NGX_CONF_UNSET_SIZE; 948 ccf->rlimit_core = NGX_CONF_UNSET;
940 ccf->rlimit_sigpending = NGX_CONF_UNSET; 949 ccf->rlimit_sigpending = NGX_CONF_UNSET;
941 950
942 ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT; 951 ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
943 ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT; 952 ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT;
944 953
991 1000
992 #endif 1001 #endif
993 1002
994 1003
995 if (ccf->pid.len == 0) { 1004 if (ccf->pid.len == 0) {
996 ccf->pid.len = sizeof(NGX_PID_PATH) - 1; 1005 ngx_str_set(&ccf->pid, NGX_PID_PATH);
997 ccf->pid.data = (u_char *) NGX_PID_PATH;
998 } 1006 }
999 1007
1000 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) { 1008 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
1001 return NGX_CONF_ERROR; 1009 return NGX_CONF_ERROR;
1002 } 1010 }
1040 ccf->group = grp->gr_gid; 1048 ccf->group = grp->gr_gid;
1041 } 1049 }
1042 1050
1043 1051
1044 if (ccf->lock_file.len == 0) { 1052 if (ccf->lock_file.len == 0) {
1045 ccf->lock_file.len = sizeof(NGX_LOCK_PATH) - 1; 1053 ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
1046 ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
1047 } 1054 }
1048 1055
1049 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) { 1056 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
1050 return NGX_CONF_ERROR; 1057 return NGX_CONF_ERROR;
1051 } 1058 }