Re: _cleanup() vs Linux fcloseall()

From: Claus Assmann <freebsd+current_at_esmtp.org>
Date: Thu, 30 Mar 2006 07:21:53 -0800
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.
Received on Thu Mar 30 2006 - 13:22:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC