Date: Thu, 30 Mar 2006 07:21:53 -0800 From: Claus Assmann <freebsd+current@esmtp.org> To: freebsd-current@freebsd.org Subject: Re: _cleanup() vs Linux fcloseall() Message-ID: <20060330152153.GA19625@zardoc.esmtp.org> In-Reply-To: <20060330081619.GB736@turion.vk2pj.dyndns.org> References: <Pine.GSO.4.43.0603291445520.25824-100000@sea.ntplx.net> <200603291605.36884.jhb@freebsd.org> <20060329224100.GB2293@elvis.mu.org> <20060330081619.GB736@turion.vk2pj.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdlib.h>
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060330152153.GA19625>
