summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-04-17 22:20:30 +0000
committerjhb <jhb@FreeBSD.org>2003-04-17 22:20:30 +0000
commit2e488b055b6aa01b11c73bc45e8380c582d31579 (patch)
tree11b6049674eabc23293a10e78679deda0d48cdbd /sys/kern/kern_acct.c
parent9ac24ac564ffbbdf5f5d27dd84828b25a8400e88 (diff)
downloadFreeBSD-src-2e488b055b6aa01b11c73bc45e8380c582d31579.zip
FreeBSD-src-2e488b055b6aa01b11c73bc45e8380c582d31579.tar.gz
Hold the proc lock across a wider range of fields that it protects.
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 60b2cd7..9de4641 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -238,6 +238,7 @@ acct_process(td)
* Get process accounting information.
*/
+ PROC_LOCK(p);
/* (1) The name of the command that ran */
bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm);
@@ -272,17 +273,16 @@ acct_process(td)
acct.ac_gid = p->p_ucred->cr_rgid;
/* (7) The terminal from which the process was started */
- PROC_LOCK(p);
SESS_LOCK(p->p_session);
if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp)
acct.ac_tty = dev2udev(p->p_pgrp->pg_session->s_ttyp->t_dev);
else
acct.ac_tty = NOUDEV;
SESS_UNLOCK(p->p_session);
- PROC_UNLOCK(p);
/* (8) The boolean flags that tell how the process terminated, etc. */
acct.ac_flag = p->p_acflag;
+ PROC_UNLOCK(p);
/*
* Write the accounting information to the file.
OpenPOWER on IntegriCloud