|Anonymous | Login | Signup for a new account||2015-07-04 15:36 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005329||OCaml||OCaml general||public||2011-08-03 15:28||2013-08-31 12:44|
|Target Version||Fixed in Version||3.13.0+dev|
|Summary||0005329: Include classic Unix.select in the Unix module for Win32|
|Description||It would be helpful if the old "classic" sockets implementation of Unix.select were available. This could be called either Unix.old_select, Unix.fast_select, etc.|
The old code from select.c can literally be pasted into the present file: the primitive simply needs to be renamed. For compatibility, the Unix distributions of unix.ml would simply need an alias for Unix.select. The documentation need only make clear that on Windows you can only specify socket descriptors.
|Additional Information||While very useful if you need a fully cross-platform version of select, the present implementation is over-kill (and must be slower, even if not relevantly) if all you're after is select on sockets.|
|Tags||No tags attached.|
|Attached Files||ocaml-3.12.0-PR5329.patch [^] (4,361 bytes) 2012-01-13 17:31 [Show Content]|
Supporting this. Also, the new select has had issues.
In Ocamlnet, the old version of select is available as Netsys_win32.real_select.
|I thought (but haven't checked) that the Win32 implementation of Unix.select has a fast path for the (common) case where all FDs are sockets. If it's not the case, maybe adding such a fast path without changing the Unix interface would be the best solution. A patch would be welcome.|
It doesn't appear to - the only call for sockets is to WSAEventSelect. I'm happy to code a patch (it will probably be after Christmas, though - my time has been squeezed recently but I'm working on an OCaml project again in the new year which is affected by this issue so I argue the dedicate time for helping).
My instinct would be to code it so that the default assumption is all sockets: so adapt fdlist_to_fdset to use Descr_kind_val to test each value as it goes and return 0 if they're all sockets and 1 if a non-socket value is found and use that to build either 3 fd_set values or, if any attempt fails, use the new function instead - does that sound reasonable?
|The approach you propose sounds fine. Please give it a try when you find the time. Thanks.|
Patch attached - merges the old unix_select back in as proposed. The patch can be applied with PR5327 (both patches contain an identical fix to windbug.h - so the second one to be applied will fail on that file only). If this patch is applied, the error case in PR5327 can still be seen by adding Unix.stdin to the list of read sockets passed to Unix.select (as that forces the code to use the Sylvain's version of select).
I've not corrected the indentation of the code on lines 1031-1266 as I figured that might cause issues with other pending patches. Those lines should be indented another 4 spaces.
Patch applied in SVN trunk (with reindenting of lines 1031-1266).
|2011-08-03 15:28||dra||New Issue|
|2011-10-23 14:58||gerd||Note Added: 0006175|
|2011-12-19 11:56||xleroy||Note Added: 0006382|
|2011-12-19 11:56||xleroy||Status||new => feedback|
|2011-12-19 14:03||dra||Note Added: 0006387|
|2011-12-19 14:03||dra||Status||feedback => new|
|2011-12-19 17:28||xleroy||Note Added: 0006392|
|2011-12-19 17:28||xleroy||Status||new => feedback|
|2011-12-21 12:09||xleroy||Relationship added||related to 0005327|
|2012-01-13 17:31||dra||File Added: ocaml-3.12.0-PR5329.patch|
|2012-01-13 17:49||dra||Note Added: 0006671|
|2012-01-13 17:49||dra||Status||feedback => new|
|2012-01-14 10:42||xleroy||Note Added: 0006675|
|2012-01-14 10:42||xleroy||Status||new => resolved|
|2012-01-14 10:42||xleroy||Resolution||open => fixed|
|2012-01-14 10:42||xleroy||Fixed in Version||=> 3.13.0+dev|
|2013-08-31 12:44||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|