Mail Archives: djgpp/2014/07/27/12:00:22
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | "Rod Pemberton" <dont_use_email AT xnothavet DOT cqm>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: detecting child processes?
|
Date: | Sun, 27 Jul 2014 11:51:58 -0400
|
Organization: | Aioe.org NNTP Server
|
Lines: | 35
|
Message-ID: | <op.xjnycwvq6zenlw@localhost>
|
References: | <op DOT xfpixiqe6zenlw AT localhost>
|
NNTP-Posting-Host: | CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
|
Mime-Version: | 1.0
|
X-Complaints-To: | abuse AT aioe DOT org
|
User-Agent: | Opera Mail/12.16 (Linux)
|
X-Notice: | Filtered by postfilter v. 0.8.2
|
Bytes: | 2367
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
On Sun, 11 May 2014 13:59:32 -0400, Rod Pemberton
<dont_use_email AT xnothavet DOT cqm> 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.
> To do that, I need to be able to detect that the child is not
> the parent. How is that usually done in DJGPP or DOS?
>
From another thread on a DOS group, the correct way to do this
is to detect if the address of the DOS PSP is the same as the
address of the PSP for the parent. If the addresses are different,
then the process is a child. If the same, a parent. This seemed
to work for DOS and under most emulation or host OS console windows,
such as RM DOS, Windows 98/SE DOS console, Linux dosemu, DOSBOX, etc.
There was not any information provided about other environments
such as OS/2 or other versions of Windows.
Unfortunately, this test didn't work for me under Windows 98/SE
DOS console window, but another individual replied that it worked
for him on 98/SE.
I don't know what the cause of the failure was. I assumed
this may be due to me having the KernelEx project being
installed on my system. It extends and enhances 98/SE.
Or, it could've been something else, perhaps VBEMP ...
Since that test didn't work for Windows 98/SE for me, I ended
up using a lock file. I.e., the master process creates a file
and the child or spawned process checks for it's existence.
Rod Pemberton
- Raw text -