lkml.org 
[lkml]   [2005]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [autofs] automount does not close file descriptors at start
On Wed, 16 Feb 2005, Steinar H. Gunderson wrote:

> Hi,
>
> My latest autofs package for Debian (4.1.3+4.1.4beta2-1) had problems
> installing, freezing after install; I've worked around this now
> (4.1.3+4.1.4beta2-2 is on its way up to the archive), but I've been told this
> is really a bug in automount. What I've been told is along the lines of:
>
> "Any daemon going into the background should close all file descriptors from
> zero up to MAXFDS minus the ones it actually wants to have open."
>
> In other words, one should probably have a for loop of sorts in
> become_daemon().

Steinar, I'm still wondering where this came from?

This is the first time I've heard this and the first time I wrote a Unix
daemon was fifteen years ago.

As far as I'm concerned redirecting stdin, stdout and stderr to the null
device, then closing it and setting the process to a be the group leader
(as autofs does) should be all that's needed to daemonize a process.

So are we saying that we don't trust the kernel to reliably duplicate the
state of file handles when we fork?

If that's the case then the kernel is badly broken and needs fixing, not
autofs!

Ian

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

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:2.073 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site