dcoughlin added a comment.

> For example, doing 'x = malloc(4); *x = 0;' in the child process seems fine 
> to me.


I don't think this is necessarily safe. For example, malloc() could end up both 
modifying memory shared between the child and parent process but only modifying 
process state for the child, leaving the parent in an inconsistent state.

POSIX (before removing vfork() completely) was pretty brutal about the 
restrictions in the child:

> ...the behavior is undefined if the process created by vfork() either 
> modifies any data other than a variable of type pid_t used to store the 
> return value from vfork(), or returns from the function in which vfork() was 
> called, or calls any other function before successfully calling _exit() or 
> one of the exec family of functions.





Repository:
  rL LLVM

http://reviews.llvm.org/D14014



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to