Make inferior() function static, rename to p_inferior(), return bool.

This commit is contained in:
rmind 2009-03-28 21:41:05 +00:00
parent ea3400a4b7
commit 9c724ebaca
2 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_proc.c,v 1.147 2009/01/24 22:42:32 rmind Exp $ */
/* $NetBSD: kern_proc.c,v 1.148 2009/03/28 21:41:05 rmind Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.147 2009/01/24 22:42:32 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.148 2009/03/28 21:41:05 rmind Exp $");
#include "opt_kstack.h"
#include "opt_maxuprc.h"
@ -412,18 +412,18 @@ pgid_in_session(struct proc *p, pid_t pg_id)
}
/*
* Is p an inferior of q?
*
* Call with the proc_lock held.
* p_inferior: is p an inferior of q?
*/
int
inferior(struct proc *p, struct proc *q)
static inline bool
p_inferior(struct proc *p, struct proc *q)
{
KASSERT(mutex_owned(proc_lock));
for (; p != q; p = p->p_pptr)
if (p->p_pid == 0)
return 0;
return 1;
return false;
return true;
}
/*
@ -691,7 +691,7 @@ enterpgrp(struct proc *curp, pid_t pid, pid_t pgid, int mksess)
if (pid != curp->p_pid) {
/* must exist and be one of our children... */
if ((p = p_find(pid, PFIND_LOCKED)) == NULL ||
!inferior(p, curp)) {
!p_inferior(p, curp)) {
rval = ESRCH;
goto done;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.283 2008/11/19 18:36:10 ad Exp $ */
/* $NetBSD: proc.h,v 1.284 2009/03/28 21:41:06 rmind Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -485,7 +485,6 @@ struct simplelock;
int enterpgrp(struct proc *, pid_t, pid_t, int);
void leavepgrp(struct proc *);
void fixjobc(struct proc *, struct pgrp *, int);
int inferior(struct proc *, struct proc *);
void sessdelete(struct session *);
void yield(void);
void pgdelete(struct pgrp *);