tty dissociation

Robert Kiesling kiesling@earthlink.net
Mon Sep 3 02:32:00 GMT 2007


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/



More information about the Cygwin mailing list