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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr 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 70727BC69 for ; Fri, 14 Sep 2007 22:59:19 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAALqS6kbAXQInmWdsb2JhbACOEQEBAgcEBgcIFg X-IronPort-AV: E=Sophos;i="4.20,257,1186351200"; d="scan'208";a="794711" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Sep 2007 22:59:54 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l8EKxZOF031832 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 14 Sep 2007 22:59:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAPSS6kZA9hw0/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.20,257,1186351200"; d="scan'208";a="16218967" Received: from tenhost.net ([64.246.28.52]) by mail4-smtp-sop.national.inria.fr with SMTP; 14 Sep 2007 22:59:53 +0200 Received: (qmail 16095 invoked by uid 502); 14 Sep 2007 15:31:21 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 14 Sep 2007 15:31:21 -0500 Date: Fri, 14 Sep 2007 15:31:21 -0500 (CDT) From: Dave Benjamin X-X-Sender: ramen@tenhost.net To: =?utf-8?b?TWF0dGlhcyBFbmdkZWfDpQ==?= =?utf-8?b?cmQ=?= Cc: dra-news@metastack.com, Caml List Subject: Re: [Caml-list] Closing all open file descriptors In-Reply-To: <200709141000.l8EA04x12648@virtutech.se> Message-ID: References: <006b01c7f699$275fd6d0$017ca8c0@countertenor> <200709141000.l8EA04x12648@virtutech.se> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-163564516-1139331480-1189801881=:27531" X-Miltered: at concorde with ID 46EAF637.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; descriptors:01 unreadable:01 mime-aware:01 mattias:01 readdir:01 ocaml:01 2007,:98 wrote:01 unix:01 unix:01 readable:01 ints:01 caml-list:01 benjamin:01 descr:02 X-Attachments: cset="X-UNKNOWN" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---163564516-1139331480-1189801881=:27531 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 14 Sep 2007, Mattias Engdeg=C3=A5rd 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 fo= r >> more than 1024 open files. > > I think platform-dependent code is required here. The common way of=20 > doing this under Linux (and Solaris, probably) is to readdir=20 > /proc/PID/fd/. Windows is of course very different. I like this approach. It doesn't eliminate the need to convert ints to=20 descrs, but at least you don't have a bunch of unnecessary system calls or= =20 a hard-coded maximum (assuming getrlimit is unavailable, as it is with=20 OCaml currently). I wonder if /dev/fd is more or less portable... Dave ---163564516-1139331480-1189801881=:27531--