From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Joey Hess <joey@kitenet.net>, git@vger.kernel.org
Subject: Re: RLIMIT_NOFILE fallback
Date: Wed, 18 Dec 2013 16:40:01 -0500 [thread overview]
Message-ID: <20131218214001.GA14354@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqd2kthmcr.fsf@gitster.dls.corp.google.com>
On Wed, Dec 18, 2013 at 01:37:24PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > According to the POSIX quote above, it sounds like we could do:
> >
> > #if defined (_SC_OPEN_MAX)
> > {
> > long max;
> > errno = 0;
> > max = sysconf(_SC_OPEN_MAX);
> > if (0 < max) /* got the limit */
> > return max;
> > else if (!errno) /* unlimited, cast to int-max */
> > return max;
> > /* otherwise, fall through */
> > }
> > #endif
> >
> > Obviously you could collapse the two branches of the conditional, though
> > I think it deserves at least a comment to explain what is going on.
>
> Yes, that is locally OK, but depending on how the caller behaves, we
> might need to have an extra saved_errno dance here, which I didn't
> want to get into...
I think we are fine. The only caller is about to clobber errno by
closing packs anyway.
-Peff
next prev parent reply other threads:[~2013-12-18 21:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 17:14 RLIMIT_NOFILE fallback Joey Hess
2013-12-18 18:00 ` Junio C Hamano
2013-12-18 18:41 ` Joey Hess
2013-12-18 19:17 ` Jeff King
2013-12-18 19:50 ` Junio C Hamano
2013-12-18 20:18 ` Junio C Hamano
2013-12-18 21:28 ` Jeff King
2013-12-18 21:37 ` Junio C Hamano
2013-12-18 21:40 ` Jeff King [this message]
2013-12-18 22:59 ` Junio C Hamano
2013-12-19 0:15 ` Jeff King
2013-12-19 17:30 ` Torsten Bögershausen
2013-12-19 17:39 ` Junio C Hamano
2013-12-20 9:12 ` Jeff King
2013-12-20 14:43 ` Torsten Bögershausen
2013-12-18 20:03 ` Joey Hess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131218214001.GA14354@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=joey@kitenet.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).