nginx-0.0.1-2003-11-20-10:05:50 import; auto/configure

This commit is contained in:
Igor Sysoev 2003-11-20 07:05:50 +00:00
parent 160d774afc
commit bb6ec8c9fd
10 changed files with 183 additions and 103 deletions

12
auto/configure vendored Executable file
View File

@ -0,0 +1,12 @@
CC=cc
CPP='cc -E'
echo > ngx_auto_config.h
. auto/types/time_t
. auto/types/uint64_t
. auto/types/uintptr_t
. auto/types/socklen_t

28
auto/types/socklen_t Normal file
View File

@ -0,0 +1,28 @@
found=0
echo 'Checking for socklen_t'
echo '#include <sys/types.h>' > autotest.c
echo '#include <sys/socket.h>' >> autotest.c
echo 'int main() { socklen_t i = 0; return 0; }' >> autotest.c
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
if [ -x autotest ]; then
echo ' + socklen_t found'
found=1
else
echo ' + socklen_t not found'
echo ' + uint32_t used'
type='typedef uint32_t socklen_t;'
found=2
fi
rm autotest*
if [ $found = 2 ]; then
echo $type >> ngx_auto_config.h
echo >> ngx_auto_config.h
fi

30
auto/types/time_t Normal file
View File

@ -0,0 +1,30 @@
echo "Checking for printf() time_t format"
echo '#include <sys/types.h>' > autotest.c
type=`${CPP} autotest.c | awk '/^typedef.*time_t/ {print \$2}'`
rm autotest.c
case $type in
long)
echo ' + long: "%ld" used'
fmt='"%ld"'
;;
int)
echo ' + int: "%d" used'
fmt='"%d"'
;;
*)
echo "$0: error: unknown time_t definition: \"$type\""
exit 1
;;
esac
echo "#ifndef TIME_FMT" >> ngx_auto_config.h
echo "#define TIME_FMT $fmt" >> ngx_auto_config.h
echo "#endif" >> ngx_auto_config.h
echo >> ngx_auto_config.h

50
auto/types/uint64_t Normal file
View File

@ -0,0 +1,50 @@
found=0
echo 'Checking for uint64_t'
echo '#include <sys/types.h>' > autotest.c
echo 'int main() { uint64_t i = 0; return 0; }' >> autotest.c
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
if [ -x autotest ]; then
echo ' + uint64_t found'
found=1
else
echo ' + uint64_t not found'
fi
rm autotest*
if [ $found = 0 ]; then
echo '#include <sys/types.h>' > autotest.c
echo 'int main() { u_int64_t i = 0; return 0; }' >> autotest.c
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
if [ -x autotest ]; then
echo ' + u_int64_t used'
type='typedef u_int64_t uint64_t;'
found=2
else
echo ' + u_int64_t not found'
fi
rm autotest*
fi
if [ $found = 0 ]; then
echo "$0: error: uint64_t not found"
exit 1
fi
if [ $found = 2 ]; then
echo $type >> ngx_auto_config.h
echo >> ngx_auto_config.h
fi

45
auto/types/uintptr_t Normal file
View File

@ -0,0 +1,45 @@
found=0
echo 'Checking for uintptr_t'
echo '#include <sys/types.h>' > autotest.c
echo 'int main() { uintptr_t i = 0; return i; }' >> autotest.c
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
if [ -x autotest ]; then
echo ' + uintptr_t found'
found=1
else
echo ' + uintptr_t not found'
fi
rm autotest*
if [ $found = 0 ]; then
echo 'int main() { printf("%d", 8 * sizeof(void *)); return 0; }' \
> autotest.c
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
if [ -x autotest ]; then
type="uint`./autotest`_t"
echo " + $type used"
type="typedef $type uintptr_t;"
found=2
fi
fi
if [ $found = 0 ]; then
echo "$0: error: uintptr_t not found"
exit 1
fi
if [ $found = 2 ]; then
echo $type >> ngx_auto_config.h
echo >> ngx_auto_config.h
fi

View File

@ -1,7 +0,0 @@
#ifndef OFF_EQUAL_PTR
#define OFF_EQUAL_PTR 0
#endif
#define NGX_PAGE_SIZE 4096

View File

@ -62,9 +62,6 @@ struct ngx_connection_s {
off_t sent;
#if 0
void (*handler)(ngx_connection_t *c);
#endif
void *ctx;
void *servers;
@ -72,11 +69,6 @@ struct ngx_connection_s {
ngx_log_t *log;
ngx_pool_t *pool;
#if 0
int pool_size;
int family;
#endif
struct sockaddr *sockaddr;
socklen_t socklen;
@ -87,15 +79,7 @@ struct ngx_connection_s {
socklen_t local_socklen;
#endif
#if 0
int addr;
int addr_text_max_len;
#endif
ngx_hunk_t *buffer;
#if 0
unsigned int post_accept_timeout;
#endif
int number;
@ -108,62 +92,7 @@ struct ngx_connection_s {
};
#if 0
cached file
int fd; -2 unused, -1 closed (but read or mmaped), >=0 open
char *name;
void *buf; addr if read or mmaped
aiocb* if aio_read
OVERLAPPED if TransmitFile or TransmitPackets
NULL if sendfile
size_t buf_size; for plain read
off_t offset; for plain read
size_t size;
time_t mod;
char *last_mod; "Sun, 17 Mar 2002 19:39:50 GMT"
char *etag; ""a6d08-1302-3c94f106""
char *len; "4866"
EV_VNODE should notify by some signal if diretory tree is changed
or stat if aged >= N seconds (big enough)
#endif
#if 0
typedef struct {
ssize_t (*recv)(ngx_connection_t *c, char *buf, size_t size);
void *dummy_recv_chain;
void *dummy_send;
ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in);
} ngx_os_io_t;
#endif
extern ngx_array_t ngx_listening_sockets;
extern ngx_os_io_t ngx_io;
extern ngx_chain_t *(*ngx_write_chain_proc)
(ngx_connection_t *c, ngx_chain_t *in);
ssize_t ngx_recv_chain(ngx_connection_t *c, ngx_chain_t *ce);
#if 0
ngx_chain_t *ngx_write_chain(ngx_connection_t *c, ngx_chain_t *in, off_t flush);
#endif
/* TODO: move it to OS specific file */
#if (__FreeBSD__)
ngx_chain_t *ngx_aio_write_chain(ngx_connection_t *c, ngx_chain_t *in);
#endif
#endif /* _NGX_CONNECTION_H_INCLUDED_ */

View File

@ -85,7 +85,7 @@ void ngx_event_accept(ngx_event_t *ev)
ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
"accept() on %s returned socket #%d while "
"only %d connections was configured, "
"sleeping for 1 second",
"closing the connection",
ls->listening->addr_text.data, s, ecf->connections);
if (ngx_close_socket(s) == -1) {
@ -93,7 +93,7 @@ void ngx_event_accept(ngx_event_t *ev)
ngx_close_socket_n "failed");
}
ngx_msleep(1000);
/* TODO: disable temporary accept() event */
ngx_destroy_pool(pool);
return;
@ -225,11 +225,9 @@ void ngx_event_accept(ngx_event_t *ev)
ls->listening->handler(c);
#if 0
if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
ev->available--;
}
#endif
accepted++;

View File

@ -157,7 +157,7 @@ ngx_log_debug(rev->log, "IN: %08x" _ in_port);
if (in_port->addrs.nelts > 1) {
/*
* there're the several addresses on this port and one of them
* There're the several addresses on this port and one of them
* is "*:port" so getsockname() is needed to determine
* the server address.
* AcceptEx() already gave this address.
@ -346,11 +346,13 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
r->request_line.len = r->request_end - r->request_start;
/* if the large client headers are enabled then
we need to copy a request line */
if (cscf->large_client_header) {
/*
* if the large client headers are enabled then
* we need to copy a request line
*/
r->request_line.data = ngx_palloc(r->pool, r->request_line.len + 1);
if (r->request_line.data == NULL) {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@ -366,9 +368,11 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
r->request_line.data[r->request_line.len] = '\0';
}
/* copy URI extention if it exists */
if (r->uri_ext) {
/* copy URI extention */
if (r->args_start) {
r->exten.len = r->args_start - 1 - r->uri_ext;
} else {
@ -384,9 +388,10 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
ngx_cpystrn(r->exten.data, r->uri_ext, r->exten.len + 1);
}
/* copy URI arguments if they exist */
if (r->args_start && r->uri_end > r->args_start) {
/* copy URI arguments */
r->args.len = r->uri_end - r->args_start;
if (!(r->args.data = ngx_palloc(r->pool, r->args.len + 1))) {
@ -446,8 +451,8 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
/*
* If it's a pipelined request and a request line is not complete
* then we need to copy it to the start of the r->header_in hunk.
* We need to copy it here only if the large client headers
* then we have to copy it to the start of the r->header_in hunk.
* We have to copy it here only if the large client headers
* are enabled otherwise a request line had been already copied
* to the start of the r->header_in hunk in ngx_http_set_keepalive().
*/

View File

@ -27,18 +27,6 @@
#include <osreldate.h>
/* TODO: autoconf */
#if __FreeBSD_version < 300007
typedef u_int64_t uint64_t;
typedef u_int32_t uintptr_t;
#endif
/* TODO: autoconf ??? */
#if __FreeBSD_version < 330002 /* exactly */
typedef uint32_t socklen_t;
#endif
/* TODO: autoconf */
#if (i386)
@ -55,7 +43,9 @@ typedef uint32_t socklen_t;
#endif
#if 0
#define TIME_FMT "%ld"
#endif
#define PID_FMT "%d"
#define RLIM_FMT "%lld"