* [RFA/commit] Fix filestuff.c build error if RLIMIT_NOFILE not defined.
@ 2013-11-26 9:39 Joel Brobecker
2013-11-27 17:23 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2013-11-26 9:39 UTC (permalink / raw)
To: gdb-patches
Hello,
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.
Tested on x86_64-linux. With the LynxOS gdbservers, we get the same
results back when using the AdaCore testsuite.
Bordering on the obvious, I decided for an RFA, just in case, because
it relies on RLIMIT_NOFILE always being a marcro, POSIX does not seem
to require it. It seems to be true in practice, though, for all systems
I checked (Various flavors of GNU/Linux, including embedded ones,
Solaris, AIX, Lynx, etc).
OK to commit?
Thanks,
--
Joel
---
gdb/common/filestuff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index 2792d59..b884c02 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -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)
--
1.8.1.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA/commit] Fix filestuff.c build error if RLIMIT_NOFILE not defined.
2013-11-26 9:39 [RFA/commit] Fix filestuff.c build error if RLIMIT_NOFILE not defined Joel Brobecker
@ 2013-11-27 17:23 ` Tom Tromey
2013-12-02 3:17 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2013-11-27 17:23 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Bordering on the obvious, I decided for an RFA, just in case, because
Joel> it relies on RLIMIT_NOFILE always being a marcro, POSIX does not seem
Joel> to require it. It seems to be true in practice, though, for all systems
Joel> I checked (Various flavors of GNU/Linux, including embedded ones,
Joel> Solaris, AIX, Lynx, etc).
It seems relatively ok to me.
To really fail the system would have to lack this #define and also lack
sysconf + _SC_OPEN_MAX. And then the failure mode is just that gdb
works the way it always did in the past.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA/commit] Fix filestuff.c build error if RLIMIT_NOFILE not defined.
2013-11-27 17:23 ` Tom Tromey
@ 2013-12-02 3:17 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2013-12-02 3:17 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Joel> Bordering on the obvious, I decided for an RFA, just in case, because
> Joel> it relies on RLIMIT_NOFILE always being a marcro, POSIX does not seem
> Joel> to require it. It seems to be true in practice, though, for all systems
> Joel> I checked (Various flavors of GNU/Linux, including embedded ones,
> Joel> Solaris, AIX, Lynx, etc).
>
> It seems relatively ok to me.
> To really fail the system would have to lack this #define and also lack
> sysconf + _SC_OPEN_MAX. And then the failure mode is just that gdb
> works the way it always did in the past.
Makes sense. Patch now pushed.
Thanks, Tom.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-02 3:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26 9:39 [RFA/commit] Fix filestuff.c build error if RLIMIT_NOFILE not defined Joel Brobecker
2013-11-27 17:23 ` Tom Tromey
2013-12-02 3:17 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).