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

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat Jan 19 15:47:32 EST 2013


On Sat, 19 Jan 2013 08:40:04 +0530, you said:

> Is it that all the resources are shared as multiple references or if it is
> otherwise. Will you please give me some example of the case which I should
> not share the resources ? Thanking you all in advance.

It's not a question of "I should not share the resources" - fork() and friends
don't let you choose what to share or not share.  It's a matter of being
*aware* of what is or is not shared.  'man 2 fork' gives an extensive list of
what the child does and does not inherit.  Note that in some places it says
"inherits" - this usually refers to settings, and means "you get a copy of the
same value".  In places where it says "inherits copies", that means you got
another reference to the same object (mostly in regards to file system
objects).

The clone() syscall is useful if you wish to control what you do or don't
inherit from your parent.  It's also a very good way to shoot yourself in the
foot, as the semantics are subtly different from fork().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130119/baff7d6a/attachment.bin 


More information about the Kernelnewbies mailing list