From owner-freebsd-current@FreeBSD.ORG Thu Mar 30 15:22:02 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 23C0A16A424 for ; Thu, 30 Mar 2006 15:22:02 +0000 (UTC) (envelope-from ca+envelope@esmtp.org) Received: from zardoc.esmtp.org (adsl-63-195-85-27.dsl.snfc21.pacbell.net [63.195.85.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DB3143D67 for ; Thu, 30 Mar 2006 15:21:56 +0000 (GMT) (envelope-from ca+envelope@esmtp.org) Received: from zardoc.esmtp.org (localhost. [127.0.0.1]) by zardoc.esmtp.org (sendmail X.1.0.PreAlpha3.0) with ESMTPS (TLS=TLSv1/SSLv3, cipher=AES256-SHA, bits=256, verify=OK) id S0000000000030C5300; Thu, 30 Mar 2006 07:21:55 -0800 Received: (from ca@localhost) by zardoc.esmtp.org (8.13.4/8.12.10.Beta0/Submit) id k2UFLrPL001003 for freebsd-current@freebsd.org; Thu, 30 Mar 2006 07:21:53 -0800 (PST) Date: Thu, 30 Mar 2006 07:21:53 -0800 From: Claus Assmann To: freebsd-current@freebsd.org Message-ID: <20060330152153.GA19625@zardoc.esmtp.org> Mail-Followup-To: freebsd-current@freebsd.org References: <200603291605.36884.jhb@freebsd.org> <20060329224100.GB2293@elvis.mu.org> <20060330081619.GB736@turion.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060330081619.GB736@turion.vk2pj.dyndns.org> User-Agent: Mutt/1.5.9i Subject: Re: _cleanup() vs Linux fcloseall() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2006 15:22:02 -0000 On Thu, Mar 30, 2006, Peter Jeremy wrote: > I'd prefer to see a function that closed all file descriptors greater > than a specified limit (which makes it easy for a process to preserve > stdin/out/err but close everything else). Two obvious places for this closefrom(), see SunOS 5.10 et.al: Standard C Library Functions closefrom(3C) NAME closefrom, fdwalk - close or iterate over open file descrip- tors SYNOPSIS #include void closefrom(int lowfd); int fdwalk(int (*func)(void *, int), void *cd); DESCRIPTION The closefrom() function calls close(2) on all open file descriptors greater than or equal to lowfd.