]> granicus.if.org Git - libevent/commitdiff
Allow compilation on machines that do not have setrlimit.
authorRoss Lagerwall <rosslagerwall@gmail.com>
Sat, 25 Feb 2012 05:36:49 +0000 (07:36 +0200)
committerRoss Lagerwall <rosslagerwall@gmail.com>
Sat, 25 Feb 2012 05:36:49 +0000 (07:36 +0200)
configure.in
test/test-fdleak.c

index fce6ff52a9f198e3cbb25a41fd700fa145159584..d16caec5326073f00325c6baf1a4c3d29631fd43 100644 (file)
@@ -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 \
index bb8e1685ebbbb067fd79e801ced117d85571c1d8..5572b04c17d4ff11a03f24d5488172f241d994e5 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "event2/event-config.h"
+
 #include <string.h>
 #include <stdlib.h>
+#ifdef _EVENT_HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#ifdef _EVENT_HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
+#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));