Use FOREACH_PROC_IN_SYSTEM instead of using its unrolled form.
This commit is contained in:
parent
ba518d666a
commit
4f506694bb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166073
@ -145,7 +145,7 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry)
|
||||
int rval = FALSE;
|
||||
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
if (p->p_sysent == entry->sysvec) {
|
||||
rval = TRUE;
|
||||
break;
|
||||
|
@ -502,7 +502,7 @@ proc0_post(void *dummy __unused)
|
||||
* time from the filesystem. Pretend that proc0 started now.
|
||||
*/
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
microuptime(&p->p_stats->p_start);
|
||||
p->p_rux.rux_runtime = 0;
|
||||
}
|
||||
|
@ -2384,7 +2384,7 @@ mountcheckdirs(struct vnode *olddp, struct vnode *newdp)
|
||||
if (vrefcnt(olddp) == 1)
|
||||
return;
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
fdp = fdhold(p);
|
||||
if (fdp == NULL)
|
||||
continue;
|
||||
@ -2481,7 +2481,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
|
||||
bzero(&xf, sizeof(xf));
|
||||
xf.xf_size = sizeof(xf);
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
if (p->p_state == PRS_NEW)
|
||||
continue;
|
||||
PROC_LOCK(p);
|
||||
@ -2563,7 +2563,7 @@ file_to_first_proc(struct file *fp)
|
||||
struct proc *p;
|
||||
int n;
|
||||
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
if (p->p_state == PRS_NEW)
|
||||
continue;
|
||||
fdp = p->p_fd;
|
||||
|
@ -629,7 +629,7 @@ ktrace(td, uap)
|
||||
*/
|
||||
if (ops == KTROP_CLEARFILE) {
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
PROC_LOCK(p);
|
||||
if (p->p_tracevp == vp) {
|
||||
if (ktrcanset(td, p)) {
|
||||
@ -968,7 +968,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req)
|
||||
*/
|
||||
cred = NULL;
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
PROC_LOCK(p);
|
||||
if (p->p_tracevp == vp) {
|
||||
mtx_lock(&ktrace_mtx);
|
||||
|
@ -142,7 +142,7 @@ getpriority(td, uap)
|
||||
if (uap->who == 0)
|
||||
uap->who = td->td_ucred->cr_uid;
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
PROC_LOCK(p);
|
||||
if (!p_cansee(td, p) &&
|
||||
p->p_ucred->cr_uid == uap->who) {
|
||||
|
@ -1676,7 +1676,7 @@ killpg1(td, sig, pgid, all)
|
||||
* broadcast
|
||||
*/
|
||||
sx_slock(&allproc_lock);
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
PROC_LOCK(p);
|
||||
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
|
||||
p == td->td_proc || p->p_state == PRS_NEW) {
|
||||
|
@ -1114,7 +1114,7 @@ DB_SHOW_COMMAND(allchains, db_show_allchains)
|
||||
int i;
|
||||
|
||||
i = 1;
|
||||
LIST_FOREACH(p, &allproc, p_list) {
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
FOREACH_THREAD_IN_PROC(p, td) {
|
||||
if (TD_ON_LOCK(td) && LIST_EMPTY(&td->td_contested)) {
|
||||
db_printf("chain %d:\n", i++);
|
||||
|
Loading…
Reference in New Issue
Block a user