This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setsid() does not call FreeConsole() even if all files are closed

On Sun, 13 Nov 2005, Christian Franke wrote:

when starting a daemon from the console, the console will not close
before the daemon finishes.

Try, e.g:

$ /usr/sbin/syslogd
$ exit

Shell exits, but console window persists until syslogd is terminated.


+  #ifdef __CYGWIN__
+  FreeConsole();
+  #endif

According to, FreeConsole() should be called if a
tty exists and no files are open.

Yep, so, as CGF noted, try

$ /usr/sbin/syslogd >/dev/null 2>&1 </dev/null
$ exit

However, the main question is whether syslogd *should* close the file
descriptors if it doesn't intend to write to them.  I'm not familiar
enough with syslogd's operation -- if it normally writes to stdout/stderr
(or reads from stdin), the above is the only way to get the shell to
close.  If syslogd never reads/writes to standard filehandles in daemon
mode, it should close them itself (i.e., this is a syslogd bug).
     |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
    |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
   '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]