[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-26 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7df280b311d0 by Gregory P. Smith in branch '3.4':
Fix computation of max_fd on OpenBSD.  Issue #23852.
https://hg.python.org/cpython/rev/7df280b311d0

New changeset 08d0cc23fb00 by Gregory P. Smith in branch 'default':
Fix computation of max_fd on OpenBSD.  Issue #23852.
https://hg.python.org/cpython/rev/08d0cc23fb00

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-26 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: patch review - resolved

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-24 Thread William Orr

William Orr added the comment:

Updated the patch based on review

--
Added file: http://bugs.python.org/file39200/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-24 Thread William Orr

Changes by William Orr w...@worrbase.com:


Removed file: http://bugs.python.org/file39097/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-17 Thread William Orr

William Orr added the comment:

I've updated Cédric's patch to only run that portion on OpenBSD.

--
Added file: http://bugs.python.org/file39097/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-14 Thread William Orr

William Orr added the comment:

Given that OpenBSD returns *bad* data via sysconf(3), I'm not sure that there's 
a good way to validate other than *only* calling getrlimit(3) on OpenBSD.

Is that an acceptable approach?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-14 Thread Gregory P. Smith

Gregory P. Smith added the comment:

yeah, that's fine.  just surround the call to getrlimit with appropriate 
openbsd ifdef's and a comment.  it is _probably_ async signal safe given the 
nature of the function in most implementations even though it isn't on the 
official posix list (many things are).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-13 Thread Gregory P. Smith

Gregory P. Smith added the comment:

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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-13 Thread William Orr

William Orr added the comment:

Tested on OpenBSD 5.6/amd64. lgtm.

--
nosy: +worr

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-04 Thread Cédric Krier

Changes by Cédric Krier cedric.kr...@b2ck.com:


Removed file: http://bugs.python.org/file38828/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-04 Thread Cédric Krier

Changes by Cédric Krier cedric.kr...@b2ck.com:


--
title: Wrong FD_DIR file name on OpenBSD - Wrong computation of max_fd on 
OpenBSD
Added file: http://bugs.python.org/file38828/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-04 Thread Cédric Krier

Cédric Krier added the comment:

But sysconf(_SC_OPEN_MAX) uses rlim_cur which is too low instead of rlim_max. 
My proposal is indeed describe in msg219477, it is not prefect but at least 
better than the current one for OpenBSD.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-04 Thread Stefan Krah

Stefan Krah added the comment:

Unfortunately I don't have an OpenBSD install either.  From the
sysconf.c source ...

  
http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/gen/sysconf.c?rev=1.22content-type=text/plain


... it seems that sysconf(_SC_OPEN_MAX) also calls getrlimit().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23852] Wrong computation of max_fd on OpenBSD

2015-04-04 Thread Cédric Krier

Cédric Krier added the comment:

Correctly cast to long instead of int.

--
Added file: http://bugs.python.org/file38831/max_fd.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23852
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com