From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 52894BC69 for ; Sat, 15 Sep 2007 00:07:56 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAOOi6kbVhW6V/2dsb2JhbACBVw X-IronPort-AV: E=Sophos;i="4.20,257,1186351200"; d="scan'208";a="796144" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2007 00:08:32 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l8EM8CWD005933 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 15 Sep 2007 00:08:13 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAOOi6kbVhW6V/2dsb2JhbACBVw X-IronPort-AV: E=Sophos;i="4.20,257,1186351200"; d="scan'208";a="796143" Received: from server2.thinkcrime.de ([213.133.110.149]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2007 00:08:31 +0200 Received: from hod-sarge-2005-10.lan.m-e-leypold.de (dslb-088-072-255-165.pools.arcor-ip.net [88.72.255.165]) (Authenticated sender: hod-sarge-2005-10@server2) by server2.thinkcrime.de (Postfix) with ESMTP id 0F71190023D for ; Sat, 15 Sep 2007 00:08:16 +0200 (CEST) Received: by hod-sarge-2005-10.lan.m-e-leypold.de (Postfix, from userid 1003) id 22D1937962; Sat, 15 Sep 2007 00:12:51 +0200 (CEST) To: caml-list@inria.fr Subject: Re: [Caml-list] Closing all open file descriptors References: <006b01c7f699$275fd6d0$017ca8c0@countertenor> <200709141000.l8EA04x12648@virtutech.se> <1189806728.46eb0288d38b8@webmail.in-berlin.de> From: Markus E L Organization: N/A Date: Sat, 15 Sep 2007 00:12:50 +0200 In-Reply-To: <1189806728.46eb0288d38b8@webmail.in-berlin.de> (Oliver Bandel's message of "Fri, 14 Sep 2007 23:52:08 +0200") Message-ID: User-Agent: Some cool user agent (SCUG) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 46EB064C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; descriptors:01 markus:01 bandel:01 mattias:01 readdir:01 ocaml:01 markus:01 2007,:98 wrote:01 wrote:01 unix:01 unix:01 oliver:01 abstract:01 ints:01 Oliver Bandel wrote: > Zitat von Dave Benjamin : > >> On Fri, 14 Sep 2007, Mattias Engdeg=C3=A5rd wrote: >> >> >> Probably irrelevant here, but this approach wouldn't work under Windo= ws >> >> (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.=20 Generally a function enumerate_my_open_files would not be such a bad idea. Regards -- Markus