Author: kib
Date: Sat May 26 20:03:47 2012
New Revision: 236117
URL: http://svn.freebsd.org/changeset/base/236117

Log:
  Stop treating td_sigmask specially for the purposes of new thread
  creation. Move it into the copied region of the struct thread.
  
  Update some comments.
  
  Requested by: bde
  X-MFC after:  never

Modified:
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_thr.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c   Sat May 26 18:20:30 2012        (r236116)
+++ head/sys/kern/kern_fork.c   Sat May 26 20:03:47 2012        (r236117)
@@ -475,7 +475,6 @@ do_fork(struct thread *td, int flags, st
 
        bcopy(&p2->p_comm, &td2->td_name, sizeof(td2->td_name));
        td2->td_sigstk = td->td_sigstk;
-       td2->td_sigmask = td->td_sigmask;
        td2->td_flags = TDF_INMEM;
        td2->td_lend_user_pri = PRI_MAX;
 

Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c        Sat May 26 18:20:30 2012        
(r236116)
+++ head/sys/kern/kern_kthread.c        Sat May 26 20:03:47 2012        
(r236117)
@@ -271,7 +271,6 @@ kthread_add(void (*func)(void *), void *
 
        bzero(&newtd->td_startzero,
            __rangeof(struct thread, td_startzero, td_endzero));
-/* XXX check if we should zero. */
        bcopy(&oldtd->td_startcopy, &newtd->td_startcopy,
            __rangeof(struct thread, td_startcopy, td_endcopy));
 
@@ -295,7 +294,6 @@ kthread_add(void (*func)(void *), void *
        /* this code almost the same as create_thread() in kern_thr.c */
        PROC_LOCK(p);
        p->p_flag |= P_HADTHREADS;
-       newtd->td_sigmask = oldtd->td_sigmask; /* XXX dubious */
        thread_link(newtd, p);
        thread_lock(oldtd);
        /* let the scheduler know about these things. */

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c    Sat May 26 18:20:30 2012        (r236116)
+++ head/sys/kern/kern_thr.c    Sat May 26 20:03:47 2012        (r236117)
@@ -252,7 +252,6 @@ create_thread(struct thread *td, mcontex
 
        PROC_LOCK(td->td_proc);
        td->td_proc->p_flag |= P_HADTHREADS;
-       newtd->td_sigmask = td->td_sigmask;
        thread_link(newtd, p); 
        bcopy(p->p_comm, newtd->td_name, sizeof(newtd->td_name));
        thread_lock(td);

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h Sat May 26 18:20:30 2012        (r236116)
+++ head/sys/sys/proc.h Sat May 26 20:03:47 2012        (r236117)
@@ -258,7 +258,6 @@ struct thread {
        u_int           td_uticks;      /* (t) Statclock hits in user mode. */
        int             td_intrval;     /* (t) Return value for sleepq. */
        sigset_t        td_oldsigmask;  /* (k) Saved mask from pre sigpause. */
-       sigset_t        td_sigmask;     /* (c) Current signal mask. */
        volatile u_int  td_generation;  /* (k) For detection of preemption */
        stack_t         td_sigstk;      /* (k) Stack ptr and on-stack flag. */
        int             td_xsig;        /* (c) Signal for ptrace */
@@ -272,10 +271,11 @@ struct thread {
        struct osd      td_osd;         /* (k) Object specific data. */
        struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
        pid_t           td_dbg_forked;  /* (c) Child pid for debugger. */
-#define        td_endzero td_rqindex
+#define        td_endzero td_sigmask
 
-/* Copied during fork1() or thread_sched_upcall(). */
+/* Copied during fork1() or create_thread(). */
 #define        td_startcopy td_endzero
+       sigset_t        td_sigmask;     /* (c) Current signal mask. */
        u_char          td_rqindex;     /* (t) Run queue index. */
        u_char          td_base_pri;    /* (t) Thread base kernel priority. */
        u_char          td_priority;    /* (t) Thread active priority. */
@@ -285,7 +285,7 @@ struct thread {
 #define        td_endcopy td_pcb
 
 /*
- * Fields that must be manually set in fork1() or thread_sched_upcall()
+ * Fields that must be manually set in fork1() or create_thread()
  * or already have been set in the allocator, constructor, etc.
  */
        struct pcb      *td_pcb;        /* (k) Kernel VA of pcb and kstack. */
_______________________________________________
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