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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 90BE0BC69 for ; Sat, 15 Sep 2007 12:42:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJtT60bAXQInmWdsb2JhbACOEgEBAQEHBAYHCBY X-IronPort-AV: E=Sophos;i="4.20,258,1186351200"; d="scan'208";a="1231769" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2007 12:43:12 +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 l8FAgfsh019054 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 15 Sep 2007 12:42:50 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAANZT60bAbSoIh2dsb2JhbACOEgEBAQgKJw X-IronPort-AV: E=Sophos;i="4.20,258,1186351200"; d="scan'208";a="813260" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2007 12:43:11 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from einhorn.in-berlin.de (localhost [127.0.0.1]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id l8FAhAMt013688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 15 Sep 2007 12:43:10 +0200 Received: (from www-data@localhost) by einhorn.in-berlin.de (8.13.6/8.13.6/Submit) id l8FAhALG013686 for caml-list@inria.fr; Sat, 15 Sep 2007 12:43:10 +0200 X-Authentication-Warning: einhorn.in-berlin.de: www-data set sender to oliver@first.in-berlin.de using -f Received: from dslb-088-073-095-014.pools.arcor-ip.net (dslb-088-073-095-014.pools.arcor-ip.net [88.73.95.14]) by webmail.in-berlin.de (IMP) with HTTP for ; Sat, 15 Sep 2007 12:43:10 +0200 Message-ID: <1189852990.46ebb73e7edc3@webmail.in-berlin.de> Date: Sat, 15 Sep 2007 12:43:10 +0200 From: Oliver Bandel 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> <1189847741.46eba2bd9d121@webmail.in-berlin.de> <20070915192631.2384ae5a.mle+ocaml@mega-nerd.com> In-Reply-To: <20070915192631.2384ae5a.mle+ocaml@mega-nerd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 46EBB721.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 descriptors:01 ocaml:01 bandel:01 descriptors:01 fcntl:01 wrote:01 oliver:01 oliver:01 caml-list:01 inherit:01 erik:04 fork:05 programmer:07 Zitat von Erik de Castro Lopo : > Oliver Bandel wrote: > > > If you think you need all this for your daemon, > > I ask: why do you think you need it? If you write it, you have > > full control over all files you open > > No, thats not right. I can write a program, that opens a bunch > of file descriptors, and then exec his program and his program > will inherit all open file descritors. Yes, that's correct. But you (as the programmer) have the control (by design) about how to handle that case. If you have all your open descriptors in a list, you can close them after a fork. In C, with fcntl, there is a possibility to close files on an exec automatically with the close-on-exec flag. Ciao, Oliver