From 12d804e413f2c44d9e10f25ee1b546f2b48c598b Mon Sep 17 00:00:00 2001 From: attilio Date: Sat, 9 Jun 2007 21:48:44 +0000 Subject: rufetch and calcru sometimes should be called atomically together. This patch fixes places where they should be called atomically changing their locking requirements (both assume per-proc spinlock held) and introducing rufetchcalc which wrappers both calls to be performed in atomic way. Reviewed by: jeff Approved by: jeff (mentor) --- sys/fs/procfs/procfs_status.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/fs') diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index b92d157..1a8148b 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -127,12 +127,12 @@ procfs_doprocstatus(PFS_FILL_ARGS) } else wmesg = "nochan"; } - PROC_SUNLOCK(p); if (p->p_sflag & PS_INMEM) { struct timeval start, ut, st; calcru(p, &ut, &st); + PROC_SUNLOCK(p); start = p->p_stats->p_start; timevaladd(&start, &boottime); sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld", @@ -140,6 +140,7 @@ procfs_doprocstatus(PFS_FILL_ARGS) (intmax_t)ut.tv_sec, ut.tv_usec, (intmax_t)st.tv_sec, st.tv_usec); } else { + PROC_SUNLOCK(p); sbuf_printf(sb, " -1,-1 -1,-1 -1,-1"); } -- cgit v1.1