summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-05-26 20:03:47 +0000
committerkib <kib@FreeBSD.org>2012-05-26 20:03:47 +0000
commitdcb105721a02f8e28a04a14f50b493dbce705c1b (patch)
tree8e9f41721fe869bf79b03cbe6b6c43e267e1514c
parent1339de0936399f41179e8b5d5c1bf8713eb77e0d (diff)
downloadFreeBSD-src-dcb105721a02f8e28a04a14f50b493dbce705c1b.zip
FreeBSD-src-dcb105721a02f8e28a04a14f50b493dbce705c1b.tar.gz
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
-rw-r--r--sys/kern/kern_fork.c1
-rw-r--r--sys/kern/kern_kthread.c2
-rw-r--r--sys/kern/kern_thr.c1
-rw-r--r--sys/sys/proc.h8
4 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 7a0cece..f23c204 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -475,7 +475,6 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2,
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;
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 9dcdeb0..d8bbebd 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -271,7 +271,6 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
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 *arg, struct proc *p,
/* 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. */
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index ee0da02..4270b41 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -252,7 +252,6 @@ create_thread(struct thread *td, mcontext_t *ctx,
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);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 3f24ae9..389bf14 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -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. */
OpenPOWER on IntegriCloud