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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2CDDCBC69 for ; Fri, 14 Sep 2007 08:42:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAfL6UbAXQInhmdsb2JhbACOEgEBAQgEBgcGGA X-IronPort-AV: E=Sophos;i="4.20,253,1186351200"; d="scan'208";a="1180896" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Sep 2007 08:43:17 +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 l8E6gwCn011261 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 14 Sep 2007 08:43:00 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CANrJ6UZA9hw0/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.20,253,1186351200"; d="scan'208";a="750942" Received: from tenhost.net ([64.246.28.52]) by mail1-smtp-roc.national.inria.fr with SMTP; 14 Sep 2007 08:43:14 +0200 Received: (qmail 8922 invoked from network); 14 Sep 2007 01:14:45 -0500 Received: from ip72-208-52-84.ph.ph.cox.net (HELO ?192.168.1.99?) (72.208.52.84) by tenhost.net with SMTP; 14 Sep 2007 01:14:45 -0500 Message-ID: <46EA2D2F.4070108@ramenlabs.com> Date: Thu, 13 Sep 2007 23:41:51 -0700 From: Dave Benjamin User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070828) MIME-Version: 1.0 To: David Allsopp Cc: "'Caml List'" Subject: Re: [Caml-list] Closing all open file descriptors References: <006b01c7f699$275fd6d0$017ca8c0@countertenor> In-Reply-To: <006b01c7f699$275fd6d0$017ca8c0@countertenor> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46EA2D72.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; descriptors:01 wrote:01 unix:01 unix:01 caml-list:01 benjamin:01 descr:02 seems:03 latter:03 problem:05 irrelevant:07 probably:07 approach:08 wrap:08 dave:09 David Allsopp 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. Yes, I assumed that this would be non-portable, and that is yet another problem. It seems that dropping down to C is the only way to really do this right. > Wouldn't an easier, portable way be to wrap Unix.openfile and Unix.close to > maintain a set of open file_descrs or is your concern the risk of files left > open by third party code? The latter. The simple solution is to use Unix.set_close_on_exec from the parent process, but that only works if it's under my control. Dave