473,471 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ANSI C - Determine if parent process ended before child

1 New Member
HELLU!!!....i'm juan...i'm argentinian....and i'm trying to write some code in "ANSI C" but i need to know if there's a way either through the pipe i created between 2 processes or through the process' pid if the PARENT process ended before the child process.....
anyone has any ideas???
Oct 3 '07 #1
2 1944
rajarora
33 New Member
HELLU!!!....i'm juan...i'm argentinian....and i'm trying to write some code in "ANSI C" but i need to know if there's a way either through the pipe i created between 2 processes or through the process' pid if the PARENT process ended before the child process.....
anyone has any ideas???
Hi jonasclown,

For the purpose, you can use wait() or waitpid() function.

If you could not get it on then Either try posting with your trial code so that I will be in a better positon to help you or ask me and I will do the same.

Regards,
Raj Kumar Arora
Dec 21 '07 #2
smalpani
29 New Member
After calling fork do something like following in your code for the child



Expand|Select|Wrap|Line Numbers
  1. while (getppid()!=1) //One is the pid of init and if the parent dies new ppid = 1
  2. {
  3.     sleep(10);   
  4. }
  5. //do the rest work here
  6. //THis will ensure that the child does not do any work until it is adopted by init
Dec 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Markus Franz | last post by:
Hi! Is there any possibility to change vars inside a parent process from the inside of a child process? Thanks Markus
0
by: Niels van de Coevering via .NET 247 | last post by:
Is it possible to catch a child process that is started by aparent process? I'm running an application which starts up apps with a processand registers this startup and also registers the exiting...
13
by: Jimmy Cracker | last post by:
Is it completely impossible in UNIX to push an environment variable to the parent shell? I would like to do something like this: main(int argc, char *argv) { char *var; var = (char...
0
by: marccruz | last post by:
Given an instance of System.Diagnostics.Process, how can I get the parent process o Given an instance of System.Diagnostics.Process, how can I get the child processes For example, I start a...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
1
by: coroto | last post by:
I know how to use Process.GetCurrentProcess to find out the PID of the current application (vb.net) but I'd like to know the PARENT process PID somehow. I've been looking at various methods...
1
by: Eric | last post by:
I want to call a method on the MDI parent from the child. Basically the method will set some text (message) on a status strip and show the appropriate icon (for the type of message). I'd also...
1
by: KakaICE | last post by:
Hi, I am using Visual Studio 2005 The problem is: The parent.exe launches a child.exe executible. In the child.exe process I want to know the commandline with which parent.exe was originally...
1
by: krieger | last post by:
What happend with parent proces. Two scripts: perl4: # # loop operations # use strict; my @food; my $morsel;
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.