aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_posix_init.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-07-03 16:30:22 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-07-03 16:30:22 +0000
commit7349befe26d264159cacc4d3dee3964b32e79c83 (patch)
treeb83383a178e65c8f0615baa94db5143119d8a029 /src/os/unix/ngx_posix_init.c
parent9d9f58f24d318dad43c7019c40a187555aaa64c8 (diff)
downloadnginx-7349befe26d264159cacc4d3dee3964b32e79c83.tar.gz
nginx-7349befe26d264159cacc4d3dee3964b32e79c83.zip
nginx-0.0.1-2003-07-03-20:30:22 import
Diffstat (limited to 'src/os/unix/ngx_posix_init.c')
-rw-r--r--src/os/unix/ngx_posix_init.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index aadb64c2d..364df118e 100644
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -7,6 +7,10 @@ int ngx_max_sockets;
int ngx_inherited_nonblocking;
+void ngx_restart_signal_handler(int signo);
+void ngx_rotate_signal_handler(int signo);
+
+
int ngx_posix_init(ngx_log_t *log)
{
struct sigaction sa;
@@ -15,13 +19,26 @@ int ngx_posix_init(ngx_log_t *log)
ngx_memzero(&sa, sizeof(struct sigaction));
sa.sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
-
if (sigaction(SIGPIPE, &sa, NULL) == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"sigaction(SIGPIPE, SIG_IGN) failed");
return NGX_ERROR;
}
+ sa.sa_handler = ngx_restart_signal_handler;
+ if (sigaction(SIGHUP, &sa, NULL) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "sigaction(SIGHUP) failed");
+ return NGX_ERROR;
+ }
+
+ sa.sa_handler = ngx_rotate_signal_handler;
+ if (sigaction(SIGUSR1, &sa, NULL) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "sigaction(SIGUSR1) failed");
+ return NGX_ERROR;
+ }
+
if (getrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
ngx_log_error(NGX_LOG_ALERT, log, errno,
@@ -45,6 +62,18 @@ int ngx_posix_init(ngx_log_t *log)
}
+void ngx_restart_signal_handler(int signo)
+{
+ restart = 1;
+}
+
+
+void ngx_rotate_signal_handler(int signo)
+{
+ rotate = 1;
+}
+
+
int ngx_posix_post_conf_init(ngx_log_t *log)
{
ngx_fd_t pp[2];