Author: mjg
Date: Sat Jun 28 05:41:53 2014
New Revision: 268001
URL: http://svnweb.freebsd.org/changeset/base/268001

Log:
  Make fdunshare accept only td parameter.
  
  Proc had to match the thread anyway and 2 parameters were inconsistent
  with the rest.
  
  MFC after:    1 week

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_fork.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Sat Jun 28 05:18:03 2014        
(r268000)
+++ head/sys/kern/kern_descrip.c        Sat Jun 28 05:41:53 2014        
(r268001)
@@ -1850,9 +1850,10 @@ fdshare(struct filedesc *fdp)
  * Unshare a filedesc structure, if necessary by making a copy
  */
 void
-fdunshare(struct proc *p, struct thread *td)
+fdunshare(struct thread *td)
 {
        struct filedesc *tmp;
+       struct proc *p = td->td_proc;
 
        if (p->p_fd->fd_refcnt == 1)
                return;

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c   Sat Jun 28 05:18:03 2014        (r268000)
+++ head/sys/kern/kern_exec.c   Sat Jun 28 05:41:53 2014        (r268001)
@@ -594,7 +594,7 @@ interpret:
         * For security and other reasons, the file descriptor table cannot
         * be shared after an exec.
         */
-       fdunshare(p, td);
+       fdunshare(td);
 
        /*
         * Malloc things before we need locks.

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c   Sat Jun 28 05:18:03 2014        (r268000)
+++ head/sys/kern/kern_fork.c   Sat Jun 28 05:41:53 2014        (r268001)
@@ -341,8 +341,8 @@ fork_norfproc(struct thread *td, int fla
        /*
         * Unshare file descriptors (from parent).
         */
-       if (flags & RFFDG) 
-               fdunshare(p1, td);
+       if (flags & RFFDG)
+               fdunshare(td);
 
 fail:
        if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) &&

Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h     Sat Jun 28 05:18:03 2014        (r268000)
+++ head/sys/sys/filedesc.h     Sat Jun 28 05:41:53 2014        (r268001)
@@ -152,7 +152,7 @@ int fdcheckstd(struct thread *td);
 void   fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread 
*td);
 void   fdcloseexec(struct thread *td);
 struct filedesc *fdcopy(struct filedesc *fdp);
-void   fdunshare(struct proc *p, struct thread *td);
+void   fdunshare(struct thread *td);
 void   fdescfree(struct thread *td);
 struct filedesc *fdinit(struct filedesc *fdp);
 struct filedesc *fdshare(struct filedesc *fdp);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to