delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/09/02/22:32:25

X-Spam-Check-By: sourceware.org
Date: Sun, 2 Sep 2007 21:28:23 -0400 (EDT)
From: Robert Kiesling <kiesling AT earthlink DOT net>
To: "d.henman" <dhenman AT gmail DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: tty dissociation
In-Reply-To: <20070903074852.3148@blackhawk>
Message-ID: <Pine.LNX.4.64.0709022122480.6323@owl.gateway.2wire.net>
References: <20070903074852 DOT 3148 AT blackhawk>
MIME-Version: 1.0
X-ELNK-Trace: 0b901cbc512a9d8594f5150ab1c16ac0c864d17e3813b99a18f75b30c0a4c4ccd7b6a1d6d834f523350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019