This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients ced, davin, gregory.p.smith, skrah, worr
Date 2015-04-13.21:46:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428961562.92.0.0521760632656.issue23852@psf.upfronthosting.co.za>
In-reply-to
Content
getrlimit() is not an async-signal-safe function according to http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html so you cannot call it from safe_get_max_fd().

having the getrlimit call done prior to the fork and using the value returned by that iff neither of the other two methods (fcntl and sysconf) are available or produced results seems like the best you can do.

also, rlim_t is an unsigned value yet the existing code in this module is using signed values for the file descriptors.  realistically i do not expect an rlim_t for max file descriptors to ever be > MAX_LONG as many file descriptor API calls require signed values for fds in order to use -1 as an error.

But checking the value for overflow and against the RLIM constants mentioned in http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html before casting it via (long) seems pedantically wise.
History
Date User Action Args
2015-04-13 21:46:02gregory.p.smithsetrecipients: + gregory.p.smith, ced, skrah, worr, davin
2015-04-13 21:46:02gregory.p.smithsetmessageid: <1428961562.92.0.0521760632656.issue23852@psf.upfronthosting.co.za>
2015-04-13 21:46:02gregory.p.smithlinkissue23852 messages
2015-04-13 21:46:02gregory.p.smithcreate