Re: FD_CLFORK or equivalent?

Sam Roberts (sam@cogent.ca)
Wed, 5 May 1999 11:00:13 -0400 (edt)


On Wed, 5 May 1999, Richard B. Johnson wrote:

> Date: Wed, 5 May 1999 08:28:14 -0400 (EDT)
> From: "Richard B. Johnson" <root@chaos.analogic.com>
> To: Bernd Eckenfels <ecki@lina.inka.de>
> Cc: linux-kernel@vger.rutgers.edu
> Subject: Re: FD_CLFORK or equivalent?
>
> On Wed, 5 May 1999, Bernd Eckenfels wrote:
>
> > In article <Pine.QNX.3.96.990504112943.30630A-100000@sam.cogent.ca> you wrote:
> > > If not, before I hack one in as a private kernel patch, is
> > > there any reason to add such a mechanism, perhaps a FD_CLOFORK
> > > flag, and does anybody have suggestions on where to start?
> >
> > A reason would be, that this is a good way of making daemons. Since closing
> > all fds from 0-255 is not enough on systems where high-numberes fds can be
> > open.
> >
> But... The 'standard' way is:
>
> fd = open("/", O_RDONLY);
> while (fd >= 0) (void)close(fd--);

Which will completely fail if the daemon opened a few files, then
closed fds 0-2.

> Cheers,
> Dick Johnson
> ***** FILE SYSTEM WAS MODIFIED *****
> Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips).
> Warning : It's hard to remain at the trailing edge of technology.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/