no error thrown with exit(0) in the child process of vfork()

Niroj Pokhrel nirojpokhrel at
Fri Jan 18 09:29:38 EST 2013

Hi all,
I have been trying to create a process using vfork(). And both of the child
and the parent process execute it in the same address space. So, if I
execute exit(0) in the child process, it should throw some error right.
Since the execution is happening in child process first and if I release
all the resources by using exit(0) in the child process then parent should
be deprived of the resources and should throw some errors right ??
In the following code, however the process ran fine even though I have
exit(0) in the child process ........
int main()
    int val,i=0;
        printf("\nI am a child process.\n");
        printf(" %d ",i++);
        printf("\nI am a parent process.\n");
        printf(" %d ",i);
    return 0;
// The program is running fine .....
But as I have read it should throw some error right ?? I don't know what I
am missing . Please point out the point I'm missing. Thanking you in
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list