diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-05-22 17:05:00 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-05-22 17:05:00 +0000 |
commit | 7c592a9aed3ed2ced3fc174cf9d75bd443193b91 (patch) | |
tree | 0693b45049e38f3b4bbf94b6228f6dd15c3ec15d /sys | |
parent | 06f95dcc1b4ae1bdde39826dadeea050324c1030 (diff) |
Use LIST_FOREACH() instead of handrolling.
From: Pierre Riteau pierre.riteau_att_gmail.com
OK miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_ktrace.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_resource.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 4 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index ce85d215862..61c1a6929b1 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.42 2007/05/16 17:27:30 art Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.43 2008/05/22 17:04:59 thib Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -322,7 +322,7 @@ sys_ktrace(struct proc *curp, void *v, register_t *retval) * Clear all uses of the tracefile */ if (ops == KTROP_CLEARFILE) { - for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) { + LIST_FOREACH(p, &allproc, p_list) { if (p->p_tracep == vp) { if (ktrcanset(curp, p)) { p->p_traceflag = 0; @@ -476,7 +476,7 @@ ktrwrite(struct proc *p, struct ktr_header *kth) */ log(LOG_NOTICE, "ktrace write failed, errno %d, tracing stopped\n", error); - for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) { + LIST_FOREACH(p, &allproc, p_list) { if (p->p_tracep == vp) { p->p_traceflag = 0; ktrsettracevnode(p, NULL); diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index f139dbd2f0a..f50d88b5263 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.32 2007/04/12 22:14:15 tedu Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.33 2008/05/22 17:04:59 thib Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -100,7 +100,7 @@ sys_getpriority(struct proc *curp, void *v, register_t *retval) case PRIO_USER: if (SCARG(uap, who) == 0) SCARG(uap, who) = curp->p_ucred->cr_uid; - for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) + LIST_FOREACH(p, &allproc, p_list) if (p->p_ucred->cr_uid == SCARG(uap, who) && p->p_nice < low) low = p->p_nice; @@ -157,7 +157,7 @@ sys_setpriority(struct proc *curp, void *v, register_t *retval) case PRIO_USER: if (SCARG(uap, who) == 0) SCARG(uap, who) = curp->p_ucred->cr_uid; - for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) + LIST_FOREACH(p, &allproc, p_list) if (p->p_ucred->cr_uid == SCARG(uap, who)) { error = donice(curp, p, SCARG(uap, prio)); found++; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index b28d29a6a35..d698eb5030e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.97 2007/11/27 16:22:13 martynas Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.98 2008/05/22 17:04:59 thib Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -621,7 +621,7 @@ killpg1(struct proc *cp, int signum, int pgid, int all) /* * broadcast */ - for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) { + LIST_FOREACH(p, &allproc, p_list) { if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || p == cp || !cansignal(cp, pc, p, signum)) continue; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ff7851c71f9..ec94aabf74a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.145 2008/01/22 14:33:40 millert Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.146 2008/05/22 17:04:59 thib Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -330,7 +330,7 @@ checkdirs(struct vnode *olddp) return; if (VFS_ROOT(olddp->v_mountedhere, &newdp)) panic("mount: lost mount"); - for (p = LIST_FIRST(&allproc); p != 0; p = LIST_NEXT(p, p_list)) { + LIST_FOREACH(p, &allproc, p_list) { fdp = p->p_fd; if (fdp->fd_cdir == olddp) { vrele(fdp->fd_cdir); |