From 1c4288f4925b37909992ccac4bffff78eb2f260d Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Sat, 25 Feb 2012 07:36:49 +0200 Subject: [PATCH] Allow compilation on machines that do not have setrlimit. --- configure.in | 2 ++ test/test-fdleak.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index fce6ff52..d16caec5 100644 --- a/configure.in +++ b/configure.in @@ -206,6 +206,7 @@ AC_CHECK_HEADERS([ \ sys/mman.h \ sys/param.h \ sys/queue.h \ + sys/resource.h \ sys/select.h \ sys/sendfile.h \ sys/socket.h \ @@ -336,6 +337,7 @@ AC_CHECK_FUNCS([ \ putenv \ sendfile \ setenv \ + setrlimit \ sigaction \ signal \ splice \ diff --git a/test/test-fdleak.c b/test/test-fdleak.c index bb8e1685..5572b04c 100644 --- a/test/test-fdleak.c +++ b/test/test-fdleak.c @@ -24,12 +24,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "event2/event-config.h" + #include #include +#ifdef _EVENT_HAVE_SYS_TIME_H #include +#endif +#ifdef _EVENT_HAVE_SYS_RESOURCE_H #include +#endif -#include "event2/event-config.h" #include "event2/event.h" #include "event2/bufferevent.h" #include "event2/listener.h" @@ -181,6 +186,7 @@ start_client(struct event_base *base) int main(int argc, char **argv) { +#if !defined(_WIN32) && defined(_EVENT_HAVE_SETRLIMIT) /* Set the fd limit to a low value so that any fd leak is caught without making many requests. */ struct rlimit rl; @@ -189,6 +195,7 @@ main(int argc, char **argv) perror("setrlimit"); exit(3); } +#endif /* Set up an address, used by both client & server. */ memset(&sin, 0, sizeof(sin)); -- 2.40.0