diff options
author | jhb <jhb@FreeBSD.org> | 2002-04-13 23:09:41 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-04-13 23:09:41 +0000 |
commit | 511ba1872bd9314e659a8de9a82e78964aace874 (patch) | |
tree | e1dbe8d813a4c083c06f2542d5cdf7f85a7bdddd /sys/compat | |
parent | 95ee443e6cab0adc5860cb2ee5727179a23264ef (diff) | |
download | FreeBSD-src-511ba1872bd9314e659a8de9a82e78964aace874.zip FreeBSD-src-511ba1872bd9314e659a8de9a82e78964aace874.tar.gz |
- p_cansee() needs the target process locked.
- We need the proc lock held for more of procfs_doprocstatus().
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 3344ca1..c02aec7 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -672,23 +672,21 @@ linprocfs_doproccmdline(PFS_FILL_ARGS) * Linux behaviour is to return zero-length in this case. */ - if (ps_argsopen || !p_cansee(td->td_proc, p)) { - PROC_LOCK(p); - if (p->p_args) { - sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); - PROC_UNLOCK(p); - } else if (p != td->td_proc) { - sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm); - PROC_UNLOCK(p); - } else { - PROC_UNLOCK(p); - error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr)); - if (error) - return (error); - for (i = 0; i < pstr.ps_nargvstr; i++) { - sbuf_copyin(sb, pstr.ps_argvstr[i], 0); - sbuf_printf(sb, "%c", '\0'); - } + PROC_LOCK(p); + if (p->p_args && (ps_argsopen || !p_cansee(td->td_proc, p))) { + sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length); + PROC_UNLOCK(p); + } else if (p != td->td_proc) { + PROC_UNLOCK(p); + sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm); + } else { + PROC_UNLOCK(p); + error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr)); + if (error) + return (error); + for (i = 0; i < pstr.ps_nargvstr; i++) { + sbuf_copyin(sb, pstr.ps_argvstr[i], 0); + sbuf_printf(sb, "%c", '\0'); } } |