Update and clean Tomato RAF files
[tomato.git] / release / src / router / nginx / src / core / ngx_cycle.h
blob2e4bc4ba2785762c84346f4ea09e45eb3de3eaf8
2 /*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Nginx, Inc.
5 */
8 #ifndef _NGX_CYCLE_H_INCLUDED_
9 #define _NGX_CYCLE_H_INCLUDED_
12 #include <ngx_config.h>
13 #include <ngx_core.h>
16 #ifndef NGX_CYCLE_POOL_SIZE
17 #define NGX_CYCLE_POOL_SIZE NGX_DEFAULT_POOL_SIZE
18 #endif
21 #define NGX_DEBUG_POINTS_STOP 1
22 #define NGX_DEBUG_POINTS_ABORT 2
25 typedef struct ngx_shm_zone_s ngx_shm_zone_t;
27 typedef ngx_int_t (*ngx_shm_zone_init_pt) (ngx_shm_zone_t *zone, void *data);
29 struct ngx_shm_zone_s {
30 void *data;
31 ngx_shm_t shm;
32 ngx_shm_zone_init_pt init;
33 void *tag;
37 struct ngx_cycle_s {
38 void ****conf_ctx;
39 ngx_pool_t *pool;
41 ngx_log_t *log;
42 ngx_log_t new_log;
44 ngx_connection_t **files;
45 ngx_connection_t *free_connections;
46 ngx_uint_t free_connection_n;
48 ngx_queue_t reusable_connections_queue;
50 ngx_array_t listening;
51 ngx_array_t paths;
52 ngx_list_t open_files;
53 ngx_list_t shared_memory;
55 ngx_uint_t connection_n;
56 ngx_uint_t files_n;
58 ngx_connection_t *connections;
59 ngx_event_t *read_events;
60 ngx_event_t *write_events;
62 ngx_cycle_t *old_cycle;
64 ngx_str_t conf_file;
65 ngx_str_t conf_param;
66 ngx_str_t conf_prefix;
67 ngx_str_t prefix;
68 ngx_str_t lock_file;
69 ngx_str_t hostname;
73 typedef struct {
74 ngx_flag_t daemon;
75 ngx_flag_t master;
77 ngx_msec_t timer_resolution;
79 ngx_int_t worker_processes;
80 ngx_int_t debug_points;
82 ngx_int_t rlimit_nofile;
83 ngx_int_t rlimit_sigpending;
84 off_t rlimit_core;
86 int priority;
88 ngx_uint_t cpu_affinity_n;
89 uint64_t *cpu_affinity;
91 char *username;
92 ngx_uid_t user;
93 ngx_gid_t group;
95 ngx_str_t working_directory;
96 ngx_str_t lock_file;
98 ngx_str_t pid;
99 ngx_str_t oldpid;
101 ngx_array_t env;
102 char **environment;
104 #if (NGX_THREADS)
105 ngx_int_t worker_threads;
106 size_t thread_stack_size;
107 #endif
109 } ngx_core_conf_t;
112 typedef struct {
113 ngx_pool_t *pool; /* pcre's malloc() pool */
114 } ngx_core_tls_t;
117 #define ngx_is_init_cycle(cycle) (cycle->conf_ctx == NULL)
120 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle);
121 ngx_int_t ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log);
122 void ngx_delete_pidfile(ngx_cycle_t *cycle);
123 ngx_int_t ngx_signal_process(ngx_cycle_t *cycle, char *sig);
124 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user);
125 char **ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last);
126 ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv);
127 uint64_t ngx_get_cpu_affinity(ngx_uint_t n);
128 ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name,
129 size_t size, void *tag);
132 extern volatile ngx_cycle_t *ngx_cycle;
133 extern ngx_array_t ngx_old_cycles;
134 extern ngx_module_t ngx_core_module;
135 extern ngx_uint_t ngx_test_config;
136 extern ngx_uint_t ngx_quiet_mode;
137 #if (NGX_THREADS)
138 extern ngx_tls_key_t ngx_core_tls_key;
139 #endif
142 #endif /* _NGX_CYCLE_H_INCLUDED_ */