comparison src/os/unix/ngx_process.c @ 92:45945fa8b8ba NGINX_0_2_0

nginx 0.2.0 *) The pid-file names used during online upgrade was changed and now is not required a manual rename operation. The old master process adds the ".oldbin" suffix to its pid-file and executes a new binary file. The new master process creates usual pid-file without the ".newbin" suffix. If the master process exits, then old master process renames back its pid-file with the ".oldbin" suffix to the pid-file without suffix. *) Change: the "worker_connections" directive, new name of the "connections" directive; now the directive specifies maximum number of connections, but not maximum socket descriptor number. *) Feature: SSL supports the session cache inside one worker process. *) Feature: the "satisfy_any" directive. *) Change: the ngx_http_access_module and ngx_http_auth_basic_module do not run for subrequests. *) Feature: the "worker_rlimit_nofile" and "worker_rlimit_sigpending" directives. *) Bugfix: if all backend using in load-balancing failed after one error, then nginx did not try do connect to them during 60 seconds. *) Bugfix: in IMAP/POP3 command argument parsing. Thanks to Rob Mueller. *) Bugfix: errors while using SSL in IMAP/POP3 proxy. *) Bugfix: errors while using SSI and gzipping. *) Bugfix: the "Expires" and "Cache-Control" header lines were omitted from the 304 responses. Thanks to Alexandr Kukushkin.
author Igor Sysoev <http://sysoev.ru>
date Fri, 23 Sep 2005 00:00:00 +0400
parents e916a291e9aa
children 45f7329b4bd0
comparison
equal deleted inserted replaced
91:c3eee83ea942 92:45945fa8b8ba
92 92
93 if (s == NGX_MAX_PROCESSES) { 93 if (s == NGX_MAX_PROCESSES) {
94 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, 94 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
95 "no more than %d processes can be spawned", 95 "no more than %d processes can be spawned",
96 NGX_MAX_PROCESSES); 96 NGX_MAX_PROCESSES);
97 return NGX_ERROR; 97 return NGX_INVALID_PID;
98 } 98 }
99 } 99 }
100 100
101 101
102 if (respawn != NGX_PROCESS_DETACHED) { 102 if (respawn != NGX_PROCESS_DETACHED) {
105 105
106 if (socketpair(AF_UNIX, SOCK_STREAM, 0, ngx_processes[s].channel) == -1) 106 if (socketpair(AF_UNIX, SOCK_STREAM, 0, ngx_processes[s].channel) == -1)
107 { 107 {
108 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 108 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
109 "socketpair() failed while spawning \"%s\"", name); 109 "socketpair() failed while spawning \"%s\"", name);
110 return NGX_ERROR; 110 return NGX_INVALID_PID;
111 } 111 }
112 112
113 ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0, 113 ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
114 "channel %d:%d", 114 "channel %d:%d",
115 ngx_processes[s].channel[0], 115 ngx_processes[s].channel[0],
118 if (ngx_nonblocking(ngx_processes[s].channel[0]) == -1) { 118 if (ngx_nonblocking(ngx_processes[s].channel[0]) == -1) {
119 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 119 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
120 ngx_nonblocking_n " failed while spawning \"%s\"", 120 ngx_nonblocking_n " failed while spawning \"%s\"",
121 name); 121 name);
122 ngx_close_channel(ngx_processes[s].channel, cycle->log); 122 ngx_close_channel(ngx_processes[s].channel, cycle->log);
123 return NGX_ERROR; 123 return NGX_INVALID_PID;
124 } 124 }
125 125
126 if (ngx_nonblocking(ngx_processes[s].channel[1]) == -1) { 126 if (ngx_nonblocking(ngx_processes[s].channel[1]) == -1) {
127 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 127 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
128 ngx_nonblocking_n " failed while spawning \"%s\"", 128 ngx_nonblocking_n " failed while spawning \"%s\"",
129 name); 129 name);
130 ngx_close_channel(ngx_processes[s].channel, cycle->log); 130 ngx_close_channel(ngx_processes[s].channel, cycle->log);
131 return NGX_ERROR; 131 return NGX_INVALID_PID;
132 } 132 }
133 133
134 on = 1; 134 on = 1;
135 if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) { 135 if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {
136 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 136 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
137 "ioctl(FIOASYNC) failed while spawning \"%s\"", name); 137 "ioctl(FIOASYNC) failed while spawning \"%s\"", name);
138 ngx_close_channel(ngx_processes[s].channel, cycle->log); 138 ngx_close_channel(ngx_processes[s].channel, cycle->log);
139 return NGX_ERROR; 139 return NGX_INVALID_PID;
140 } 140 }
141 141
142 if (fcntl(ngx_processes[s].channel[0], F_SETOWN, ngx_pid) == -1) { 142 if (fcntl(ngx_processes[s].channel[0], F_SETOWN, ngx_pid) == -1) {
143 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 143 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
144 "fcntl(F_SETOWN) failed while spawning \"%s\"", name); 144 "fcntl(F_SETOWN) failed while spawning \"%s\"", name);
145 ngx_close_channel(ngx_processes[s].channel, cycle->log); 145 ngx_close_channel(ngx_processes[s].channel, cycle->log);
146 return NGX_ERROR; 146 return NGX_INVALID_PID;
147 } 147 }
148 148
149 if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) { 149 if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) {
150 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 150 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
151 "fcntl(FD_CLOEXEC) failed while spawning \"%s\"", 151 "fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
152 name); 152 name);
153 ngx_close_channel(ngx_processes[s].channel, cycle->log); 153 ngx_close_channel(ngx_processes[s].channel, cycle->log);
154 return NGX_ERROR; 154 return NGX_INVALID_PID;
155 } 155 }
156 156
157 if (fcntl(ngx_processes[s].channel[1], F_SETFD, FD_CLOEXEC) == -1) { 157 if (fcntl(ngx_processes[s].channel[1], F_SETFD, FD_CLOEXEC) == -1) {
158 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 158 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
159 "fcntl(FD_CLOEXEC) failed while spawning \"%s\"", 159 "fcntl(FD_CLOEXEC) failed while spawning \"%s\"",
160 name); 160 name);
161 ngx_close_channel(ngx_processes[s].channel, cycle->log); 161 ngx_close_channel(ngx_processes[s].channel, cycle->log);
162 return NGX_ERROR; 162 return NGX_INVALID_PID;
163 } 163 }
164 164
165 ngx_channel = ngx_processes[s].channel[1]; 165 ngx_channel = ngx_processes[s].channel[1];
166 166
167 } else { 167 } else {
178 178
179 case -1: 179 case -1:
180 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 180 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
181 "fork() failed while spawning \"%s\"", name); 181 "fork() failed while spawning \"%s\"", name);
182 ngx_close_channel(ngx_processes[s].channel, cycle->log); 182 ngx_close_channel(ngx_processes[s].channel, cycle->log);
183 return NGX_ERROR; 183 return NGX_INVALID_PID;
184 184
185 case 0: 185 case 0:
186 ngx_pid = ngx_getpid(); 186 ngx_pid = ngx_getpid();
187 proc(cycle, data); 187 proc(cycle, data);
188 break; 188 break;