Author: dchagin
Date: Tue Mar  8 15:08:22 2016
New Revision: 296501
URL: https://svnweb.freebsd.org/changeset/base/296501

Log:
  Link the newly created process to the corresponding parent as
  if CLONE_PARENT is set, then the parent of the new process will
  be the same as that of the calling process.
  
  MFC after:    1 week

Modified:
  head/sys/compat/linux/linux_fork.c

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c  Tue Mar  8 14:55:50 2016        
(r296500)
+++ head/sys/compat/linux/linux_fork.c  Tue Mar  8 15:08:22 2016        
(r296501)
@@ -222,6 +222,18 @@ linux_clone_proc(struct thread *td, stru
        if (args->flags & LINUX_CLONE_SETTLS)
                linux_set_cloned_tls(td2, args->tls);
 
+       /*
+        * If CLONE_PARENT is set, then the parent of the new process will be 
+        * the same as that of the calling process.
+        */
+       if (args->flags & LINUX_CLONE_PARENT) {
+               sx_xlock(&proctree_lock);
+               PROC_LOCK(p2);
+               proc_reparent(p2, td->td_proc->p_pptr);
+               PROC_UNLOCK(p2);
+               sx_xunlock(&proctree_lock);
+       }
+
 #ifdef DEBUG
        if (ldebug(clone))
                printf(LMSG("clone: successful rfork to %d, "
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to