Deleted Added
full compact
procfs_status.c (94620) procfs_status.c (96886)
1/*
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94
38 *
39 * From:
40 * $Id: procfs_status.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
1/*
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94
38 *
39 * From:
40 * $Id: procfs_status.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
41 * $FreeBSD: head/sys/fs/procfs/procfs_status.c 94620 2002-04-13 23:09:41Z jhb $
41 * $FreeBSD: head/sys/fs/procfs/procfs_status.c 96886 2002-05-19 00:14:50Z jhb $
42 */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/exec.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>
49#include <sys/jail.h>

--- 127 unchanged lines hidden (view full) ---

177 * for the currept process and just p->p_comm for all other
178 * processes.
179 * Note that if the argv is no longer available, we deliberately
180 * don't fall back on p->p_comm or return an error: the authentic
181 * Linux behaviour is to return zero-length in this case.
182 */
183
184 PROC_LOCK(p);
42 */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/exec.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>
49#include <sys/jail.h>

--- 127 unchanged lines hidden (view full) ---

177 * for the currept process and just p->p_comm for all other
178 * processes.
179 * Note that if the argv is no longer available, we deliberately
180 * don't fall back on p->p_comm or return an error: the authentic
181 * Linux behaviour is to return zero-length in this case.
182 */
183
184 PROC_LOCK(p);
185 if (p->p_args && (ps_argsopen || !p_cansee(td->td_proc, p))) {
185 if (p->p_args && (ps_argsopen || !p_cansee(td, p))) {
186 sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
187 PROC_UNLOCK(p);
188 return (0);
189 }
190 PROC_UNLOCK(p);
191 if (p != td->td_proc) {
192 sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm);
193 } else {
194 error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr));
195 if (error)
196 return (error);
197 for (i = 0; i < pstr.ps_nargvstr; i++) {
198 sbuf_copyin(sb, pstr.ps_argvstr[i], 0);
199 sbuf_printf(sb, "%c", '\0');
200 }
201 }
202
203 return (0);
204}
186 sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
187 PROC_UNLOCK(p);
188 return (0);
189 }
190 PROC_UNLOCK(p);
191 if (p != td->td_proc) {
192 sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm);
193 } else {
194 error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr));
195 if (error)
196 return (error);
197 for (i = 0; i < pstr.ps_nargvstr; i++) {
198 sbuf_copyin(sb, pstr.ps_argvstr[i], 0);
199 sbuf_printf(sb, "%c", '\0');
200 }
201 }
202
203 return (0);
204}