Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Closing all open file descriptors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-14 (22:07)
From: Markus E L <ls-ocaml-2006@m...>
Subject: Re: [Caml-list] Closing all open file descriptors

Oliver Bandel wrote:

> Zitat von Dave Benjamin <>:
>> 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,
> On Unix, file-descriptors are identified by integer-values.
> In OCaml, you have abstract types for file-descriptors.
> So, how to convert them? I think, officially there is no way.

By writing a C-function which does the conversion. This, of course
could only exist under Linux. 

Generally a function enumerate_my_open_files would not be such a bad

Regards -- Markus