-/* $OpenBSD: kern_fork.c,v 1.28 2000/02/21 20:00:09 art Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.29 2000/03/03 11:31:42 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
* is in use. Remember the lowest pid that's greater
* than lastpid, so we can avoid checking for a while.
*/
- p2 = allproc.lh_first;
+ p2 = LIST_FIRST(&allproc);
again:
- for (; p2 != 0; p2 = p2->p_list.le_next) {
+ for (; p2 != 0; p2 = LIST_NEXT(p2, p_list)) {
while (p2->p_pid == lastpid ||
p2->p_pgrp->pg_id == lastpid) {
lastpid++;
-/* $OpenBSD: kern_ktrace.c,v 1.11 1999/02/11 20:34:04 deraadt Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.12 2000/03/03 11:31:42 art Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
* Clear all uses of the tracefile
*/
if (ops == KTROP_CLEARFILE) {
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) {
if (p->p_tracep == vp) {
if (ktrcanset(curp, p)) {
p->p_tracep = NULL;
*/
log(LOG_NOTICE, "ktrace write failed, errno %d, tracing stopped\n",
error);
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) {
if (p->p_tracep == vp) {
p->p_tracep = NULL;
p->p_traceflag = 0;
-/* $OpenBSD: kern_resource.c,v 1.10 1999/11/05 01:18:01 mickey Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.11 2000/03/03 11:31:43 art Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
case PRIO_USER:
if (SCARG(uap, who) == 0)
SCARG(uap, who) = curp->p_ucred->cr_uid;
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next)
+ for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list))
if (p->p_ucred->cr_uid == SCARG(uap, who) &&
p->p_nice < low)
low = p->p_nice;
case PRIO_USER:
if (SCARG(uap, who) == 0)
SCARG(uap, who) = curp->p_ucred->cr_uid;
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next)
+ for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list))
if (p->p_ucred->cr_uid == SCARG(uap, who)) {
error = donice(curp, p, SCARG(uap, prio));
found++;
-/* $OpenBSD: kern_sig.c,v 1.35 1999/11/05 01:18:01 mickey Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.36 2000/03/03 11:31:43 art Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
/*
* broadcast
*/
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (p = LIST_FIRST(&allproc); p; p = LIST_NEXT(p, p_list)) {
if (p->p_pid <= 1 || p->p_flag & P_SYSTEM ||
p == cp || !cansignal(cp, pc, p, signum))
continue;
-/* $OpenBSD: kern_synch.c,v 1.17 1999/09/05 22:20:45 tholo Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.18 2000/03/03 11:31:43 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
*/
phz = stathz ? stathz : profhz;
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (p = LIST_FIRST(&allproc); p != 0; p = LIST_NEXT(p, p_list)) {
/*
* Increment time in/out of memory and sleep time
* (if sleeping). We ignore overflow; with 16-bit int's
return;
}
- p = allproc.lh_first;
+ p = LIST_FIRST(&allproc);
switch (*mode) {
}
}
- p = p->p_list.le_next;
+ p = LIST_NEXT(p, p_list);
if (p == 0 && doingzomb == 0) {
doingzomb = 1;
p = zombproc.lh_first;
-/* $OpenBSD: kern_sysctl.c,v 1.30 2000/02/22 19:28:03 deraadt Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.31 2000/03/03 11:31:43 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
if (namelen != 2 && !(namelen == 1 && name[0] == KERN_PROC_ALL))
return (EINVAL);
- p = allproc.lh_first;
+ p = LIST_FIRST(&allproc);
doingzomb = 0;
again:
- for (; p != 0; p = p->p_list.le_next) {
+ for (; p != 0; p = LIST_NEXT(p, p_list)) {
/*
* Skip embryonic processes.
*/
-/* $OpenBSD: vfs_syscalls.c,v 1.62 2000/02/07 04:55:19 assar Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.63 2000/03/03 11:31:43 art Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
return;
if (VFS_ROOT(olddp->v_mountedhere, &newdp))
panic("mount: lost mount");
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (p = LIST_FIRST(&allproc); p != 0; p = LIST_NEXT(p, p_list)) {
+ /*
+ * XXX - we have a race with fork here. We should probably
+ * check if the process is SIDL before we fiddle with it.
+ */
fdp = p->p_fd;
if (fdp->fd_cdir == olddp) {
vrele(fdp->fd_cdir);