Mercurial > hg > nginx
comparison src/os/unix/ngx_posix_init.c @ 449:3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 03 Oct 2004 20:02:06 +0000 |
parents | 42d11f017717 |
children | 295d97d70c69 |
comparison
equal
deleted
inserted
replaced
448:241dc8092a33 | 449:3b1e8c9df9ad |
---|---|
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | 9 |
10 | 10 |
11 int ngx_ncpu; | 11 ngx_int_t ngx_ncpu; |
12 int ngx_max_sockets; | 12 ngx_int_t ngx_max_sockets; |
13 int ngx_inherited_nonblocking; | 13 ngx_int_t ngx_inherited_nonblocking; |
14 | |
15 | |
16 struct rlimit rlmt; | |
14 | 17 |
15 | 18 |
16 #if (NGX_POSIX_IO) | 19 #if (NGX_POSIX_IO) |
17 | 20 |
18 ngx_os_io_t ngx_os_io = { | 21 ngx_os_io_t ngx_os_io = { |
80 | 83 |
81 { 0, NULL, NULL } | 84 { 0, NULL, NULL } |
82 }; | 85 }; |
83 | 86 |
84 | 87 |
85 int ngx_posix_init(ngx_log_t *log) | 88 ngx_int_t ngx_posix_init(ngx_log_t *log) |
86 { | 89 { |
87 ngx_signal_t *sig; | 90 ngx_signal_t *sig; |
88 struct rlimit rlmt; | |
89 struct sigaction sa; | 91 struct sigaction sa; |
90 | 92 |
91 ngx_pagesize = getpagesize(); | 93 ngx_pagesize = getpagesize(); |
92 | 94 |
93 if (ngx_ncpu == 0) { | 95 if (ngx_ncpu == 0) { |
109 ngx_log_error(NGX_LOG_ALERT, log, errno, | 111 ngx_log_error(NGX_LOG_ALERT, log, errno, |
110 "getrlimit(RLIMIT_NOFILE) failed)"); | 112 "getrlimit(RLIMIT_NOFILE) failed)"); |
111 return NGX_ERROR; | 113 return NGX_ERROR; |
112 } | 114 } |
113 | 115 |
114 ngx_log_error(NGX_LOG_INFO, log, 0, | |
115 "getrlimit(RLIMIT_NOFILE): " RLIM_T_FMT ":" RLIM_T_FMT, | |
116 rlmt.rlim_cur, rlmt.rlim_max); | |
117 | |
118 ngx_max_sockets = rlmt.rlim_cur; | 116 ngx_max_sockets = rlmt.rlim_cur; |
119 | 117 |
120 #if (HAVE_INHERITED_NONBLOCK) | 118 #if (HAVE_INHERITED_NONBLOCK) |
121 ngx_inherited_nonblocking = 1; | 119 ngx_inherited_nonblocking = 1; |
122 #else | 120 #else |
123 ngx_inherited_nonblocking = 0; | 121 ngx_inherited_nonblocking = 0; |
124 #endif | 122 #endif |
125 | 123 |
126 return NGX_OK; | 124 return NGX_OK; |
125 } | |
126 | |
127 | |
128 void ngx_posix_status(ngx_log_t *log) | |
129 { | |
130 ngx_log_error(NGX_LOG_INFO, log, 0, | |
131 "getrlimit(RLIMIT_NOFILE): " RLIM_T_FMT ":" RLIM_T_FMT, | |
132 rlmt.rlim_cur, rlmt.rlim_max); | |
127 } | 133 } |
128 | 134 |
129 | 135 |
130 void ngx_signal_handler(int signo) | 136 void ngx_signal_handler(int signo) |
131 { | 137 { |