Re: _cleanup() vs Linux fcloseall()

From: Maxime Henrion <mux_at_FreeBSD.org>
Date: Thu, 30 Mar 2006 00:41:00 +0200
John Baldwin wrote:
> On Wednesday 29 March 2006 14:54, Daniel Eischen wrote:
> > It seems that some 3rd party code, pmake in particular, rely on
> > the implementation exporting _cleanup() to close all open file
> > descriptors.  Linux supplies fcloseall() and does not export
> > _cleanup().
> > 
> > In the initial cut of symbol versioning for libc, I did not
> > export _cleanup().  This breaks pmake, and perhaps some other
> > 3rd party applications.  Do we want to continue to export this
> > interface, or should we provide an equivalent of Linux'
> > fcloseall()?
> 
> I would vote for fcloseall() personally.

Seconded.

Slightly OT:
Does fcloseall() really closes all the open file descriptors?  The name
suggests that it will close all the FILE * streams instead, which is not
quite the same.  The manpage I found on the net seems to confirm this
indirectly by saying that fflush() is used prior to closing the streams.

FWIW, NetBSD has something that close all the file descriptors, and it's
done with fcntl(fd, F_CLOSEM) (using fcntl() on one file descriptor to
close all of them looks a bit weird to me, but well...).

Cheers,
Maxime
Received on Wed Mar 29 2006 - 20:41:00 UTC

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