Skip to content

Commit

Permalink
nginx-0.0.2-2004-02-09-10:46:43 import
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsysoev committed Feb 9, 2004
1 parent 9260294 commit 7af6b16
Show file tree
Hide file tree
Showing 32 changed files with 302 additions and 246 deletions.
5 changes: 5 additions & 0 deletions auto/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
. auto/init
. auto/sources

test $OBJ || mkdir $OBJ
echo > $NGX_AUTO_CONFIG_H

if [ "$PLATFORM" != win32 ]; then
. auto/headers
fi

. auto/os/conf
. auto/modules

Expand Down
12 changes: 7 additions & 5 deletions auto/fmt/xfmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

echo "#ifndef $ngx_fmt_name" >> $NGX_AUTO_CONFIG_H
echo "#define $ngx_fmt_name \"$ngx_fmt\"" | sed -e 's/d"$/x"/' \
>> $NGX_AUTO_CONFIG_H
echo "#endif" >> $NGX_AUTO_CONFIG_H
echo >> $NGX_AUTO_CONFIG_H
cat << END | sed -e 's/d"$/x"/' >> $NGX_AUTO_CONFIG_H

#ifndef $ngx_fmt_name
#define $ngx_fmt_name "$ngx_fmt"
#endif

END
10 changes: 1 addition & 9 deletions auto/func
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ eval "$CC $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_func_libs \

if [ -x $NGX_AUTOTEST ]; then
echo " found"

cat << END >> $NGX_AUTO_CONFIG_H

#ifndef HAVE_$func
#define HAVE_$func 1
#endif

END

have=HAVE_$func . auto/have
ngx_found=yes

else
Expand Down
3 changes: 3 additions & 0 deletions auto/headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

ngx_inc="unistd.h"; . auto/inc
ngx_inc="inttypes.h"; . auto/inc
10 changes: 1 addition & 9 deletions auto/inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"

if [ -x $NGX_AUTOTEST ]; then
echo " found"

cat << END >> $NGX_AUTO_CONFIG_H

#ifndef HAVE_$inc
#define HAVE_$inc 1
#endif

END

have=HAVE_$inc . auto/have
eval "NGX_$inc='#include <$ngx_inc>'"
ngx_found=yes

Expand Down
4 changes: 3 additions & 1 deletion auto/lib/md5/conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if [ $MD5 != NO ]; then
if [ $MD5 != NONE ]; then

if grep MD5_Init $MD5/md5.h >/dev/null; then
# OpenSSL md5
Expand All @@ -25,6 +25,8 @@ else
ngx_lib_inc="#include <sys/types.h>
#include <md5.h>"

MD5=NO

# Solaris 8/9
ngx_lib="rsaref md5"
ngx_lib_test="MD5_CTX md5; MD5Init(&md5)"
Expand Down
4 changes: 3 additions & 1 deletion auto/lib/zlib/conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if [ $ZLIB != NO ]; then
if [ $ZLIB != NONE ]; then
CORE_INCS="$CORE_INCS -I $ZLIB"

if [ "$PLATFORM" = "win32" ]; then
Expand All @@ -23,6 +23,8 @@ else
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_libs"
ZLIB=YES
else
ZLIB=NO
fi

fi
6 changes: 2 additions & 4 deletions auto/options
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ HTTP_PROXY=YES
PCRE=NO

USE_MD5=NO
MD5=NO
MD5_LIB=NO
MD5=NONE

USE_ZLIB=NO
ZLIB=NO
ZLIB_LIB=NO
ZLIB=NONE


for option
Expand Down
3 changes: 0 additions & 3 deletions auto/os/freebsd
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@


CORE_INCS="$UNIX_INCS"
CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"

MD5_LIB="-lmd"
ZLIB_LIB="-lz"

version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
| sed -e 's/^.* \(.*\)$/\1/'`
Expand Down
16 changes: 11 additions & 5 deletions auto/os/linux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CORE_DEPS="$UNIX_DEPS $LINUX_DEPS"
CORE_SRCS="$UNIX_SRCS $LINUX_SRCS"
EVENT_MODULES="$EVENT_MODULES"

ZLIB_LIB="-lz"

CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"

Expand All @@ -13,15 +12,15 @@ CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"

ngx_func="epoll";
ngx_func_inc="#include <sys/epoll.h>"
ngx_func_test="int fd = 1; int n;
ngx_func_test="int efd = 0, fd = 1, 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"
have=HAVE_EPOLL . auto/have
CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
EVENT_FOUND=YES
Expand All @@ -39,7 +38,6 @@ ngx_func_test="int s = 0, fd = 1;
. auto/func

if [ $ngx_found = yes ]; then
CFLAGS="$CFLAGS -D HAVE_SENDFILE=1"
CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
fi

Expand All @@ -49,6 +47,14 @@ fi
CC_TEST_FLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
ngx_func="sendfile64()"; . auto/func


# prctl(PR_SET_DUMPABLE)

ngx_func="prctl()";
ngx_func_inc="#include <sys/prctl.h>"
ngx_func_test="prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)"
. auto/func

if [ $ngx_found = yes ]; then
CFLAGS="$CFLAGS -D HAVE_SENDFILE64=1"
have=HAVE_PR_SET_DUMPABLE . auto/have
fi
9 changes: 4 additions & 5 deletions auto/os/solaris
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ CORE_DEPS="$UNIX_DEPS $SOLARIS_DEPS"
CORE_SRCS="$UNIX_SRCS $SOLARIS_SRCS "
EVENT_MODULES="$EVENT_MODULES"

MD5_LIB="-lmd5"
ZLIB_LIB="-lz"
CORE_LIBS="$CORE_LIBS -lsocket -lnsl"


CC_TEST_FLAGS="-D_FILE_OFFSET_BITS=64"


ngx_inc="sys/devpoll.h"; . auto/inc

if [ $ngx_found = yes ]; then
CFLAGS="$CFLAGS -D HAVE_DEVPOLL=1"
have=HAVE_DEVPOLL . auto/have
CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
EVENT_FOUND=YES
Expand All @@ -25,13 +24,13 @@ 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;
size_t sent; ssize_t n;
n = sendfilev(fd, vec, 1, &sent)"
. auto/func


if [ $ngx_found = yes ]; then
CFLAGS="$CFLAGS -D HAVE_SENDFILE=1"
have=HAVE_SENDFILE . auto/have
CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS"
CORE_LIBS="$CORE_LIBS -lsendfile"
fi
21 changes: 12 additions & 9 deletions auto/summary
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ echo
echo "Configuration summary"

case $PCRE in
YES) echo " + using system PCRE library" ;;
NO) echo " + PCRE library is not found" ;;
*) echo " + using PCRE library: $PCRE" ;;
YES) echo " + using system PCRE library" ;;
NONE) echo " + PCRE library is not used" ;;
NO) echo " + PCRE library is not found" ;;
*) echo " + using PCRE library: $PCRE" ;;
esac

case $MD5 in
YES) echo " + using system md5 library" ;;
NO) echo " + md5 library is not found" ;;
*) echo " + using md5 library: $MD5" ;;
YES) echo " + using system md5 library" ;;
NONE) echo " + md5 library is not used" ;;
NO) echo " + md5 library is not found" ;;
*) echo " + using md5 library: $MD5" ;;
esac

case $ZLIB in
YES) echo " + using system zlib library" ;;
NO) echo " + zlib library is not found" ;;
*) echo " + using zlib library: $ZLIB" ;;
YES) echo " + using system zlib library" ;;
NONE) echo " + zlib library is not used" ;;
NO) echo " + zlib library is not found" ;;
*) echo " + using zlib library: $ZLIB" ;;
esac

echo
30 changes: 15 additions & 15 deletions auto/unix
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ ngx_formats="%lld %qd"; . auto/fmt/fmt
ngx_type="void *"; . auto/types/sizeof; ngx_ptr_bytes=$ngx_bytes


# headers

ngx_inc="unistd.h"; . auto/inc
ngx_inc="inttypes.h"; . auto/inc

#POSIX types
# POSIX types

NGX_AUTO_CONFIG="#include \"../$NGX_AUTO_CONFIG_H\""

Expand All @@ -43,6 +38,15 @@ ngx_types="int"; . auto/types/typedef
. auto/types/uintptr_t


ngx_func="sin_len"
ngx_func_inc="#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>"

ngx_func_test="struct sockaddr_in sa; sa.sin_len = 5"
. auto/func


# printf() formats

CC_WARN=$CC_STRONG
Expand Down Expand Up @@ -70,19 +74,15 @@ eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt

ngx_func="pread()"
ngx_func_inc=
ngx_func_test="
char buf[1];
ssize_t n;
n = pread(0, buf, 1, 0)"
ngx_func_test="char buf[1]; ssize_t n;
n = pread(0, buf, 1, 0)"
. auto/func


ngx_func="pwrite()"
ngx_func_inc=
ngx_func_test="
char buf[1];
ssize_t n;
n = pwrite(1, buf, 1, 0)"
ngx_func_test="char buf[1]; ssize_t n;
n = pwrite(1, buf, 1, 0)"
. auto/func


Expand All @@ -94,7 +94,7 @@ n = pwrite(1, buf, 1, 0)"

ngx_func="strerror_r()"
ngx_func_inc="#include <string.h>"
ngx_func_test="char buf[20]; strerror_r(1, buf, 20)"
ngx_func_test="char buf[20]; int n; n = strerror_r(1, buf, 20)"
. auto/func


Expand Down
18 changes: 16 additions & 2 deletions src/core/nginx.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
"can not respawn %s",
ngx_processes[i].name);
continue;
}

live = 1;

continue;
}

Expand Down Expand Up @@ -443,7 +446,7 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)

if (ngx_reopen) {
if (ngx_process == NGX_PROCESS_MASTER) {
if (ccf->worker_reopen > 0) {
if (ccf->worker_reopen != 0) {
signo = ngx_signal_value(NGX_REOPEN_SIGNAL);
ngx_reopen = 0;

Expand All @@ -461,7 +464,7 @@ static void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
"reopening logs");
ngx_reopen_files(cycle,
ccf->worker_reopen > 0 ? ccf->user : -1);
ccf->worker_reopen != 0 ? ccf->user : (uid_t) -1);
}
}

Expand Down Expand Up @@ -574,6 +577,17 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
}
}

#if (HAVE_PR_SET_DUMPABLE)

/* allow coredump after setuid() in Linux 2.4.x */

if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"prctl(PR_SET_DUMPABLE) failed");
}

#endif

sigemptyset(&set);

if (sigprocmask(SIG_SETMASK, &set, NULL) == -1) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/ngx_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _NGX_CONFIG_H_INCLUDED_


#if 1
#if 0
/* STUB to allocate a big ngx_connections */
#undef FD_SETSIZE
#define FD_SETSIZE 5000
Expand Down
Loading

0 comments on commit 7af6b16

Please sign in to comment.