nginx-0.0.2-2004-03-05-11:34:24 import

This commit is contained in:
Igor Sysoev 2004-03-05 08:34:24 +00:00
parent 6a93045222
commit ab9d5fdfd5
14 changed files with 299 additions and 95 deletions

50
auto/cc
View File

@ -2,6 +2,7 @@
case $CC in
*gcc)
# gcc 2.95.4, 3.3.2
# optimization
#CFLAGS="$CFLAGS -O2 -fomit-frame-pointer"
@ -31,6 +32,7 @@ case $CC in
have=HAVE_GCC_VARIADIC_MACROS . auto/have
OBJEXT=o
COMPILEONLY="-c "
OBJOUT="-o "
BINOUT="-o "
@ -57,6 +59,7 @@ case $CC in
have=HAVE_C99_VARIADIC_MACROS . auto/have
OBJEXT=o
COMPILEONLY="-c "
OBJOUT="-o "
BINOUT="-o "
@ -113,6 +116,7 @@ case $CC in
CORE_LINK="$CORE_LINK -debug -debugtype:coff"
OBJEXT=obj
COMPILEONLY="-c "
OBJOUT="-Fo"
BINOUT="-Fe"
@ -122,6 +126,52 @@ case $CC in
wcc386)
# Open Watcom 1.0
# optimization
# maximize speed
CFLAGS="$CFLAGS -ot"
# reorder instructions for best pipeline usage
CFLAGS="$CFLAGS -op"
# inline intrinsic functions
CFLAGS="$CFLAGS -oi"
# inline expansion
CFLAGS="$CFLAGS -oe"
# disable stack checking calls
CFLAGS="$CFLAGS -s"
# optimize for Pentium Pro
#CFLAGS="$CFLAGS -6r"
CFLAGS="$CFLAGS -6s"
# warnings
#CFLAGS="$CFLAGS -w3"
CFLAGS="$CFLAGS -wx"
# stop on warning
#CFLAGS="$CFLAGS -we"
# built target is NT
CFLAGS="$CFLAGS -bt=nt"
# multithreaded
CFLAGS="$CFLAGS -bm"
# debug
CFLAGS="$CFLAGS -d2"
# quiet
CFLAGS="$CFLAGS -zq"
# link traget is NT
CORE_LINK="$CORE_LINK -l=nt"
OBJEXT=obj
COMPILEONLY=
OBJOUT="-fo"
BINOUT="-fo"
INC_EQ=YES
MAKE_BS=YES
MAKE_SL=YES
;;
esac

View File

@ -10,6 +10,12 @@ NGX_ERR=$OBJS/autoconf.err
CC_WARN=$CC
INC_EQ=NO
MAKE_BS=NO
MAKE_SL=NO
MAKE_BL=YES
# checking echo's "-n" option and "\c" capabilties
if echo "test\c" | grep c >/dev/null; then

264
auto/make
View File

@ -4,155 +4,261 @@ mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \
$OBJS/src/http $OBJS/src/http/modules $OBJS/src/http/modules/proxy
modules="$CORE_MODULES $EVENT_MODULES $HTTP_MODULES \
$HTTP_FILTER_MODULES $HTTP_NOT_MODIFIED_FILTER_MODULE"
echo "CC = $CC" > $MAKEFILE
echo "CFLAGS = $CFLAGS" >> $MAKEFILE
echo >> $MAKEFILE
echo "#include <ngx_config.h>" > $NGX_MODULES_C
echo "#include <ngx_core.h>" >> $NGX_MODULES_C
echo >> $NGX_MODULES_C
# CORE_DEPS
for mod in $modules
do
echo "extern ngx_module_t $mod;" >> $NGX_MODULES_C
done
if [ $MAKE_SL = YES ]; then
echo $ngx_n "CORE_DEPS =" $ngx_c >> $MAKEFILE
else
echo "CORE_DEPS = \\" >> $MAKEFILE
fi
echo >> $NGX_MODULES_C
echo 'ngx_module_t *ngx_modules[] = {' >> $NGX_MODULES_C
for mod in $modules
do
echo " &$mod," >> $NGX_MODULES_C
done
echo " NULL" >> $NGX_MODULES_C
echo "};" >> $NGX_MODULES_C
echo "CC = $CC" > $MAKEFILE
echo "CFLAGS = $CFLAGS" >> $MAKEFILE
echo >> $MAKEFILE
echo "CORE_DEPS = \\" >> $MAKEFILE
for dep in $CORE_DEPS
do
if [ $PLATFORM = win32 ]; then
if [ $MAKE_BS = YES ]; then
dep=`echo $dep | sed -e "s/\//\\\\\\/g"`
fi
echo " $dep \\" >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $dep" $ngx_c >> $MAKEFILE
else
echo " $dep \\" >> $MAKEFILE
fi
done
echo >> $MAKEFILE
echo >> $MAKEFILE
# CORE_INCS
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
inc="$CORE_INCS -I $OBJS"
if [ $PLATFORM = win32 ]; then
if [ $INC_EQ = YES ]; then
inc=`echo $inc | sed -e "s/-I /-i=/g"`
fi
if [ $MAKE_BS = YES ]; then
inc=`echo $inc | sed -e "s/\//\\\\\\/g"`
fi
echo "CORE_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
echo "HTTP_DEPS = \\" >> $MAKEFILE
for inc in $HTTP_DEPS
echo "CORE_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
# HTTP_DEPS
if [ $MAKE_SL = YES ]; then
echo $ngx_n "HTTP_DEPS =" $ngx_c >> $MAKEFILE
else
echo "HTTP_DEPS = \\" >> $MAKEFILE
fi
for dep in $HTTP_DEPS
do
if [ $PLATFORM = win32 ]; then
inc=`echo $inc | sed -e "s/\//\\\\\\/g"`
if [ $MAKE_BS = YES ]; then
dep=`echo $dep | sed -e "s/\//\\\\\\/g"`
fi
echo " $inc \\" >> $MAKEFILE
done
echo >> $MAKEFILE
inc="$HTTP_INCS"
if [ $PLATFORM = win32 ]; then
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $dep" $ngx_c >> $MAKEFILE
else
echo " $dep \\" >> $MAKEFILE
fi
done
echo >> $MAKEFILE
# HTTP_INCS
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
inc="$HTTP_INCS -I $OBJS"
if [ $INC_EQ = YES ]; then
inc=`echo $inc | sed -e "s/-I /-i=/g"`
fi
if [ $MAKE_BS = YES ]; then
inc=`echo $inc | sed -e "s/\//\\\\\\/g"`
fi
echo "HTTP_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
echo "HTTP_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
# nginx
echo "nginx: \\" >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo $ngx_n "nginx: " $ngx_c >> $MAKEFILE
else
echo "nginx: \\" >> $MAKEFILE
fi
# nginx deps
for src in $CORE_SRCS $HTTP_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
obj="$OBJS/$obj"
if [ $PLATFORM = win32 ]; then
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
fi
echo " $obj \\" >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $obj" $ngx_c >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
fi
done
for src in $NGX_MODULES_C $LINK_DEPS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
if [ $PLATFORM = win32 ]; then
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
fi
echo " $obj \\" >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $obj" $ngx_c >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
fi
done
echo >> $MAKEFILE
echo >> $MAKEFILE
echo " \$(CC) ${BINOUT}nginx \\" >> $MAKEFILE
# nginx build
if [ $MAKE_SL = YES ]; then
echo $ngx_n " \$(CC) ${BINOUT}nginx" $ngx_c >> $MAKEFILE
else
echo " \$(CC) ${BINOUT}nginx \\" >> $MAKEFILE
fi
# nginx build sources
for src in $CORE_SRCS $HTTP_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
obj="$OBJS/$obj"
if [ $PLATFORM = win32 ]; then
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
fi
echo " $obj \\" >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $obj," $ngx_c >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
fi
done
obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/"`
if [ $PLATFORM = win32 ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
fi
echo " $obj \\" >> $MAKEFILE
echo " $CORE_LIBS \\" >> $MAKEFILE
echo " $CORE_LINK" >> $MAKEFILE
echo >> $MAKEFILE
# nginx build ngx_modules.c and libs
obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/"`
libs=`echo $CORE_LIBS | sed -e "s/\.c\$/.$OBJEXT/"`
src=$NGX_MODULES_C
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
src=`echo $src | sed -e "s/\//\\\\\\/g"`
libs=`echo $libs | sed -e "s/\//\\\\\\/g"`
fi
if [ $MAKE_SL = YES ]; then
echo " $obj $libs $CORE_LINK" >> $MAKEFILE
echo >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
echo " $CORE_LIBS \\" >> $MAKEFILE
echo " $CORE_LINK" >> $MAKEFILE
echo >> $MAKEFILE
fi
# ngx_modules.c
deps="\$(CORE_DEPS)"
args="\$(CFLAGS) \$(CORE_INCS)"
echo "$obj: \\" >> $MAKEFILE
echo " $NGX_MODULES_C $deps" >> $MAKEFILE
echo " \$(CC) -c $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $NGX_MODULES_C" >> $MAKEFILE
echo >> $MAKEFILE
if [ $MAKE_SL = YES ]; then
echo "$obj: $NGX_MODULES_C $deps" >> $MAKEFILE
echo $ngx_n " \$(CC) $COMPILEONLY $args" $ngx_c >> $MAKEFILE
echo " $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $NGX_MODULES_C $deps" >> $MAKEFILE
echo " \$(CC) $COMPILEONLY $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
# core sources
for src in $CORE_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
obj="$OBJS/$obj"
echo "$OBJS/$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) -c $args \\" >> $MAKEFILE
echo " $OBJOUT$OBJS/$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
src=`echo $src | sed -e "s/\//\\\\\\/g"`
fi
if [ $MAKE_SL = YES ]; then
echo "$obj: $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPILEONLY $args $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPILEONLY $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
done
# http sources
deps="\$(CORE_DEPS) \$(HTTP_DEPS)"
args="\$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
for src in $HTTP_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
obj="$OBJS/$obj"
echo "$OBJS/$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) -c $args \\" >> $MAKEFILE
echo " $OBJOUT$OBJS/$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
if [ $MAKE_BS = YES ]; then
obj=`echo $obj | sed -e "s/\//\\\\\\/g"`
src=`echo $src | sed -e "s/\//\\\\\\/g"`
fi
if [ $MAKE_SL = YES ]; then
echo "$obj: $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPILEONLY $args $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPILEONLY $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
done

View File

@ -78,3 +78,28 @@ if [ $HTTP_PROXY = YES ]; then
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"
echo "#include <ngx_config.h>" > $NGX_MODULES_C
echo "#include <ngx_core.h>" >> $NGX_MODULES_C
echo >> $NGX_MODULES_C
for mod in $modules
do
echo "extern ngx_module_t $mod;" >> $NGX_MODULES_C
done
echo >> $NGX_MODULES_C
echo 'ngx_module_t *ngx_modules[] = {' >> $NGX_MODULES_C
for mod in $modules
do
echo " &$mod," >> $NGX_MODULES_C
done
echo " NULL" >> $NGX_MODULES_C
echo "};" >> $NGX_MODULES_C

View File

@ -164,7 +164,7 @@ static ngx_int_t ngx_iocp_process_events(ngx_log_t *log)
{
int rc;
u_int key;
size_t bytes;
u_long bytes;
ngx_err_t err;
ngx_msec_t timer;
ngx_event_t *ev;

View File

@ -122,11 +122,13 @@ struct ngx_event_s {
* write: available space in buffer when event is ready
* or lowat when event is set with NGX_LOWAT_EVENT flag
*
* iocp: TODO
*
* otherwise:
* accept: 1 if accept many, 0 otherwise
*/
#if (HAVE_KQUEUE)
#if (HAVE_KQUEUE) || (HAVE_IOCP)
int available;
#else
unsigned short available:1;

View File

@ -58,8 +58,8 @@ void ngx_event_acceptex(ngx_event_t *rev)
int ngx_event_post_acceptex(ngx_listening_t *ls, int n)
{
int i;
u_int rcvd;
u_long rcvd;
ngx_int_t i;
ngx_err_t err;
ngx_event_t *rev, *wev;
ngx_socket_t s;

View File

@ -129,7 +129,7 @@ int ngx_http_log_handler(ngx_http_request_t *r)
ngx_http_log_op_t *op;
ngx_http_log_loc_conf_t *lcf;
#if (WIN32)
u_int written;
u_long written;
#endif
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,

View File

@ -5,8 +5,8 @@
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
{
size_t n;
long high_offset;
DWORD n;
ngx_err_t err;
OVERLAPPED ovlp, *povlp;
@ -67,8 +67,8 @@ ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
ssize_t ngx_write_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
{
size_t n;
long high_offset;
DWORD n;
ngx_err_t err;
OVERLAPPED ovlp, *povlp;

View File

@ -3,7 +3,7 @@
#include <ngx_core.h>
ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx)
{
return /* STUB */ 0;
}

View File

@ -7,6 +7,10 @@
#define STRICT
#define WIN32_LEAN_AND_MEAN
#ifdef __WATCOMC__
#pragma disable_message(107)
#endif
/*
* we need to include windows.h explicity before winsock2.h because
* warning 4201 is enabled in windows.h
@ -34,6 +38,17 @@
#pragma warning(disable:4127)
#endif
#ifdef __WATCOMC__
#pragma enable_message(107)
#if 0
/* Symbol 'ngx_rbtree_min' has been defined, but not referenced */
#pragma disable_message(202)
#endif
/* No prototype found for 'stricmp' */
#pragma disable_message(301)
#endif
#include <ngx_auto_config.h>

View File

@ -7,8 +7,7 @@
ssize_t ngx_wsarecv(ngx_connection_t *c, char *buf, size_t size)
{
int rc;
u_int flags;
size_t bytes;
u_long bytes, flags;
WSABUF wsabuf[1];
ngx_err_t err;
ngx_event_t *rev;
@ -56,8 +55,7 @@ ssize_t ngx_wsarecv(ngx_connection_t *c, char *buf, size_t size)
ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, char *buf, size_t size)
{
int rc;
u_int flags;
size_t bytes;
u_long bytes, flags;
WSABUF wsabuf[1];
ngx_err_t err;
ngx_event_t *rev;

View File

@ -8,8 +8,8 @@ ssize_t ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain)
{
int rc;
char *prev;
u_int flags;
size_t bytes, size;
u_long bytes, flags;
size_t size;
WSABUF *wsabuf;
ngx_err_t err;
ngx_array_t io;

View File

@ -8,7 +8,8 @@ ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
{
int rc;
char *prev;
size_t size, sent;
size_t size;
u_long sent;
LPWSABUF wsabuf;
ngx_err_t err;
ngx_event_t *wev;
@ -102,7 +103,8 @@ ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
{
int rc;
char *prev;
size_t size, sent;
size_t size;
u_long sent;
LPWSABUF wsabuf;
ngx_err_t err;
ngx_event_t *wev;