diff options
author | davidxu <davidxu@FreeBSD.org> | 2002-09-05 07:30:18 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2002-09-05 07:30:18 +0000 |
commit | b1d94c37f75017a140121c9735033fcb62e8d0d3 (patch) | |
tree | 137cfbb681f0fc0991a608cc3e54a93dc25c64dc /sys | |
parent | 725b1916bdb3e6e0e9a4c6a986ad2e2e5a3502af (diff) | |
download | FreeBSD-src-b1d94c37f75017a140121c9735033fcb62e8d0d3.zip FreeBSD-src-b1d94c37f75017a140121c9735033fcb62e8d0d3.tar.gz |
s/SGNL/SIG/
s/SNGL/SINGLE/
s/SNGLE/SINGLE/
Fix abbreviation for P_STOPPED_* etc flags, in original code they were
inconsistent and difficult to distinguish between them.
Approved by: julian (mentor)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/procfs/procfs_ctl.c | 4 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_ioctl.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_kse.c | 22 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 22 | ||||
-rw-r--r-- | sys/kern/sys_process.c | 2 | ||||
-rw-r--r-- | sys/sys/proc.h | 20 | ||||
-rw-r--r-- | sys/vm/vm_glue.c | 3 |
11 files changed, 45 insertions, 42 deletions
diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c index 88ce6dd..19758d8 100644 --- a/sys/fs/procfs/procfs_ctl.c +++ b/sys/fs/procfs/procfs_ctl.c @@ -264,7 +264,7 @@ out: */ case PROCFS_CTL_RUN: PROC_UNLOCK(p); - p->p_flag &= ~P_STOPPED_SGNL; /* this uses SIGSTOP */ + p->p_flag &= ~P_STOPPED_SIG; /* this uses SIGSTOP */ break; /* @@ -351,7 +351,7 @@ procfs_doprocctl(PFS_FILL_ARGS) #endif mtx_lock_spin(&sched_lock); /* XXXKSE: */ - p->p_flag &= ~P_STOPPED_SGNL; + p->p_flag &= ~P_STOPPED_SIG; setrunnable(FIRST_THREAD_IN_PROC(p)); mtx_unlock_spin(&sched_lock); } else diff --git a/sys/fs/procfs/procfs_ioctl.c b/sys/fs/procfs/procfs_ioctl.c index 04c0296..1dd0b6d 100644 --- a/sys/fs/procfs/procfs_ioctl.c +++ b/sys/fs/procfs/procfs_ioctl.c @@ -96,7 +96,7 @@ procfs_ioctl(PFS_IOCTL_ARGS) p->p_step = 0; if (P_SHOULDSTOP(p)) { p->p_xstat = sig; - p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SGNL); + p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG); FOREACH_THREAD_IN_PROC(p, td) setrunnable(td); /* XXX Totally bogus */ mtx_unlock_spin(&sched_lock); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 1ee302a..8423f62 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -162,7 +162,7 @@ execve(td, uap) KASSERT((p->p_flag & P_INEXEC) == 0, ("%s(): process already has P_INEXEC flag", __func__)); if (p->p_flag & P_KSES) { - if (thread_single(SNGLE_EXIT)) { + if (thread_single(SINGLE_EXIT)) { PROC_UNLOCK(p); return (ERESTART); /* Try again later. */ } diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index fea5438..8a57e1d 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -178,7 +178,7 @@ exit1(td, rv) * from userret(). thread_exit() will unsuspend us * when the last other thread exits. */ - if (thread_single(SNGLE_EXIT)) { + if (thread_single(SINGLE_EXIT)) { panic ("Exit: Single threading fouled up"); } /* diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5f9d1bd..a0429b2 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -291,7 +291,7 @@ fork1(td, flags, procp) * be aborted in the child. */ PROC_LOCK(p1); - if (thread_single(SNGLE_NO_EXIT)) { + if (thread_single(SINGLE_NO_EXIT)) { /* Abort.. someone else is single threading before us */ PROC_UNLOCK(p1); return (ERESTART); diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index ce2b125..26a4707 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -346,10 +346,10 @@ thread_exit(void) kg->kg_numthreads--; /* * The test below is NOT true if we are the - * sole exiting thread. P_STOPPED_SNGL is unset + * sole exiting thread. P_STOPPED_SINGLE is unset * in exit1() after it is the only survivor. */ - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount) { TAILQ_REMOVE(&p->p_suspended, p->p_singlethread, td_runq); @@ -596,11 +596,11 @@ thread_single(int force_exit) if (p->p_singlethread) return (1); - if (force_exit == SNGLE_EXIT) + if (force_exit == SINGLE_EXIT) p->p_flag |= P_SINGLE_EXIT; else p->p_flag &= ~P_SINGLE_EXIT; - p->p_flag |= P_STOPPED_SNGL; + p->p_flag |= P_STOPPED_SINGLE; p->p_singlethread = td; while ((p->p_numthreads - p->p_suspcount) != 1) { FOREACH_THREAD_IN_PROC(p, td2) { @@ -608,7 +608,7 @@ thread_single(int force_exit) continue; switch(td2->td_state) { case TDS_SUSPENDED: - if (force_exit == SNGLE_EXIT) { + if (force_exit == SINGLE_EXIT) { mtx_lock_spin(&sched_lock); TAILQ_REMOVE(&p->p_suspended, td, td_runq); @@ -688,7 +688,7 @@ thread_suspend_check(int return_instead) p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); while (P_SHOULDSTOP(p)) { - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { KASSERT(p->p_singlethread != NULL, ("singlethread not set")); /* @@ -706,7 +706,7 @@ thread_suspend_check(int return_instead) /* * If the process is waiting for us to exit, * this thread should just suicide. - * Assumes that P_SINGLE_EXIT implies P_STOPPED_SNGL. + * Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE. */ if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { mtx_lock_spin(&sched_lock); @@ -729,7 +729,7 @@ thread_suspend_check(int return_instead) * and can only be lent in STOPPED state. */ mtx_lock_spin(&sched_lock); - if ((p->p_flag & P_STOPPED_SGNL) && + if ((p->p_flag & P_STOPPED_SIG) && (p->p_suspcount+1 == p->p_numthreads)) { mtx_unlock_spin(&sched_lock); PROC_LOCK(p->p_pptr); @@ -745,7 +745,7 @@ thread_suspend_check(int return_instead) td->td_state = TDS_SUSPENDED; TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq); PROC_UNLOCK(p); - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount) { TAILQ_REMOVE(&p->p_suspended, p->p_singlethread, td_runq); @@ -805,7 +805,7 @@ thread_unsuspend(struct proc *p) while (( td = TAILQ_FIRST(&p->p_suspended))) { thread_unsuspend_one(td); } - } else if ((P_SHOULDSTOP(p) == P_STOPPED_SNGL) && + } else if ((P_SHOULDSTOP(p) == P_STOPPED_SINGLE) && (p->p_numthreads == p->p_suspcount)) { /* * Stopping everything also did the job for the single @@ -825,7 +825,7 @@ thread_single_end(void) td = curthread; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_flag &= ~P_STOPPED_SNGL; + p->p_flag &= ~P_STOPPED_SINGLE; p->p_singlethread = NULL; /* * If there are other threads they mey now run, diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index c3cc40f..5dbb757 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1363,7 +1363,7 @@ psignal(p, sig) * an event, it goes back to run state. * Otherwise, process goes back to sleep state. */ - p->p_flag &= ~P_STOPPED_SGNL; + p->p_flag &= ~P_STOPPED_SIG; p->p_flag |= P_CONTINUED; if (action == SIG_DFL) { SIGDELSET(p->p_siglist, sig); @@ -1395,7 +1395,7 @@ psignal(p, sig) * (If we did the shell could get confused). * Just make sure the signal STOP bit set. */ - p->p_flag |= P_STOPPED_SGNL; + p->p_flag |= P_STOPPED_SIG; SIGDELSET(p->p_siglist, sig); goto out; } @@ -1770,7 +1770,7 @@ stop(p) { PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_flag |= P_STOPPED_SGNL; + p->p_flag |= P_STOPPED_SIG; p->p_flag &= ~P_WAITED; wakeup(p->p_pptr); } diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index ce2b125..26a4707 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -346,10 +346,10 @@ thread_exit(void) kg->kg_numthreads--; /* * The test below is NOT true if we are the - * sole exiting thread. P_STOPPED_SNGL is unset + * sole exiting thread. P_STOPPED_SINGLE is unset * in exit1() after it is the only survivor. */ - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount) { TAILQ_REMOVE(&p->p_suspended, p->p_singlethread, td_runq); @@ -596,11 +596,11 @@ thread_single(int force_exit) if (p->p_singlethread) return (1); - if (force_exit == SNGLE_EXIT) + if (force_exit == SINGLE_EXIT) p->p_flag |= P_SINGLE_EXIT; else p->p_flag &= ~P_SINGLE_EXIT; - p->p_flag |= P_STOPPED_SNGL; + p->p_flag |= P_STOPPED_SINGLE; p->p_singlethread = td; while ((p->p_numthreads - p->p_suspcount) != 1) { FOREACH_THREAD_IN_PROC(p, td2) { @@ -608,7 +608,7 @@ thread_single(int force_exit) continue; switch(td2->td_state) { case TDS_SUSPENDED: - if (force_exit == SNGLE_EXIT) { + if (force_exit == SINGLE_EXIT) { mtx_lock_spin(&sched_lock); TAILQ_REMOVE(&p->p_suspended, td, td_runq); @@ -688,7 +688,7 @@ thread_suspend_check(int return_instead) p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); while (P_SHOULDSTOP(p)) { - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { KASSERT(p->p_singlethread != NULL, ("singlethread not set")); /* @@ -706,7 +706,7 @@ thread_suspend_check(int return_instead) /* * If the process is waiting for us to exit, * this thread should just suicide. - * Assumes that P_SINGLE_EXIT implies P_STOPPED_SNGL. + * Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE. */ if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { mtx_lock_spin(&sched_lock); @@ -729,7 +729,7 @@ thread_suspend_check(int return_instead) * and can only be lent in STOPPED state. */ mtx_lock_spin(&sched_lock); - if ((p->p_flag & P_STOPPED_SGNL) && + if ((p->p_flag & P_STOPPED_SIG) && (p->p_suspcount+1 == p->p_numthreads)) { mtx_unlock_spin(&sched_lock); PROC_LOCK(p->p_pptr); @@ -745,7 +745,7 @@ thread_suspend_check(int return_instead) td->td_state = TDS_SUSPENDED; TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq); PROC_UNLOCK(p); - if (P_SHOULDSTOP(p) == P_STOPPED_SNGL) { + if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount) { TAILQ_REMOVE(&p->p_suspended, p->p_singlethread, td_runq); @@ -805,7 +805,7 @@ thread_unsuspend(struct proc *p) while (( td = TAILQ_FIRST(&p->p_suspended))) { thread_unsuspend_one(td); } - } else if ((P_SHOULDSTOP(p) == P_STOPPED_SNGL) && + } else if ((P_SHOULDSTOP(p) == P_STOPPED_SINGLE) && (p->p_numthreads == p->p_suspcount)) { /* * Stopping everything also did the job for the single @@ -825,7 +825,7 @@ thread_single_end(void) td = curthread; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_flag &= ~P_STOPPED_SNGL; + p->p_flag &= ~P_STOPPED_SINGLE; p->p_singlethread = NULL; /* * If there are other threads they mey now run, diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 69c0d6f..1067314 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -600,7 +600,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) if (P_SHOULDSTOP(p)) { p->p_xstat = data; mtx_lock_spin(&sched_lock); - p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SGNL); + p->p_flag &= ~(P_STOPPED_TRACE|P_STOPPED_SIG); setrunnable(td2); /* XXXKSE */ /* Need foreach kse in proc, ... make_kse_queued(). */ mtx_unlock_spin(&sched_lock); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b393c99..7c0e570 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -562,13 +562,15 @@ struct proc { #define P_CONTINUED 0x10000 /* Proc has continued from a stopped state. */ /* flags that control how threads may be suspended for some reason */ -#define P_STOPPED_SGNL 0x20000 /* Stopped due to SIGSTOP/SIGTSTP */ -#define P_STOPPED_TRACE 0x40000 /* Stopped because of tracing */ -#define P_STOPPED_SNGL 0x80000 /* Only one thread can continue (not to user) */ -#define P_SINGLE_EXIT 0x00400 /* Threads suspending should exit, not wait */ -#define P_TRACED 0x00800 /* Debugged process being traced. */ -#define P_STOPPED (P_STOPPED_SGNL|P_STOPPED_SNGL|P_STOPPED_TRACE) -#define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) +#define P_STOPPED_SIG 0x20000 /* Stopped due to SIGSTOP/SIGTSTP */ +#define P_STOPPED_TRACE 0x40000 /* Stopped because of tracing */ +#define P_STOPPED_SINGLE 0x80000 /* Only one thread can continue */ + /* (not to user) */ +#define P_SINGLE_EXIT 0x00400 /* Threads suspending should exit, */ + /* not wait */ +#define P_TRACED 0x00800 /* Debugged process being traced. */ +#define P_STOPPED (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) +#define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) /* Should be moved to machine-dependent areas. */ #define P_UNUSED100000 0x100000 @@ -862,8 +864,8 @@ void thread_link(struct thread *td, struct ksegrp *kg); void thread_reap(void); struct thread *thread_schedule_upcall(struct thread *td, struct kse *ke); int thread_single(int how); -#define SNGLE_NO_EXIT 0 /* values for 'how' */ -#define SNGLE_EXIT 1 +#define SINGLE_NO_EXIT 0 /* values for 'how' */ +#define SINGLE_EXIT 1 void thread_single_end(void); void thread_stash(struct thread *td); int thread_suspend_check(int how); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 49e1dd7..24b27e3 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -688,7 +688,8 @@ retry: PROC_LOCK(p); if (p->p_lock != 0 || - (p->p_flag & (P_STOPPED_SNGL|P_TRACED|P_SYSTEM|P_WEXIT)) != 0) { + (p->p_flag & (P_STOPPED_SINGLE|P_TRACED|P_SYSTEM|P_WEXIT) + ) != 0) { goto nextproc2; } /* |