nginx-0.0.7-2004-06-21-23:22:53 import

This commit is contained in:
Igor Sysoev 2004-06-21 19:22:53 +00:00
parent ef06648615
commit b14169a714
6 changed files with 59 additions and 12 deletions

10
auto/cc
View File

@ -7,7 +7,7 @@ case $CC in
# gcc 2.7.2.3, 2.8.1, 2.95.4,
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4
# optimization
# optimizations
#CFLAGS="$CFLAGS -O2 -fomit-frame-pointer"
case $CPU in
@ -92,7 +92,7 @@ case $CC in
*icc)
# Intel C++ compiler 7.1, 8.0
# optimization
# optimizations
CFLAGS="$CFLAGS -O"
# inline functions declared with __inline
#CFLAGS="$CFLAGS -Ob1"
@ -165,7 +165,7 @@ case $CC in
cl)
# MSVC 6.0 SP2
# optimization
# optimizations
# maximize speed
CFLAGS="$CFLAGS -O2"
@ -244,7 +244,7 @@ case $CC in
wcl386)
# Open Watcom C 1.0, 1.2
# optimization
# optimizations
# maximize speed
CFLAGS="$CFLAGS -ot"
@ -325,7 +325,7 @@ case $CC in
bcc32)
# Borland C++ 5.5
# optimization
# optimizations
# maximize speed
CFLAGS="$CFLAGS -O2"

View File

@ -0,0 +1,26 @@
void _spinlock(ngx_atomic_t *lock)
{
ngx_int_t tries;
tries = 0;
for ( ;; ) {
if (*lock) {
if (ngx_ncpu > 1 && tries++ < 1000) {
continue;
}
sched_yield();
tries = 0;
} else {
if (ngx_atomic_cmp_set(lock, 0, 1)) {
return;
}
}
}
}

View File

@ -162,7 +162,8 @@ ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
if (conf->limit_rate) {
sent = r->connection->sent - sent;
r->connection->write->delayed = 1;
ngx_add_timer(r->connection->write, sent * 1000 / conf->limit_rate);
ngx_add_timer(r->connection->write,
(ngx_msec_t) sent * 1000 / conf->limit_rate);
}
if (chain == NGX_CHAIN_ERROR) {

View File

@ -26,7 +26,8 @@ typedef struct {
ssize_t (*recv)(ngx_connection_t *c, u_char *buf, size_t size);
ssize_t (*recv_chain)(ngx_connection_t *c, ngx_chain_t *in);
ssize_t (*send)(ngx_connection_t *c, u_char *buf, size_t size);
ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in);
ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in,
off_t limit);
int flags;
} ngx_os_io_t;
@ -36,8 +37,10 @@ int ngx_os_init(ngx_log_t *log);
ssize_t ngx_wsarecv(ngx_connection_t *c, u_char *buf, size_t size);
ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, u_char *buf, size_t size);
ssize_t ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain);
ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in);
ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in);
ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit);
ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit);
extern ngx_os_io_t ngx_os_io;

View File

@ -30,16 +30,28 @@
/* disable some "-W4" level warnings */
#pragma warning(disable:4054)
/* disable warnings about some 'type cast */
#pragma warning(disable:4054)
#pragma warning(disable:4055)
/* unreferenced formal parameter */
#pragma warning(disable:4100)
/* conditional expression is constant */
#pragma warning(disable:4127)
/* nonstandard extension used : bit field types other than int */
#pragma warning(disable:4214)
/* unreachable code */
#pragma warning(disable:4702)
/* assignment within conditional expression */
#pragma warning(disable:4706)
/* disable "function 'ngx_handle_write_event' not inlined" */
#pragma warning(disable:4710)
#endif
@ -121,6 +133,9 @@ typedef uint32_t ngx_atomic_t;
#endif
#define OFF_T_MAX_VALUE 9223372036854775807
/* STUB */
#define HAVE_LITTLE_ENDIAN 1

View File

@ -4,7 +4,8 @@
#include <ngx_event.h>
ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit)
{
int rc;
u_char *prev;
@ -99,7 +100,8 @@ ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
}
ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit)
{
int rc;
u_char *prev;