473,320 Members | 2,146 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,320 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 10231
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.