Preliminary changes for Minix3.

This commit is contained in:
Nicholas Heath 2013-02-03 19:08:37 +00:00 committed by Nick Mathewson
parent 42aaf4dcf7
commit 0dda56a48e
4 changed files with 16 additions and 4 deletions

View File

@ -679,6 +679,14 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct s
#endif
])
AC_CHECK_TYPES([struct so_linger],
[#define HAVE_SO_LINGER], ,
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
AC_MSG_CHECKING([for socklen_t])
AC_TRY_COMPILE([
#include <sys/types.h>

View File

@ -125,7 +125,7 @@ run_once(void)
int
main(int argc, char **argv)
{
#ifndef _WIN32
#ifdef HAVE_SETRLIMIT
struct rlimit rl;
#endif
int i, c;
@ -156,7 +156,7 @@ main(int argc, char **argv)
}
}
#ifndef _WIN32
#ifdef HAVE_SETRLIMIT
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");

View File

@ -139,7 +139,7 @@ run_once(int num_pipes)
int
main(int argc, char **argv)
{
#ifndef _WIN32
#ifdef HAVE_SETRLIMIT
struct rlimit rl;
#endif
int i, c;
@ -157,7 +157,7 @@ main(int argc, char **argv)
}
}
#ifndef _WIN32
#ifdef HAVE_SETRLIMIT
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");

View File

@ -113,14 +113,18 @@ errorcb(struct bufferevent *b, short what, void *arg)
static void
frob_socket(evutil_socket_t sock)
{
#ifdef HAVE_SO_LINGER
struct linger l;
#endif
int one = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one))<0)
perror("setsockopt(SO_REUSEADDR)");
#ifdef HAVE_SO_LINGER
l.l_onoff = 1;
l.l_linger = 0;
if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&l, sizeof(l))<0)
perror("setsockopt(SO_LINGER)");
#endif
}
static int