How can i implement a UNIX system call like fork() or exec() in c programming language without making explicit calls. That is without using the system calls like fork(), exec() in the program code?
As we all know the implementation of system calls by explicit calls.
#include <stdio.h>
#include <sys/wait.h>
int main()
{
int p1,p2;
p1 = fork();
if(p1 == -1)
{
printf(“Error”);
return 0;
}
else
{
printf(“parent is %d\n”, getppid());
printf(“child is %d\n”, getpid());
}
p2 = fork();
printf(“parent is %d\n”, getppid());
printf(“child is %d\n”, getpid());
}
I just want a program that does the same function as above but without invoking fork() system call.