C program in Linux or Unix to make a child process orphan:
Making child as orphan
#include<stdio.h>
main()
{
int pid,pid1;
pid=fork();
if(pid>0)
{
printf("From parent process\n");
printf("Parent process %d \n",getpid());
}
else
{
sleep(1);
printf("From child process\n");
printf("child process %d \n",getpid());
}}
No comments:
Post a Comment