mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 01:12:40 +08:00
nginx-0.0.2-2004-02-03-00:19:52 import
This commit is contained in:
parent
328af6e8cd
commit
a4b16df728
6
auto/configure
vendored
6
auto/configure
vendored
@ -3,15 +3,17 @@
|
||||
. auto/init
|
||||
. auto/sources
|
||||
|
||||
echo > $NGX_AUTO_CONFIG_H
|
||||
|
||||
. auto/os/conf
|
||||
. auto/modules
|
||||
|
||||
. auto/cc
|
||||
. auto/lib/conf
|
||||
|
||||
. auto/make
|
||||
. auto/lib/make
|
||||
|
||||
echo > $NGX_AUTO_CONFIG_H
|
||||
|
||||
if [ "$PLATFORM" != win32 ]; then
|
||||
. auto/unix
|
||||
fi
|
||||
|
8
auto/have
Normal file
8
auto/have
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
cat << END >> $NGX_AUTO_CONFIG_H
|
||||
|
||||
#ifndef $have
|
||||
#define $have 1
|
||||
#endif
|
||||
|
||||
END
|
@ -4,7 +4,7 @@ if [ $MD5 != NO ]; then
|
||||
if grep MD5_Init $MD5/md5.h >/dev/null; then
|
||||
# OpenSSL md5
|
||||
OPENSSL_MD5=YES
|
||||
CFLAGS="$CFLAGS -D HAVE_OPENSSL_MD5"
|
||||
have=HAVE_OPENSSL_MD5 . auto/have
|
||||
else
|
||||
# rsaref md5
|
||||
OPENSSL_MD5=NO
|
||||
@ -60,7 +60,7 @@ ngx_lib_inc="#include <sys/types.h>
|
||||
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_OPENSSL_MD5"
|
||||
have=HAVE_OPENSSL_MD5 . auto/have
|
||||
CORE_LIBS="$CORE_LIBS $ngx_libs"
|
||||
MD5=YES
|
||||
fi
|
||||
|
29
auto/make
29
auto/make
@ -4,35 +4,6 @@ mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \
|
||||
$OBJS/src/http $OBJS/src/http/modules $OBJS/src/http/modules/proxy
|
||||
|
||||
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES \
|
||||
$HTTP_CHUNKED_FILTER_MODULE \
|
||||
$HTTP_RANGE_FILTER_MODULE \
|
||||
$HTTP_CHARSET_FILTER_MODULE"
|
||||
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE $HTTP_INDEX_MODULE"
|
||||
|
||||
if [ $HTTP_REWRITE = YES ]; then
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_GZIP = YES ]; then
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GZIP_FILTER_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_SSI = YES ]; then
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_PROXY = YES ]; then
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE"
|
||||
HTTP_INCS="$HTTP_INCS $HTTP_PROXY_INCS"
|
||||
HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS"
|
||||
fi
|
||||
|
||||
modules="$CORE_MODULES $EVENT_MODULES $HTTP_MODULES \
|
||||
$HTTP_FILTER_MODULES $HTTP_NOT_MODIFIED_FILTER_MODULE"
|
||||
|
||||
|
32
auto/modules
Normal file
32
auto/modules
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES \
|
||||
$HTTP_CHUNKED_FILTER_MODULE \
|
||||
$HTTP_RANGE_FILTER_MODULE \
|
||||
$HTTP_CHARSET_FILTER_MODULE"
|
||||
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE $HTTP_INDEX_MODULE"
|
||||
|
||||
if [ $HTTP_REWRITE = YES ]; then
|
||||
USE_PCRE=YES
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_GZIP = YES ]; then
|
||||
USE_ZLIB=YES
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GZIP_FILTER_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_SSI = YES ]; then
|
||||
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_PROXY = YES ]; then
|
||||
USE_MD5=YES
|
||||
HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE"
|
||||
HTTP_INCS="$HTTP_INCS $HTTP_PROXY_INCS"
|
||||
HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS"
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS"
|
||||
fi
|
16
auto/options
16
auto/options
@ -8,8 +8,11 @@ TEST_BUILD_DEVPOLL=NO
|
||||
TEST_BUILD_EPOLL=NO
|
||||
TEST_BUILD_SIGIO=NO
|
||||
|
||||
SELECT=YES
|
||||
POLL=YES
|
||||
EVENT_FOUND=NO
|
||||
|
||||
EVENT_SELECT=NO
|
||||
EVENT_POLL=NO
|
||||
EVENT_AIO=NO
|
||||
|
||||
HTTP_REWRITE=YES
|
||||
HTTP_GZIP=YES
|
||||
@ -18,11 +21,11 @@ HTTP_PROXY=YES
|
||||
|
||||
PCRE=NO
|
||||
|
||||
USE_MD5=YES
|
||||
USE_MD5=NO
|
||||
MD5=NO
|
||||
MD5_LIB=NO
|
||||
|
||||
USE_ZLIB=YES
|
||||
USE_ZLIB=NO
|
||||
ZLIB=NO
|
||||
ZLIB_LIB=NO
|
||||
|
||||
@ -41,8 +44,9 @@ do
|
||||
|
||||
--builddir=*) OBJS="$value" ;;
|
||||
|
||||
--without-select_module) SELECT=NO ;;
|
||||
--without-poll_module) POLL=NO ;;
|
||||
--with-select_module) EVENT_SELECT=YES ;;
|
||||
--with-poll_module) EVENT_POLL=YES ;;
|
||||
--with-aio_module) EVENT_AIO=YES ;;
|
||||
|
||||
--without-http_rewrite_module) HTTP_REWRITE=NO ;;
|
||||
--without-http_ssi_module) HTTP_SSI=NO ;;
|
||||
|
12
auto/os/conf
12
auto/os/conf
@ -43,6 +43,18 @@ case $PLATFORM in
|
||||
esac
|
||||
|
||||
|
||||
if [ $EVENT_SELECT = YES -o $EVENT_FOUND = NO ]; then
|
||||
CORE_SRCS="$CORE_SRCS $SELECT_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
|
||||
fi
|
||||
|
||||
|
||||
if [ $EVENT_POLL = YES -o $EVENT_FOUND = NO ]; then
|
||||
CORE_SRCS="$CORE_SRCS $POLL_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $POLL_MODULE"
|
||||
fi
|
||||
|
||||
|
||||
if [ $TEST_BUILD_DEVPOLL = YES ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_DEVPOLL=1 -D TEST_BUILD_DEVPOLL=1"
|
||||
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
|
||||
|
@ -7,16 +7,6 @@ CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
|
||||
MD5_LIB="-lmd"
|
||||
ZLIB_LIB="-lz"
|
||||
|
||||
if [ $SELECT = YES ]; then
|
||||
CORE_SRCS="$CORE_SRCS $SELECT_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
|
||||
fi
|
||||
|
||||
if [ $POLL = YES ]; then
|
||||
CORE_SRCS="$CORE_SRCS $POLL_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $POLL_MODULE"
|
||||
fi
|
||||
|
||||
version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
|
||||
| sed -e 's/^.* \(.*\)$/\1/'`
|
||||
|
||||
@ -24,7 +14,7 @@ version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
|
||||
# sendfile
|
||||
|
||||
if [ $version -gt 300007 ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_SENDFILE=1"
|
||||
have=HAVE_SENDFILE . auto/have
|
||||
CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
|
||||
fi
|
||||
|
||||
@ -34,9 +24,11 @@ fi
|
||||
if [ \( $version -lt 500000 -a $version -ge 410000 \) \
|
||||
-o $version -ge 500011 ]
|
||||
then
|
||||
CFLAGS="$CFLAGS -D HAVE_KQUEUE=1 -D HAVE_CLEAR_EVENT=1"
|
||||
have=HAVE_KQUEUE . auto/have
|
||||
have=HAVE_CLEAR_EVENT . auto/have
|
||||
CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
|
||||
EVENT_FOUND=YES
|
||||
fi
|
||||
|
||||
|
||||
@ -45,5 +37,11 @@ fi
|
||||
if [ \( $version -lt 500000 -a $version -ge 430000 \) \
|
||||
-o $version -ge 500018 ]
|
||||
then
|
||||
CFLAGS="$CFLAGS -D HAVE_LOWAT_EVENT=1"
|
||||
have=HAVE_LOWAT_EVENT . auto/have
|
||||
fi
|
||||
|
||||
|
||||
if [ $EVENT_AIO = YES ]; then
|
||||
CORE_SRCS="$CORE_SRCS $AIO_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
|
||||
fi
|
||||
|
@ -6,19 +6,49 @@ EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE $POLL_MODULE"
|
||||
|
||||
ZLIB_LIB="-lz"
|
||||
|
||||
CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
|
||||
|
||||
NGX_INC="sys/epoll.h"; . auto/inc
|
||||
|
||||
if [ $NGX_FOUND=YES ]; then
|
||||
# epoll, EPOLLET version
|
||||
|
||||
ngx_func="epoll";
|
||||
ngx_func_inc="#include <sys/epoll.h>"
|
||||
ngx_func_test="int fd = 1; int n;
|
||||
struct epoll_event ee;
|
||||
ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
|
||||
ee.data.ptr = NULL;
|
||||
n = epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
|
||||
. auto/func
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_EPOLL=1"
|
||||
EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
|
||||
CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
|
||||
EVENT_FOUND=YES
|
||||
fi
|
||||
|
||||
|
||||
# TODO check sendfile64()
|
||||
# sendfile()
|
||||
|
||||
CC_TEST_FLAGS="-D_GNU_SOURCE"
|
||||
ngx_func="sendfile()";
|
||||
ngx_func_inc="#include <sys/sendfile.h>"
|
||||
ngx_func_test="int s = 0, fd = 1;
|
||||
ssize_t n; off_t off = 0;
|
||||
n = sendfile(s, fd, &off, 1)"
|
||||
. auto/func
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_SENDFILE=1"
|
||||
CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
|
||||
fi
|
||||
|
||||
|
||||
# sendfile64()
|
||||
|
||||
CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
|
||||
ngx_func="sendfile64()"; . auto/func
|
||||
|
||||
# STUB
|
||||
CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_SENDFILE64=1"
|
||||
fi
|
||||
|
@ -6,29 +6,31 @@ EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE $POLL_MODULE"
|
||||
|
||||
MD5_LIB="-lmd5"
|
||||
ZLIB_LIB="-lz"
|
||||
CORE_LIBS="$CORE_LIBS -lsocket -lnsl"
|
||||
|
||||
CC_TEST_FLAGS="-D_FILE_OFFSET_BITS=64"
|
||||
|
||||
CORE_LIBS="$CORE_LIBS -lsocket -lnsl"
|
||||
|
||||
ngx_inc="sys/devpoll.h"; . auto/inc
|
||||
|
||||
NGX_INC="sys/devpoll.h"; . auto/inc
|
||||
|
||||
if [ $NGX_FOUND=YES ]; then
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_DEVPOLL=1"
|
||||
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
|
||||
CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
|
||||
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
|
||||
EVENT_FOUND=YES
|
||||
fi
|
||||
|
||||
|
||||
NGX_FUNC_INC="#include <sys/sendfile.h>"
|
||||
NGX_FUNC_LIBS="-lsendfile"
|
||||
NGX_FUNC_TEST="int fd = 1; sendfilevec_t vec[1];
|
||||
ngx_func="sendfilev()";
|
||||
ngx_func_inc="#include <sys/sendfile.h>"
|
||||
ngx_func_libs="-lsendfile"
|
||||
ngx_func_test="int fd = 1; sendfilevec_t vec[1];
|
||||
size_t sent = 1; ssize_t n;
|
||||
n = sendfilev(fd, vec, 1, &sent)"
|
||||
NGX_FUNC="sendfilev()"; . auto/func
|
||||
. auto/func
|
||||
|
||||
if [ $NGX_FOUND=YES ]; then
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
CFLAGS="$CFLAGS -D HAVE_SENDFILE=1"
|
||||
CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS"
|
||||
CORE_LIBS="$CORE_LIBS -lsendfile"
|
||||
|
26
auto/sources
26
auto/sources
@ -41,8 +41,8 @@ CORE_SRCS="src/core/nginx.c \
|
||||
src/core/ngx_garbage_collector.c"
|
||||
|
||||
|
||||
REGEX_DEPS="src/core/ngx_regex.h"
|
||||
REGEX_SRCS="src/core/ngx_regex.c"
|
||||
REGEX_DEPS=src/core/ngx_regex.h
|
||||
REGEX_SRCS=src/core/ngx_regex.c
|
||||
|
||||
|
||||
EVENT_MODULES="ngx_events_module ngx_event_core_module"
|
||||
@ -62,29 +62,33 @@ EVENT_SRCS="src/event/ngx_event.c \
|
||||
src/event/ngx_event_pipe.c"
|
||||
|
||||
|
||||
SELECT_MODULE="ngx_select_module"
|
||||
SELECT_MODULE=ngx_select_module
|
||||
SELECT_SRCS=src/event/modules/ngx_select_module.c
|
||||
|
||||
POLL_MODULE="ngx_poll_module"
|
||||
POLL_MODULE=ngx_poll_module
|
||||
POLL_SRCS=src/event/modules/ngx_poll_module.c
|
||||
|
||||
KQUEUE_MODULE="ngx_kqueue_module"
|
||||
KQUEUE_MODULE=ngx_kqueue_module
|
||||
KQUEUE_SRCS=src/event/modules/ngx_kqueue_module.c
|
||||
|
||||
DEVPOLL_MODULE="ngx_devpoll_module"
|
||||
DEVPOLL_MODULE=ngx_devpoll_module
|
||||
DEVPOLL_SRCS=src/event/modules/ngx_devpoll_module.c
|
||||
|
||||
EPOLL_MODULE="ngx_epoll_module"
|
||||
EPOLL_MODULE=ngx_epoll_module
|
||||
EPOLL_SRCS=src/event/modules/ngx_epoll_module.c
|
||||
|
||||
SIGIO_MODULE="ngx_sigio_module"
|
||||
SIGIO_MODULE=ngx_sigio_module
|
||||
SIGIO_SRCS=src/event/modules/ngx_sigio_module.c
|
||||
|
||||
IOCP_MODULE="ngx_iocp_module"
|
||||
IOCP_MODULE=ngx_iocp_module
|
||||
IOCP_SRCS=src/event/modules/ngx_iocp_module.c
|
||||
|
||||
AIO_MODULE="ngx_aio_module"
|
||||
AIO_SRCS=src/event/modules/ngx_aio_module.c
|
||||
AIO_MODULE=ngx_aio_module
|
||||
AIO_SRCS="src/event/modules/ngx_aio_module.c \
|
||||
src/os/unix/ngx_aio_read.c \
|
||||
src/os/unix/ngx_aio_write.c \
|
||||
src/os/unix/ngx_aio_read_chain.c \
|
||||
src/os/unix/ngx_aio_write_chain.c"
|
||||
|
||||
|
||||
UNIX_INCS="$CORE_INCS $EVENT_INCS -I src/os/unix"
|
||||
|
@ -173,7 +173,7 @@ int main(int argc, char *const *argv, char **envp)
|
||||
|
||||
#else
|
||||
|
||||
if (ccf->daemon != 0) {
|
||||
if (!ngx_inherited && ccf->daemon != 0) {
|
||||
if (ngx_daemon(cycle->log) == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
@ -356,11 +356,10 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
live = 0;
|
||||
for (i = 0; i < ngx_last_process; i++) {
|
||||
|
||||
ngx_log_debug6(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
||||
ngx_log_debug5(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
||||
"child: " PID_T_FMT
|
||||
" s:%d e:%d t:%d d:%d r:%d",
|
||||
" e:%d t:%d d:%d r:%d",
|
||||
ngx_processes[i].pid,
|
||||
ngx_processes[i].signal,
|
||||
ngx_processes[i].exiting,
|
||||
ngx_processes[i].exited,
|
||||
ngx_processes[i].detached,
|
||||
@ -396,13 +395,10 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
ngx_processes[ngx_last_process];
|
||||
}
|
||||
|
||||
} else if (!ngx_processes[i].detached
|
||||
&& (ngx_terminate || ngx_quit))
|
||||
} else if (ngx_processes[i].exiting
|
||||
|| !ngx_processes[i].detached)
|
||||
{
|
||||
live = 1;
|
||||
|
||||
} else if (ngx_processes[i].exiting) {
|
||||
live = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -470,46 +466,29 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
if (signo) {
|
||||
for (i = 0; i < ngx_last_process; i++) {
|
||||
|
||||
if (!ngx_processes[i].detached) {
|
||||
ngx_processes[i].signal = signo;
|
||||
if (ngx_processes[i].detached) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_EVENT,
|
||||
cycle->log, 0,
|
||||
"signal " PID_T_FMT " %d",
|
||||
ngx_processes[i].pid, signo);
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
|
||||
"kill (" PID_T_FMT ", %d)" ,
|
||||
ngx_processes[i].pid, signo);
|
||||
|
||||
if (kill(ngx_processes[i].pid, signo) == -1) {
|
||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||
"kill(%d, %d) failed",
|
||||
ngx_processes[i].pid, signo);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (signo != ngx_signal_value(NGX_REOPEN_SIGNAL)) {
|
||||
ngx_processes[i].exiting = 1;
|
||||
}
|
||||
}
|
||||
|
||||
signo = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ngx_last_process; i++) {
|
||||
|
||||
if (ngx_processes[i].signal == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
|
||||
"kill (" PID_T_FMT ", %d)" ,
|
||||
ngx_processes[i].pid,
|
||||
ngx_processes[i].signal);
|
||||
|
||||
if (kill(ngx_processes[i].pid, ngx_processes[i].signal)
|
||||
== -1)
|
||||
{
|
||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||
"kill(%d, %d) failed",
|
||||
ngx_processes[i].pid,
|
||||
ngx_processes[i].signal);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ngx_processes[i].signal
|
||||
!= ngx_signal_value(NGX_REOPEN_SIGNAL))
|
||||
{
|
||||
ngx_processes[i].exiting = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ngx_reopen || ngx_reconfigure || ngx_timer) {
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define _NGINX_H_INCLUDED_
|
||||
|
||||
|
||||
#define NGINX_VER "nginx/0.0.1"
|
||||
#define NGINX_VER "nginx/0.0.2"
|
||||
#define NGINX_CONF "nginx.conf"
|
||||
#define NGINX_PID "nginx.pid"
|
||||
#define NGINX_NEW_PID NGINX_PID ".newbin"
|
||||
|
@ -2,7 +2,10 @@
|
||||
#define _NGX_CONFIG_H_INCLUDED_
|
||||
|
||||
|
||||
#if 0
|
||||
#include <ngx_auto_config.h>
|
||||
|
||||
|
||||
#if 1
|
||||
/* STUB to allocate a big ngx_connections */
|
||||
#undef FD_SETSIZE
|
||||
#define FD_SETSIZE 5000
|
||||
@ -53,9 +56,6 @@ typedef int ngx_flag_t;
|
||||
#define PTR_FMT "%08X"
|
||||
|
||||
|
||||
#include <ngx_auto_config.h>
|
||||
|
||||
|
||||
#ifndef NGX_SERVER_ROOT
|
||||
#define NGX_SERVER_ROOT "./"
|
||||
#if 0
|
||||
|
@ -375,6 +375,8 @@ static int ngx_kqueue_process_events(ngx_log_t *log)
|
||||
ngx_gettimeofday(&tv);
|
||||
ngx_time_update(tv.tv_sec);
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "kevent events: %d", events);
|
||||
|
||||
delta = ngx_elapsed_msec;
|
||||
ngx_elapsed_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000 - ngx_start_msec;
|
||||
|
||||
|
@ -320,12 +320,12 @@ static int ngx_poll_process_events(ngx_log_t *log)
|
||||
|
||||
found = 0;
|
||||
|
||||
if (event_list[i].revents & (POLLIN|POLLERR|POLLHUP)) {
|
||||
if (event_list[i].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL)) {
|
||||
found = 1;
|
||||
ready_index[nready++] = c->read;
|
||||
}
|
||||
|
||||
if (event_list[i].revents & (POLLOUT|POLLERR|POLLHUP)) {
|
||||
if (event_list[i].revents & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
|
||||
found = 1;
|
||||
ready_index[nready++] = c->write;
|
||||
}
|
||||
|
@ -315,14 +315,15 @@ static int ngx_select_process_events(ngx_log_t *log)
|
||||
deltas += delta;
|
||||
if (deltas > 1000) {
|
||||
ngx_gettimeofday(&tv);
|
||||
deltas = tv.tv_usec / 1000;
|
||||
ngx_time_update(tv.tv_sec);
|
||||
deltas = tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
|
||||
"select timer: %d, delta: %d", timer, (int) delta);
|
||||
|
||||
} else {
|
||||
delta = 0;
|
||||
ngx_gettimeofday(&tv);
|
||||
ngx_time_update(tv.tv_sec);
|
||||
|
||||
@ -438,8 +439,10 @@ static char *ngx_select_init_conf(ngx_cycle_t *cycle, void *conf)
|
||||
/* disable warning: the default FD_SETSIZE is 1024U in FreeBSD 5.x */
|
||||
|
||||
if ((unsigned) ecf->connections > FD_SETSIZE) {
|
||||
return "maximum number of connections "
|
||||
"supported by select() is " ngx_value(FD_SETSIZE);
|
||||
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
|
||||
"the maximum number of files "
|
||||
"supported by select() is " ngx_value(FD_SETSIZE));
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
return NGX_CONF_OK;
|
||||
|
@ -84,6 +84,13 @@ static ngx_command_t ngx_event_core_commands[] = {
|
||||
0,
|
||||
NULL },
|
||||
|
||||
{ ngx_string("multi_accept"),
|
||||
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
||||
ngx_conf_set_flag_slot,
|
||||
0,
|
||||
offsetof(ngx_event_conf_t, multi_accept),
|
||||
NULL },
|
||||
|
||||
ngx_null_command
|
||||
};
|
||||
|
||||
@ -421,8 +428,8 @@ static void *ngx_event_create_conf(ngx_cycle_t *cycle)
|
||||
NGX_CONF_ERROR);
|
||||
|
||||
ecf->connections = NGX_CONF_UNSET;
|
||||
ecf->timer_queues = NGX_CONF_UNSET;
|
||||
ecf->use = NGX_CONF_UNSET;
|
||||
ecf->multi_accept = NGX_CONF_UNSET;
|
||||
ecf->name = (void *) NGX_CONF_UNSET;
|
||||
|
||||
return ecf;
|
||||
@ -457,7 +464,7 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
|
||||
|
||||
cycle->connection_n = ecf->connections;
|
||||
|
||||
ngx_conf_init_value(ecf->timer_queues, 10);
|
||||
ngx_conf_init_value(ecf->multi_accept, 1);
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ extern ngx_event_actions_t ngx_event_actions;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int connections;
|
||||
int timer_queues;
|
||||
int use;
|
||||
char *name;
|
||||
int connections;
|
||||
int use;
|
||||
ngx_flag_t multi_accept;
|
||||
char *name;
|
||||
} ngx_event_conf_t;
|
||||
|
||||
|
||||
|
@ -23,6 +23,13 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
|
||||
ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module);
|
||||
|
||||
if (ngx_event_flags & (NGX_USE_EDGE_EVENT|NGX_USE_SIGIO_EVENT)) {
|
||||
ev->available = 1;
|
||||
|
||||
} else if (!(ngx_event_flags & NGX_HAVE_KQUEUE_EVENT)) {
|
||||
ev->available = ecf->multi_accept;
|
||||
}
|
||||
|
||||
ls = ev->data;
|
||||
|
||||
ngx_log_debug(ev->log, "accept on %s ready: %d" _
|
||||
@ -31,26 +38,33 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
|
||||
ev->ready = 0;
|
||||
accepted = 0;
|
||||
pool = NULL;
|
||||
|
||||
do {
|
||||
|
||||
/*
|
||||
* Create the pool before accept() to avoid copy the sockaddr.
|
||||
* Although accept() can fail it's an uncommon case
|
||||
* and besides the pool can be got from the free pool list
|
||||
*/
|
||||
if (pool == NULL) {
|
||||
|
||||
if (!(pool = ngx_create_pool(ls->listening->pool_size, ev->log))) {
|
||||
return;
|
||||
/*
|
||||
* Create the pool before accept() to avoid copy the sockaddr.
|
||||
* Although accept() can fail it's an uncommon case
|
||||
* and besides the pool can be got from the free pool list
|
||||
*/
|
||||
|
||||
if (!(pool = ngx_create_pool(ls->listening->pool_size, ev->log))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(sa = ngx_palloc(pool, ls->listening->socklen))) {
|
||||
ngx_destroy_pool(pool);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(log = ngx_palloc(pool, sizeof(ngx_log_t)))) {
|
||||
ngx_destroy_pool(pool);
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_memcpy(log, ls->log, sizeof(ngx_log_t));
|
||||
pool->log = log;
|
||||
|
||||
@ -67,6 +81,8 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
ngx_log_error(NGX_LOG_NOTICE, log, err,
|
||||
"EAGAIN after %d accepted connection(s)",
|
||||
accepted);
|
||||
|
||||
ngx_destroy_pool(pool);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,6 +90,17 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
"accept() on %s failed",
|
||||
ls->listening->addr_text.data);
|
||||
|
||||
if (err == NGX_ECONNABORTED) {
|
||||
if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
|
||||
ev->available--;
|
||||
}
|
||||
|
||||
if (ev->available) {
|
||||
/* reuse the previously allocated pool */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ngx_destroy_pool(pool);
|
||||
return;
|
||||
}
|
||||
@ -187,8 +214,10 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
wev->write = 1;
|
||||
wev->ready = 1;
|
||||
|
||||
if (ngx_event_flags & (NGX_USE_AIO_EVENT|NGX_USE_EDGE_EVENT)) {
|
||||
/* aio, iocp, epoll */
|
||||
if (ngx_event_flags
|
||||
& (NGX_USE_AIO_EVENT|NGX_USE_EDGE_EVENT|NGX_USE_SIGIO_EVENT))
|
||||
{
|
||||
/* aio, iocp, sigio, epoll */
|
||||
rev->ready = 1;
|
||||
}
|
||||
|
||||
@ -229,6 +258,8 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
pool = NULL;
|
||||
|
||||
log->data = NULL;
|
||||
log->handler = NULL;
|
||||
|
||||
|
@ -58,7 +58,7 @@ ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in)
|
||||
}
|
||||
|
||||
#if (NGX_DEBUG_WRITE_CHAIN)
|
||||
ngx_log_debug(c->log, "aio_write sent: " OFF_FMT _ c->sent);
|
||||
ngx_log_debug(c->log, "aio_write sent: " OFF_T_FMT _ c->sent);
|
||||
#endif
|
||||
|
||||
for (cl = in; cl; cl = cl->next) {
|
||||
|
@ -19,6 +19,7 @@ typedef int ngx_err_t;
|
||||
#define NGX_EAGAIN EWOULDBLOCK
|
||||
#define NGX_EINPROGRESS EINPROGRESS
|
||||
#define NGX_EADDRINUSE EADDRINUSE
|
||||
#define NGX_ECONNABORTED ECONNABORTED
|
||||
#define NGX_ECONNRESET ECONNRESET
|
||||
#define NGX_ENOTCONN ENOTCONN
|
||||
#define NGX_ETIMEDOUT ETIMEDOUT
|
||||
|
@ -55,6 +55,10 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#if (HAVE_EPOLL)
|
||||
#include <sys/epoll.h>
|
||||
#endif /* HAVE_EPOLL */
|
||||
|
||||
|
||||
#if defined TCP_DEFER_ACCEPT && !defined HAVE_DEFERRED_ACCEPT
|
||||
#define HAVE_DEFERRED_ACCEPT 1
|
||||
@ -76,14 +80,6 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* SuSE 8.2 supports epoll's EPOLLET but misses it in <sys/epoll.h>
|
||||
*/
|
||||
#ifndef EPOLLET
|
||||
#define EPOLLET 0x80000000
|
||||
#endif
|
||||
|
||||
|
||||
#define ngx_setproctitle(title)
|
||||
|
||||
|
||||
|
@ -70,7 +70,6 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
|
||||
(respawn == NGX_PROCESS_RESPAWN) ? 1 : 0;
|
||||
ngx_processes[ngx_last_process].detached =
|
||||
(respawn == NGX_PROCESS_DETACHED) ? 1 : 0;
|
||||
ngx_processes[ngx_last_process].signal = 0;
|
||||
ngx_processes[ngx_last_process].exited = 0;
|
||||
ngx_processes[ngx_last_process].exiting = 0;
|
||||
ngx_last_process++;
|
||||
|
@ -8,7 +8,6 @@ typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
|
||||
|
||||
typedef struct {
|
||||
ngx_pid_t pid;
|
||||
int signal;
|
||||
int status;
|
||||
|
||||
ngx_spawn_proc_pt proc;
|
||||
|
Loading…
Reference in New Issue
Block a user