This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: tty dissociation
- From: Robert Kiesling <kiesling at earthlink dot net>
- To: "d.henman" <dhenman at gmail dot com>
- Cc: cygwin at cygwin dot com
- Date: Sun, 2 Sep 2007 21:28:23 -0400 (EDT)
- Subject: Re: tty dissociation
- References: <20070903074852.3148@blackhawk>
On Mon, 3 Sep 2007, d.henman wrote:
Corinna in the following message, specified a way, ie. use setsid(), to dissociate a tty from a process.
http://sourceware.org/ml/cygwin/2001-08/msg00753.html
I ust want to ask if this is still the preferred method, or if any newer method exists?
IIRC the setsid () call's purpose is to identify a process later on, and
it allows the option of obtaining the process id from either the process
that started the background process, or any processes it might begin while
in the background.
To detach completely from a terminal, programs normally fork twice - after
the first fork (), the process closes stdin, stdout, and stderr, again,
IIRC, and then, a second fork () launches the actual process, completely,
detached from the terminal I/O channels, after the process begun by the
first fork () terminates.
At least, that's one technique, but it's worked for me.
Regards,
Robert Kiesling
Ctalk Home Page: http://ctalk-lang.sourceforge.net
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/