use LIST_FOREACH() where appropriate

This commit is contained in:
jdolecek 2003-11-02 12:01:40 +00:00
parent 159f73f5c9
commit b74c137c2a
1 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ktrace.c,v 1.80 2003/10/08 00:28:42 thorpej Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.81 2003/11/02 12:01:40 jdolecek Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.80 2003/10/08 00:28:42 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.81 2003/11/02 12:01:40 jdolecek Exp $");
#include "opt_ktrace.h" #include "opt_ktrace.h"
#include "opt_compat_mach.h" #include "opt_compat_mach.h"
@ -429,8 +429,7 @@ ktrace_common(curp, ops, facs, pid, fp)
*/ */
if (KTROP(ops) == KTROP_CLEARFILE) { if (KTROP(ops) == KTROP_CLEARFILE) {
proclist_lock_read(); proclist_lock_read();
for (p = LIST_FIRST(&allproc); p != NULL; LIST_FOREACH(p, &allproc, p_list) {
p = LIST_NEXT(p, p_list)) {
if (ktrsamefile(p->p_tracep, fp)) { if (ktrsamefile(p->p_tracep, fp)) {
if (ktrcanset(curp, p)) if (ktrcanset(curp, p))
ktrderef(p); ktrderef(p);
@ -470,8 +469,7 @@ ktrace_common(curp, ops, facs, pid, fp)
error = ESRCH; error = ESRCH;
goto done; goto done;
} }
for (p = LIST_FIRST(&pg->pg_members); p != NULL; LIST_FOREACH(p, &pg->pg_members, p_pglist) {
p = LIST_NEXT(p, p_pglist)) {
if (descend) if (descend)
ret |= ktrsetchildren(curp, p, ops, facs, fp); ret |= ktrsetchildren(curp, p, ops, facs, fp);
else else
@ -744,7 +742,7 @@ ktrwrite(p, kth)
"ktrace write failed, errno %d, tracing stopped\n", "ktrace write failed, errno %d, tracing stopped\n",
error); error);
proclist_lock_read(); proclist_lock_read();
for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) { LIST_FOREACH(p, &allproc, p_list) {
if (ktrsamefile(p->p_tracep, fp)) if (ktrsamefile(p->p_tracep, fp))
ktrderef(p); ktrderef(p);
} }