nginx/src/os/unix/ngx_socket.c
Igor Sysoev c15717285d nginx-0.1.25-RELEASE import
*) Bugfix: nginx did run on Linux parisc.

    *) Feature: nginx now does not start under FreeBSD if the sysctl
       kern.ipc.somaxconn value is too big.

    *) Bugfix: if a request was internally redirected by the
       ngx_http_index_module module to the ngx_http_proxy_module or
       ngx_http_fastcgi_module modules, then the index file was not closed
       after request completion.

    *) Feature: the "proxy_pass" can be used in location with regular
       expression.

    *) Feature: the ngx_http_rewrite_filter_module module supports the
       condition like "if ($HTTP_USER_AGENT ~ MSIE)".

    *) Bugfix: nginx started too slow if the large number of addresses and
       text values were used in the "geo" directive.

    *) Change: a variable name must be declared as "$name" in the "geo"
       directive. The previous variant without "$" is still supported, but
       will be removed soon.

    *) Feature: the "%{VARIABLE}v" logging parameter.

    *) Feature: the "set $name value" directive.

    *) Bugfix: gcc 4.0 compatibility.

    *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
2005-03-19 12:38:37 +00:00

113 lines
1.5 KiB
C

/*
* Copyright (C) Igor Sysoev
*/
#include <ngx_config.h>
#include <ngx_core.h>
/*
* ioctl(FIONBIO) sets a blocking mode with the single syscall
* while fcntl(F_SETFL, ~O_NONBLOCK) needs to learn before
* the previous state using fcntl(F_GETFL).
*
* ioctl() and fcntl() are syscalls on at least FreeBSD 2.x, Linux 2.2
* and Solaris 7.
*
* ioctl() in Linux 2.4 and 2.6 uses BKL, however, fcntl(F_SETFL) uses it too.
*/
#if (NGX_HAVE_FIONBIO)
int
ngx_nonblocking(ngx_socket_t s)
{
u_long nb;
nb = 1;
return ioctl(s, FIONBIO, &nb);
}
int
ngx_blocking(ngx_socket_t s)
{
u_long nb;
nb = 0;
return ioctl(s, FIONBIO, &nb);
}
#endif
#if (NGX_FREEBSD)
int
ngx_tcp_nopush(ngx_socket_t s)
{
int tcp_nopush;
tcp_nopush = 1;
return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH,
(const void *) &tcp_nopush, sizeof(int));
}
int
ngx_tcp_push(ngx_socket_t s)
{
int tcp_nopush;
tcp_nopush = 0;
return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH,
(const void *) &tcp_nopush, sizeof(int));
}
#elif (NGX_LINUX)
int
ngx_tcp_nopush(ngx_socket_t s)
{
int cork;
cork = 1;
return setsockopt(s, IPPROTO_TCP, TCP_CORK,
(const void *) &cork, sizeof(int));
}
int
ngx_tcp_push(ngx_socket_t s)
{
int cork;
cork = 0;
return setsockopt(s, IPPROTO_TCP, TCP_CORK,
(const void *) &cork, sizeof(int));
}
#else
int
ngx_tcp_nopush(ngx_socket_t s)
{
return 0;
}
int
ngx_tcp_push(ngx_socket_t s)
{
return 0;
}
#endif