Mercurial > hg > nginx-mail
annotate src/os/unix/ngx_daemon.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 | 6cfc63e68377 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
48 | 11 ngx_int_t ngx_daemon(ngx_log_t *log) |
0 | 12 { |
13 int fd; | |
14 | |
15 switch (fork()) { | |
16 case -1: | |
17 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "fork() failed"); | |
18 return NGX_ERROR; | |
19 | |
20 case 0: | |
21 break; | |
22 | |
23 default: | |
24 exit(0); | |
25 } | |
26 | |
27 ngx_pid = ngx_getpid(); | |
28 | |
29 if (setsid() == -1) { | |
30 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "setsid() failed"); | |
31 return NGX_ERROR; | |
32 } | |
33 | |
34 umask(0); | |
35 | |
36 fd = open("/dev/null", O_RDWR); | |
37 if (fd == -1) { | |
38 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | |
39 "open(\"/dev/null\") failed"); | |
40 return NGX_ERROR; | |
41 } | |
42 | |
43 if (dup2(fd, STDIN_FILENO) == -1) { | |
44 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDIN) failed"); | |
45 return NGX_ERROR; | |
46 } | |
47 | |
48 if (dup2(fd, STDOUT_FILENO) == -1) { | |
49 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDOUT) failed"); | |
50 return NGX_ERROR; | |
51 } | |
52 | |
53 #if 0 | |
54 if (dup2(fd, STDERR_FILENO) == -1) { | |
55 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDERR) failed"); | |
56 return NGX_ERROR; | |
57 } | |
58 #endif | |
59 | |
60 if (fd > STDERR_FILENO) { | |
61 if (close(fd) == -1) { | |
62 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close() failed"); | |
63 return NGX_ERROR; | |
64 } | |
65 } | |
66 | |
67 return NGX_OK; | |
68 } |