aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_unix_init.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-05-20 15:37:55 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-05-20 15:37:55 +0000
commit1c13c662f0ae8066d1d4849b4158d7459a4c7822 (patch)
treea8e517c0d41e922b1d3744d869edc60ed540b2d9 /src/os/unix/ngx_unix_init.c
parenta98301160de4c12f455cca8f78509f2e04626c0b (diff)
downloadnginx-1c13c662f0ae8066d1d4849b4158d7459a4c7822.tar.gz
nginx-1c13c662f0ae8066d1d4849b4158d7459a4c7822.zip
nginx-0.0.1-2003-05-20-19:37:55 import
Diffstat (limited to 'src/os/unix/ngx_unix_init.c')
-rw-r--r--src/os/unix/ngx_unix_init.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/os/unix/ngx_unix_init.c b/src/os/unix/ngx_unix_init.c
index 2916c9e44..7b38bb18e 100644
--- a/src/os/unix/ngx_unix_init.c
+++ b/src/os/unix/ngx_unix_init.c
@@ -3,6 +3,9 @@
#include <ngx_core.h>
+int ngx_max_sockets;
+
+
int ngx_unix_init(ngx_log_t *log)
{
struct sigaction sa;
@@ -29,11 +32,32 @@ int ngx_unix_init(ngx_log_t *log)
"getrlimit(RLIMIT_NOFILE): %qd:%qd",
rlmt.rlim_cur, rlmt.rlim_max);
+ ngx_max_sockets = rlmt.rlim_cur;
+
+ return NGX_OK;
+}
+
+
+int ngx_unix_post_conf_init(ngx_log_t *log)
+{
+ ngx_fd_t pp[2];
-#if 0
- RLIM_INFINITY
- max_connections =< rlmt.rlim_cur;
-#endif
+ if (pipe(pp) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "pipe() failed");
+ return NGX_ERROR;
+ }
+
+ if (dup2(pp[1], STDERR_FILENO) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, errno, "dup2(STDERR) failed");
+ return NGX_ERROR;
+ }
+
+ if (pp[1] > STDERR_FILENO) {
+ if (close(pp[1]) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, errno, "close() failed");
+ return NGX_ERROR;
+ }
+ }
return NGX_OK;
}