diff options
author | attilio <attilio@FreeBSD.org> | 2007-06-09 21:48:44 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2007-06-09 21:48:44 +0000 |
commit | 12d804e413f2c44d9e10f25ee1b546f2b48c598b (patch) | |
tree | 7fca182049d1ed6ecc1c3b117e1d77c681c922c3 /sys/fs/procfs | |
parent | 82a09af23776643f85a5e710a09bef3be83823d9 (diff) | |
download | FreeBSD-src-12d804e413f2c44d9e10f25ee1b546f2b48c598b.zip FreeBSD-src-12d804e413f2c44d9e10f25ee1b546f2b48c598b.tar.gz |
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)
Diffstat (limited to 'sys/fs/procfs')
-rw-r--r-- | sys/fs/procfs/procfs_status.c | 3 |
1 files changed, 2 insertions, 1 deletions
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"); } |