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
15 #ifndef NGX_CYCLE_POOL_SIZE
16 #define NGX_CYCLE_POOL_SIZE 16384
17 #endif
18
19
20 #define NGX_DEBUG_POINTS_STOP 1
21 #define NGX_DEBUG_POINTS_ABORT 2
22
23
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;
30 ngx_shm_t shm;
31 ngx_shm_zone_init_pt init;
32 ngx_str_t name;
33 void *tag;
34 };
35
36
37 struct ngx_cycle_s {
38 void ****conf_ctx;
39 ngx_pool_t *pool;
40
41 ngx_log_t *log;
42 ngx_log_t *new_log;
43
44 ngx_connection_t **files;
45 ngx_connection_t *free_connections;
46 ngx_uint_t free_connection_n;
47
48 ngx_array_t listening;
49 ngx_array_t pathes;
50 ngx_list_t open_files;
51 ngx_list_t shared_memory;
52
53 ngx_uint_t connection_n;
54 ngx_uint_t files_n;
55
56 ngx_connection_t *connections;
57 ngx_event_t *read_events;
58 ngx_event_t *write_events;
59
60 ngx_cycle_t *old_cycle;
61
62 ngx_str_t conf_file;
63 ngx_str_t root;
64 ngx_str_t lock_file;
65 };
66
67
68 typedef struct {
69 ngx_flag_t daemon;
70 ngx_flag_t master;
71
72 ngx_msec_t timer_resolution;
73
74 ngx_int_t worker_processes;
75 ngx_int_t debug_points;
76
77 ngx_int_t rlimit_nofile;
78 ngx_int_t rlimit_sigpending;
79 size_t rlimit_core;
80
81 int priority;
82
83 ngx_uint_t cpu_affinity_n;
84 u_long *cpu_affinity;
85
86 char *username;
87 ngx_uid_t user;
88 ngx_gid_t group;
89
90 ngx_str_t working_directory;
91 ngx_str_t lock_file;
92
93 ngx_str_t pid;
94 ngx_str_t oldpid;
95
96 ngx_array_t env;
97 char **environment;
98
99 #if (NGX_THREADS)
100 ngx_int_t worker_threads;
101 size_t thread_stack_size;
102 #endif
103
104 } ngx_core_conf_t;
105
106
107 typedef struct {
108 ngx_pool_t *pool; /* pcre's malloc() pool */
109 } ngx_core_tls_t;
110
111
112 #define ngx_is_init_cycle(cycle) (cycle->conf_ctx == NULL)
113
114
115 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle);
116 ngx_int_t ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log);
117 void ngx_delete_pidfile(ngx_cycle_t *cycle);
118 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user);
119 char **ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last);
120 ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv);
121 u_long ngx_get_cpu_affinity(ngx_uint_t n);
122 ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name,
123 size_t size, void *tag);
124
125
126 extern volatile ngx_cycle_t *ngx_cycle;
127 extern ngx_array_t ngx_old_cycles;
128 extern ngx_module_t ngx_core_module;
129 extern ngx_uint_t ngx_test_config;
130 #if (NGX_THREADS)
131 extern ngx_tls_key_t ngx_core_tls_key;
132 #endif
133
134
135 #endif /* _NGX_CYCLE_H_INCLUDED_ */
136
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.