* [PATCH] getdtablesize: Fix returning hard instead of soft rlimit @ 2016-08-13 18:31 Olivier Brunel 2016-08-13 19:25 ` Rich Felker 0 siblings, 1 reply; 4+ messages in thread From: Olivier Brunel @ 2016-08-13 18:31 UTC (permalink / raw) To: musl --- src/legacy/getdtablesize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c index 682da6d..b30c193 100644 --- a/src/legacy/getdtablesize.c +++ b/src/legacy/getdtablesize.c @@ -7,5 +7,5 @@ int getdtablesize(void) { struct rlimit rl; getrlimit(RLIMIT_NOFILE, &rl); - return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; + return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; } -- 2.9.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] getdtablesize: Fix returning hard instead of soft rlimit 2016-08-13 18:31 [PATCH] getdtablesize: Fix returning hard instead of soft rlimit Olivier Brunel @ 2016-08-13 19:25 ` Rich Felker 2016-08-13 19:36 ` Olivier Brunel 0 siblings, 1 reply; 4+ messages in thread From: Rich Felker @ 2016-08-13 19:25 UTC (permalink / raw) To: musl On Sat, Aug 13, 2016 at 08:31:49PM +0200, Olivier Brunel wrote: > --- > src/legacy/getdtablesize.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c > index 682da6d..b30c193 100644 > --- a/src/legacy/getdtablesize.c > +++ b/src/legacy/getdtablesize.c > @@ -7,5 +7,5 @@ int getdtablesize(void) > { > struct rlimit rl; > getrlimit(RLIMIT_NOFILE, &rl); > - return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; > + return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; Is there a motivation for this? Rich ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] getdtablesize: Fix returning hard instead of soft rlimit 2016-08-13 19:25 ` Rich Felker @ 2016-08-13 19:36 ` Olivier Brunel 2016-08-15 15:33 ` Rich Felker 0 siblings, 1 reply; 4+ messages in thread From: Olivier Brunel @ 2016-08-13 19:36 UTC (permalink / raw) To: musl On Sat, 13 Aug 2016 15:25:02 -0400 Rich Felker <dalias@libc.org> wrote: > On Sat, Aug 13, 2016 at 08:31:49PM +0200, Olivier Brunel wrote: > > --- > > src/legacy/getdtablesize.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c > > index 682da6d..b30c193 100644 > > --- a/src/legacy/getdtablesize.c > > +++ b/src/legacy/getdtablesize.c > > @@ -7,5 +7,5 @@ int getdtablesize(void) > > { > > struct rlimit rl; > > getrlimit(RLIMIT_NOFILE, &rl); > > - return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; > > + return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; > > Is there a motivation for this? > > Rich Well, I found this running tests for findutils, and having a couple failing because of it. I'm not sure about possible implications/issues it could cause in the actual tools, was only trying to get the tests to pass (and things to work as expected), but I wasn't facing an "actual" issue/bug, if that was the question. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] getdtablesize: Fix returning hard instead of soft rlimit 2016-08-13 19:36 ` Olivier Brunel @ 2016-08-15 15:33 ` Rich Felker 0 siblings, 0 replies; 4+ messages in thread From: Rich Felker @ 2016-08-15 15:33 UTC (permalink / raw) To: musl On Sat, Aug 13, 2016 at 09:36:13PM +0200, Olivier Brunel wrote: > On Sat, 13 Aug 2016 15:25:02 -0400 > Rich Felker <dalias@libc.org> wrote: > > > On Sat, Aug 13, 2016 at 08:31:49PM +0200, Olivier Brunel wrote: > > > --- > > > src/legacy/getdtablesize.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c > > > index 682da6d..b30c193 100644 > > > --- a/src/legacy/getdtablesize.c > > > +++ b/src/legacy/getdtablesize.c > > > @@ -7,5 +7,5 @@ int getdtablesize(void) > > > { > > > struct rlimit rl; > > > getrlimit(RLIMIT_NOFILE, &rl); > > > - return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; > > > + return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; > > > > Is there a motivation for this? > > > > Rich > > Well, I found this running tests for findutils, and having a couple > failing because of it. I'm not sure about possible > implications/issues it could cause in the actual tools, was only trying > to get the tests to pass (and things to work as expected), but I > wasn't facing an "actual" issue/bug, if that was the question. Given that the sysconf analog of this function uses rlim_cur rather than rlim_max, it's probably better for consistency if nothing else. It's possible we should consider dropping the implementation of getdtablesize and just having it call sysconf. This would somewhat enlarge static binaries calling getdtablesize, but the idea would be to remove the motivation to use an unspecified, deprecated, legacy function for the sake of size. Rich ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-15 15:33 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-08-13 18:31 [PATCH] getdtablesize: Fix returning hard instead of soft rlimit Olivier Brunel 2016-08-13 19:25 ` Rich Felker 2016-08-13 19:36 ` Olivier Brunel 2016-08-15 15:33 ` Rich Felker
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/musl/ 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 NNTP newsgroup(s).