comparison src/os/unix/ngx_unix_init.c @ 92:19cc647ecd91

nginx-0.0.1-2003-05-20-19:37:55 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 20 May 2003 15:37:55 +0000
parents 637625a2acdb
children 738fe44c70d5
comparison
equal deleted inserted replaced
91:637625a2acdb 92:19cc647ecd91
1 1
2 #include <ngx_config.h> 2 #include <ngx_config.h>
3 #include <ngx_core.h> 3 #include <ngx_core.h>
4
5
6 int ngx_max_sockets;
4 7
5 8
6 int ngx_unix_init(ngx_log_t *log) 9 int ngx_unix_init(ngx_log_t *log)
7 { 10 {
8 struct sigaction sa; 11 struct sigaction sa;
27 30
28 ngx_log_error(NGX_LOG_INFO, log, 0, 31 ngx_log_error(NGX_LOG_INFO, log, 0,
29 "getrlimit(RLIMIT_NOFILE): %qd:%qd", 32 "getrlimit(RLIMIT_NOFILE): %qd:%qd",
30 rlmt.rlim_cur, rlmt.rlim_max); 33 rlmt.rlim_cur, rlmt.rlim_max);
31 34
32 35 ngx_max_sockets = rlmt.rlim_cur;
33 #if 0
34 RLIM_INFINITY
35 max_connections =< rlmt.rlim_cur;
36 #endif
37 36
38 return NGX_OK; 37 return NGX_OK;
39 } 38 }
39
40
41 int ngx_unix_post_conf_init(ngx_log_t *log)
42 {
43 ngx_fd_t pp[2];
44
45 if (pipe(pp) == -1) {
46 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "pipe() failed");
47 return NGX_ERROR;
48 }
49
50 if (dup2(pp[1], STDERR_FILENO) == -1) {
51 ngx_log_error(NGX_LOG_EMERG, log, errno, "dup2(STDERR) failed");
52 return NGX_ERROR;
53 }
54
55 if (pp[1] > STDERR_FILENO) {
56 if (close(pp[1]) == -1) {
57 ngx_log_error(NGX_LOG_EMERG, log, errno, "close() failed");
58 return NGX_ERROR;
59 }
60 }
61
62 return NGX_OK;
63 }