delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2014/05/11/15:30:09

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: =?ISO-8859-1?Q?Hans-Bernhard_Br=F6ker?= <HBBroeker AT t-online DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: detecting child processes?
Date: Sun, 11 May 2014 21:12:47 +0200
Lines: 17
Message-ID: <bta0diFpl6jU1@mid.dfncis.de>
References: <op DOT xfpixiqe6zenlw AT localhost>
Mime-Version: 1.0
X-Trace: news.dfncis.de AfjZffUWi5Exyny/64BghQHtq5458l5LfafN8K2xFRnOGuAlKHa19BmF4d
Cancel-Lock: sha1:IJ0E3HI7OKyC9aomBI2+nLrM2+4=
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To: <op.xfpixiqe6zenlw@localhost>
Bytes: 1525
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 11.05.2014 19:59, Rod Pemberton wrote:

> I have a process which spawns a child of itself via system().
>
> Although the parent and child are the same application, I'd now
> like the child to function slightly differently from the parent.

I'll assume you're referring only to the case where the parent process 
is this same program, rather than your program being invoked as any 
arbitrary other program's child process.

> To do that, I need to be able to detect that the child is not
> the parent.

So make the parent _tell_ the child: set an environment variable like 
"PAPA_ALREADY_THERE", pass a command line argument to the child, or 
whatever you like.

- Raw text -


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