On Fri, 14 Sep 2007, Mattias EngdegÄrd wrote: >> Probably irrelevant here, but this approach wouldn't work under Windows >> (Unix.file_descr is the Win32 file handle at that point which is often >> larger than 1024). More relevantly, Unix can be reconfigured to allow for >> more than 1024 open files. > > I think platform-dependent code is required here. The common way of > doing this under Linux (and Solaris, probably) is to readdir > /proc/PID/fd/. Windows is of course very different. I like this approach. It doesn't eliminate the need to convert ints to descrs, but at least you don't have a bunch of unnecessary system calls or a hard-coded maximum (assuming getrlimit is unavailable, as it is with OCaml currently). I wonder if /dev/fd is more or less portable... Dave