Fix filestuff.c build error if RLIMIT_NOFILE not defined.
authorJoel Brobecker <brobecker@adacore.com>
Sun, 17 Nov 2013 03:50:09 +0000 (22:50 -0500)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 2 Dec 2013 03:14:10 +0000 (07:14 +0400)
Not all systems supporting getrlimit also support RLIMIT_NOFILE
(Eg. All LynxOS systems appear to be lacking support for this).
So check its existance before using it.

gdb/ChangeLog:

        * common/filestuff.c (fdwalk): Add "defined(RLIMIT_NOFILE)"
        preprocessor check.

gdb/ChangeLog
gdb/common/filestuff.c

index a328d06106609783017c3db7848f4b20d0b8fea4..62abbaca43f2787dca25f387db0ff883df301522 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-02  Joel Brobecker  <brobecker@adacore.com>
+
+       * common/filestuff.c (fdwalk): Add "defined(RLIMIT_NOFILE)"
+       preprocessor check.
+
 2013-12-02  Joel Brobecker  <brobecker@adacore.com>
 
        * Makefile.in (HFILES_NO_SRCDIR): Remove "common/gdb_dirent.h".
index 2792d59fd8bc5b5b6c74c338d1add8bd147e4fa8..b884c02d1c500126428bfd16d26c5a5e6fe60e36 100644 (file)
@@ -115,7 +115,7 @@ fdwalk (int (*func) (void *, int), void *arg)
   {
     int max, fd;
 
-#ifdef HAVE_GETRLIMIT
+#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
     struct rlimit rlim;
 
     if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && rlim.rlim_max != RLIM_INFINITY)