473,378 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Code to create an orphan process?

Can anyone help me in writing the code to create an orphan process......????
Mar 19 '10 #1
6 10236
rski
700 Expert 512MB
You mean to process which will be addopted by init (as i know on most unix-like systems every orphan process is addopted by init)?
Mar 20 '10 #2
Yeah ....i need the code to do the same......can u plz provide ????
Mar 20 '10 #3
rski
700 Expert 512MB
You want code in C? bash? or any
Mar 20 '10 #4
I need the code in C.
Mar 20 '10 #5
rski
700 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <sys/types.h>
  4. #include <stdlib.h>
  5. #include <sys/wait.h>
  6.  
  7. int main(){
  8.         pid_t i;
  9.  
  10.         i=fork();
  11.  
  12.         if (i==0){
  13.         while (1){
  14.                 printf("child process pid = %d, ppid=%d\n",(int)getpid(), (int)getppid());
  15.                 sleep(3);
  16.         }
  17.  
  18.         }else{
  19.  
  20.                 printf("parent has finished");
  21.  
  22.  
  23.         }
  24.         return 0;
  25. }
  26.  
It creates process which is addopted by init when parent has finished. Child process is working in unfinite loop (but you can of course change it).
Is that what you want?
Mar 20 '10 #6
Yeahhh....Thanx Buddyyyy
Mar 21 '10 #7

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

Similar topics

0
by: John Thorne | last post by:
Have 2 tables ts_sheets : TimeSheet_ID TimeSheet_Date Emp_ID Orphan LineItem TimeSheet_ID Client
3
by: James | last post by:
I need to define paragraphs on my site that should not break across a page when printed, similar to widow/orphan control in Word. Is this possible to implement? We only use IE6 so no cross-platform...
0
by: net guest via DotNetMonster.com | last post by:
Hi, i am facing a lot of problems in killing the orphan excel instances. I approached one method like killing the Excel Orphan with processID. I am getting all the Processess that are running...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
0
by: prabhupr | last post by:
Hi Folks In CS project, we use "Add Reference" option to make reference to other assemblies. At times, there a is a chance that few of them get added by mistake or must have got added for some...
1
by: Gunnar | last post by:
Are there any way of detecting that a program have crashed and left an orphan file? I have tried with the filesystemwatcher, but that didn't work. Maybe I can use a polling strategy and keep...
1
by: julian_m | last post by:
I'm working with mysql without referential itegrity. Let me make some small example: tableA +-----------+---------------+ | id_1 | data_1 | +-----------+---------------+ | 1 ...
2
by: julian_m | last post by:
I'm working with mysql without referential itegrity. Let me make some small example: tableA +-----------+---------------+ | id_1 | data_1 | +-----------+---------------+ | 1 ...
2
by: alikhan707 | last post by:
Hey guys i need help on this problem .. How to solve zombie and orphan process problems ? Please explain with an example...
2
by: smilem | last post by:
Hi, I use Gallery2 v2.3 system on my web server. When I add and delete photos I see orphan records in my db. The project is opensource and developers are focused on new v3 of the product. However...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.