0
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
|
4 */
|
|
5
|
|
6
|
|
7 #ifndef _NGX_CYCLE_H_INCLUDED_
|
|
8 #define _NGX_CYCLE_H_INCLUDED_
|
|
9
|
|
10
|
|
11 #include <ngx_config.h>
|
|
12 #include <ngx_core.h>
|
|
13
|
|
14
|
56
|
15 #ifndef NGX_CYCLE_POOL_SIZE
|
|
16 #define NGX_CYCLE_POOL_SIZE 16384
|
|
17 #endif
|
|
18
|
|
19
|
10
|
20 #define NGX_DEBUG_POINTS_STOP 1
|
|
21 #define NGX_DEBUG_POINTS_ABORT 2
|
|
22
|
|
23
|
272
|
24 typedef struct ngx_shm_zone_s ngx_shm_zone_t;
|
|
25
|
|
26 typedef ngx_int_t (*ngx_shm_zone_init_pt) (ngx_shm_zone_t *zone, void *data);
|
|
27
|
|
28 struct ngx_shm_zone_s {
|
|
29 void *data;
|
258
|
30 ngx_shm_t shm;
|
272
|
31 ngx_shm_zone_init_pt init;
|
|
32 void *tag;
|
|
33 };
|
258
|
34
|
|
35
|
0
|
36 struct ngx_cycle_s {
|
22
|
37 void ****conf_ctx;
|
|
38 ngx_pool_t *pool;
|
0
|
39
|
22
|
40 ngx_log_t *log;
|
484
|
41 ngx_log_t new_log;
|
0
|
42
|
92
|
43 ngx_connection_t **files;
|
|
44 ngx_connection_t *free_connections;
|
|
45 ngx_uint_t free_connection_n;
|
|
46
|
22
|
47 ngx_array_t listening;
|
|
48 ngx_array_t pathes;
|
|
49 ngx_list_t open_files;
|
258
|
50 ngx_list_t shared_memory;
|
0
|
51
|
22
|
52 ngx_uint_t connection_n;
|
92
|
53 ngx_uint_t files_n;
|
|
54
|
110
|
55 ngx_connection_t *connections;
|
|
56 ngx_event_t *read_events;
|
|
57 ngx_event_t *write_events;
|
0
|
58
|
22
|
59 ngx_cycle_t *old_cycle;
|
0
|
60
|
22
|
61 ngx_str_t conf_file;
|
384
|
62 ngx_str_t conf_param;
|
482
|
63 ngx_str_t conf_prefix;
|
|
64 ngx_str_t prefix;
|
258
|
65 ngx_str_t lock_file;
|
376
|
66 ngx_str_t hostname;
|
0
|
67 };
|
|
68
|
|
69
|
|
70 typedef struct {
|
22
|
71 ngx_flag_t daemon;
|
|
72 ngx_flag_t master;
|
0
|
73
|
112
|
74 ngx_msec_t timer_resolution;
|
|
75
|
22
|
76 ngx_int_t worker_processes;
|
|
77 ngx_int_t debug_points;
|
0
|
78
|
92
|
79 ngx_int_t rlimit_nofile;
|
|
80 ngx_int_t rlimit_sigpending;
|
270
|
81 size_t rlimit_core;
|
92
|
82
|
22
|
83 int priority;
|
0
|
84
|
126
|
85 ngx_uint_t cpu_affinity_n;
|
|
86 u_long *cpu_affinity;
|
|
87
|
22
|
88 char *username;
|
|
89 ngx_uid_t user;
|
|
90 ngx_gid_t group;
|
|
91
|
70
|
92 ngx_str_t working_directory;
|
160
|
93 ngx_str_t lock_file;
|
70
|
94
|
22
|
95 ngx_str_t pid;
|
92
|
96 ngx_str_t oldpid;
|
0
|
97
|
278
|
98 ngx_array_t env;
|
|
99 char **environment;
|
|
100
|
0
|
101 #if (NGX_THREADS)
|
22
|
102 ngx_int_t worker_threads;
|
|
103 size_t thread_stack_size;
|
0
|
104 #endif
|
|
105
|
|
106 } ngx_core_conf_t;
|
|
107
|
|
108
|
|
109 typedef struct {
|
22
|
110 ngx_pool_t *pool; /* pcre's malloc() pool */
|
0
|
111 } ngx_core_tls_t;
|
|
112
|
|
113
|
160
|
114 #define ngx_is_init_cycle(cycle) (cycle->conf_ctx == NULL)
|
154
|
115
|
|
116
|
0
|
117 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle);
|
160
|
118 ngx_int_t ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log);
|
0
|
119 void ngx_delete_pidfile(ngx_cycle_t *cycle);
|
482
|
120 ngx_int_t ngx_signal_process(ngx_cycle_t *cycle, char *sig);
|
0
|
121 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user);
|
278
|
122 char **ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last);
|
0
|
123 ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv);
|
126
|
124 u_long ngx_get_cpu_affinity(ngx_uint_t n);
|
272
|
125 ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name,
|
|
126 size_t size, void *tag);
|
0
|
127
|
|
128
|
|
129 extern volatile ngx_cycle_t *ngx_cycle;
|
|
130 extern ngx_array_t ngx_old_cycles;
|
|
131 extern ngx_module_t ngx_core_module;
|
|
132 extern ngx_uint_t ngx_test_config;
|
|
133 #if (NGX_THREADS)
|
|
134 extern ngx_tls_key_t ngx_core_tls_key;
|
|
135 #endif
|
|
136
|
|
137
|
|
138 #endif /* _NGX_CYCLE_H_INCLUDED_ */
|