From 25b36fedf72139617dc172dbca887888b258698d Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 3 Feb 2004 16:43:54 +0000 Subject: nginx-0.0.2-2004-02-03-19:43:54 import --- src/os/unix/ngx_daemon.c | 2 ++ src/os/unix/ngx_freebsd_config.h | 2 ++ src/os/unix/ngx_linux_config.h | 15 ++++++++------- src/os/unix/ngx_process.c | 1 + src/os/unix/ngx_process.h | 1 + src/os/unix/ngx_solaris_config.h | 2 ++ 6 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/os/unix') diff --git a/src/os/unix/ngx_daemon.c b/src/os/unix/ngx_daemon.c index b2a37c100..8bad5444a 100644 --- a/src/os/unix/ngx_daemon.c +++ b/src/os/unix/ngx_daemon.c @@ -19,6 +19,8 @@ int ngx_daemon(ngx_log_t *log) exit(0); } + ngx_pid = ngx_getpid(); + if (setsid() == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "setsid() failed"); return NGX_ERROR; diff --git a/src/os/unix/ngx_freebsd_config.h b/src/os/unix/ngx_freebsd_config.h index 6a4397999..2e14831ea 100644 --- a/src/os/unix/ngx_freebsd_config.h +++ b/src/os/unix/ngx_freebsd_config.h @@ -28,6 +28,8 @@ #include #include +#include + #ifndef HAVE_SELECT #define HAVE_SELECT 1 diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h index e43a6caa7..f6b84569f 100644 --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -26,13 +26,6 @@ #include #include #include - -#if (HAVE_SENDFILE64) -#include -#else -extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size); -#endif - #include #include /* TCP_CORK */ #include @@ -41,6 +34,14 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size); #include #include +#include + +#if (HAVE_SENDFILE64) +#include +#else +extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size); +#endif + #ifndef HAVE_SELECT diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index 68bdaed7b..a8c9610b2 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -46,6 +46,7 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, return NGX_ERROR; case 0: + ngx_pid = ngx_getpid(); proc(cycle, data); break; diff --git a/src/os/unix/ngx_process.h b/src/os/unix/ngx_process.h index a1aa74bd7..66b9d7d45 100644 --- a/src/os/unix/ngx_process.h +++ b/src/os/unix/ngx_process.h @@ -49,6 +49,7 @@ ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx); void ngx_respawn_processes(ngx_cycle_t *cycle); void ngx_process_get_status(void); +extern ngx_pid_t ngx_pid; extern ngx_uint_t ngx_last_process; extern ngx_process_t ngx_processes[NGX_MAX_PROCESSES]; diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h index 43068f20e..920aaf904 100644 --- a/src/os/unix/ngx_solaris_config.h +++ b/src/os/unix/ngx_solaris_config.h @@ -32,6 +32,8 @@ #include #include +#include + #ifndef HAVE_SELECT #define HAVE_SELECT 1 -- cgit