Mercurial > hg > nginx-quic
comparison src/core/nginx.c @ 278:0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 04 Mar 2004 07:04:55 +0000 |
parents | 7bb9562216ce |
children | b79f021a644a |
comparison
equal
deleted
inserted
replaced
277:e91499541410 | 278:0ba4821f4460 |
---|---|
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 #include <ngx_event.h> | 4 #include <ngx_event.h> |
5 #include <nginx.h> | 5 #include <nginx.h> |
6 | 6 |
7 | |
8 #if 0 | |
7 | 9 |
8 typedef struct { | 10 typedef struct { |
9 ngx_flag_t daemon; | 11 ngx_flag_t daemon; |
10 ngx_flag_t master; | 12 ngx_flag_t master; |
11 ngx_flag_t worker_reopen; | 13 ngx_flag_t worker_reopen; |
28 static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx); | 30 static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx); |
29 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); | 31 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); |
30 #if (NGX_THREADS) | 32 #if (NGX_THREADS) |
31 static int ngx_worker_thread_cycle(void *data); | 33 static int ngx_worker_thread_cycle(void *data); |
32 #endif | 34 #endif |
35 | |
36 #endif | |
37 | |
33 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle, char **envp); | 38 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle, char **envp); |
34 static ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv); | |
35 static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle); | 39 static ngx_int_t ngx_getopt(ngx_master_ctx_t *ctx, ngx_cycle_t *cycle); |
36 static ngx_int_t ngx_core_module_init(ngx_cycle_t *cycle); | 40 static ngx_int_t ngx_core_module_init(ngx_cycle_t *cycle); |
37 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | 41 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
38 | 42 |
39 | 43 |
108 ngx_int_t ngx_change_binary; | 112 ngx_int_t ngx_change_binary; |
109 | 113 |
110 | 114 |
111 int main(int argc, char *const *argv, char **envp) | 115 int main(int argc, char *const *argv, char **envp) |
112 { | 116 { |
113 ngx_fd_t fd; | |
114 ngx_int_t i; | 117 ngx_int_t i; |
115 ngx_log_t *log; | 118 ngx_log_t *log; |
116 ngx_cycle_t *cycle, init_cycle; | 119 ngx_cycle_t *cycle, init_cycle; |
117 ngx_open_file_t *file; | |
118 ngx_core_conf_t *ccf; | 120 ngx_core_conf_t *ccf; |
119 ngx_master_ctx_t ctx; | 121 ngx_master_ctx_t ctx; |
120 #if !(WIN32) | 122 #if !(WIN32) |
121 size_t len; | 123 size_t len; |
122 char pid[/* STUB */ 10]; | 124 char pid[/* STUB */ 10]; |
251 ngx_master_process_cycle(cycle, &ctx); | 253 ngx_master_process_cycle(cycle, &ctx); |
252 | 254 |
253 return 0; | 255 return 0; |
254 } | 256 } |
255 | 257 |
258 | |
259 #if 0 | |
256 | 260 |
257 /* TODO: broken NGX_PROCESS_SINGLE */ | 261 /* TODO: broken NGX_PROCESS_SINGLE */ |
258 | 262 |
259 static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) | 263 static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) |
260 { | 264 { |
742 return 1; | 746 return 1; |
743 } | 747 } |
744 | 748 |
745 #endif | 749 #endif |
746 | 750 |
751 #endif | |
752 | |
747 | 753 |
748 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle, char **envp) | 754 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle, char **envp) |
749 { | 755 { |
750 char *p, *v; | 756 char *p, *v; |
751 ngx_socket_t s; | 757 ngx_socket_t s; |
789 | 795 |
790 return NGX_OK; | 796 return NGX_OK; |
791 } | 797 } |
792 | 798 |
793 | 799 |
794 static ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) | 800 ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) |
795 { | 801 { |
796 char *env[2], *var, *p; | 802 char *env[2], *var, *p; |
797 ngx_int_t i; | 803 ngx_int_t i; |
798 ngx_pid_t pid; | 804 ngx_pid_t pid; |
799 ngx_exec_ctx_t ctx; | 805 ngx_exec_ctx_t ctx; |
883 * ccf->newpid = NULL; | 889 * ccf->newpid = NULL; |
884 */ | 890 */ |
885 ccf->daemon = NGX_CONF_UNSET; | 891 ccf->daemon = NGX_CONF_UNSET; |
886 ccf->master = NGX_CONF_UNSET; | 892 ccf->master = NGX_CONF_UNSET; |
887 ccf->worker_reopen = NGX_CONF_UNSET; | 893 ccf->worker_reopen = NGX_CONF_UNSET; |
888 ccf->user = (uid_t) NGX_CONF_UNSET; | 894 ccf->user = (ngx_uid_t) NGX_CONF_UNSET; |
889 ccf->group = (gid_t) NGX_CONF_UNSET; | 895 ccf->group = (ngx_gid_t) NGX_CONF_UNSET; |
890 | 896 |
891 ((void **)(cycle->conf_ctx))[ngx_core_module.index] = ccf; | 897 ((void **)(cycle->conf_ctx))[ngx_core_module.index] = ccf; |
892 | 898 |
893 return NGX_OK; | 899 return NGX_OK; |
894 } | 900 } |
895 | 901 |
896 | 902 |
897 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 903 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
898 { | 904 { |
905 #if (WIN32) | |
906 | |
907 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
908 "\"user\" is not supported, ignored"); | |
909 | |
910 return NGX_CONF_OK; | |
911 | |
912 #else | |
913 | |
899 struct passwd *pwd; | 914 struct passwd *pwd; |
900 struct group *grp; | 915 struct group *grp; |
901 ngx_str_t *value; | 916 ngx_str_t *value; |
902 ngx_core_conf_t *ccf; | 917 ngx_core_conf_t *ccf; |
903 | 918 |
930 } | 945 } |
931 | 946 |
932 ccf->group = grp->gr_gid; | 947 ccf->group = grp->gr_gid; |
933 | 948 |
934 return NGX_CONF_OK; | 949 return NGX_CONF_OK; |
950 | |
951 #endif | |
935 } | 952 } |