diff options
author | eivind <eivind@FreeBSD.org> | 1999-01-08 17:31:30 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1999-01-08 17:31:30 +0000 |
commit | a8dc66f457be84eefbe16e70c901ceb11137ba65 (patch) | |
tree | e5747f527c552fa90334c779c047697b372582fb /sys/kern/kern_proc.c | |
parent | 1c69824749ed0aa6efce159d39ab3f17fc9e25f2 (diff) | |
download | FreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.zip FreeBSD-src-a8dc66f457be84eefbe16e70c901ceb11137ba65.tar.gz |
Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT as
discussed on -hackers.
Introduce 'KASSERT(assertion, ("panic message", args))' for simple
check + panic.
Reviewed by: msmith
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 9f046a3..313a9e7 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $Id: kern_proc.c,v 1.39 1998/11/11 10:03:55 truckman Exp $ + * $Id: kern_proc.c,v 1.40 1998/11/11 10:55:56 truckman Exp $ */ #include <sys/param.h> @@ -195,22 +195,18 @@ enterpgrp(p, pgid, mksess) { register struct pgrp *pgrp = pgfind(pgid); -#ifdef DIAGNOSTIC - if (pgrp != NULL && mksess) /* firewalls */ - panic("enterpgrp: setsid into non-empty pgrp"); - if (SESS_LEADER(p)) - panic("enterpgrp: session leader attempted setpgrp"); -#endif + KASSERT(pgrp == NULL || !mksess, + ("enterpgrp: setsid into non-empty pgrp")); + KASSERT(!SESS_LEADER(p), + ("enterpgrp: session leader attempted setpgrp")); if (pgrp == NULL) { pid_t savepid = p->p_pid; struct proc *np; /* * new process group */ -#ifdef DIAGNOSTIC - if (p->p_pid != pgid) - panic("enterpgrp: new pgrp and pid != pgid"); -#endif + KASSERT(p->p_pid == pgid, + ("enterpgrp: new pgrp and pid != pgid")); MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK); if ((np = pfind(savepid)) == NULL || np != p) @@ -232,10 +228,8 @@ enterpgrp(p, pgid, mksess) sizeof(sess->s_login)); p->p_flag &= ~P_CONTROLT; pgrp->pg_session = sess; -#ifdef DIAGNOSTIC - if (p != curproc) - panic("enterpgrp: mksession and p != curproc"); -#endif + KASSERT(p == curproc, + ("enterpgrp: mksession and p != curproc")); } else { pgrp->pg_session = p->p_session; pgrp->pg_session->s_count++; |