Deleted Added
full compact
procfs_ctl.c (94624) procfs_ctl.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_ctl.c 8.4 (Berkeley) 6/15/94
38 *
39 * From:
40 * $Id: procfs_ctl.c,v 3.2 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_ctl.c 8.4 (Berkeley) 6/15/94
38 *
39 * From:
40 * $Id: procfs_ctl.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
41 * $FreeBSD: head/sys/fs/procfs/procfs_ctl.c 94624 2002-04-13 23:19:13Z jhb $
41 * $FreeBSD: head/sys/fs/procfs/procfs_ctl.c 96886 2002-05-19 00:14:50Z jhb $
42 */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/lock.h>
47#include <sys/mutex.h>
48#include <sys/proc.h>
49#include <sys/ptrace.h>

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

117
118 /*
119 * Attach - attaches the target process for debugging
120 * by the calling process.
121 */
122 if (op == PROCFS_CTL_ATTACH) {
123 sx_xlock(&proctree_lock);
124 PROC_LOCK(p);
42 */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/lock.h>
47#include <sys/mutex.h>
48#include <sys/proc.h>
49#include <sys/ptrace.h>

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

117
118 /*
119 * Attach - attaches the target process for debugging
120 * by the calling process.
121 */
122 if (op == PROCFS_CTL_ATTACH) {
123 sx_xlock(&proctree_lock);
124 PROC_LOCK(p);
125 if ((error = p_candebug(td->td_proc, p)) != 0)
125 if ((error = p_candebug(td, p)) != 0)
126 goto out;
127 if (p->p_flag & P_TRACED) {
128 error = EBUSY;
129 goto out;
130 }
131
132 /* Can't trace yourself! */
133 if (p->p_pid == td->td_proc->p_pid) {

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

160 /*
161 * Authorization check: rely on normal debugging protection, except
162 * allow processes to disengage debugging on a process onto which
163 * they have previously attached, but no longer have permission to
164 * debug.
165 */
166 PROC_LOCK(p);
167 if (op != PROCFS_CTL_DETACH &&
126 goto out;
127 if (p->p_flag & P_TRACED) {
128 error = EBUSY;
129 goto out;
130 }
131
132 /* Can't trace yourself! */
133 if (p->p_pid == td->td_proc->p_pid) {

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

160 /*
161 * Authorization check: rely on normal debugging protection, except
162 * allow processes to disengage debugging on a process onto which
163 * they have previously attached, but no longer have permission to
164 * debug.
165 */
166 PROC_LOCK(p);
167 if (op != PROCFS_CTL_DETACH &&
168 ((error = p_candebug(td->td_proc, p)))) {
168 ((error = p_candebug(td, p)))) {
169 PROC_UNLOCK(p);
170 return (error);
171 }
172
173 /*
174 * Target process must be stopped, owned by (td) and
175 * be set up for tracing (P_TRACED flag set).
176 * Allow DETACH to take place at any time for sanity.

--- 186 unchanged lines hidden ---
169 PROC_UNLOCK(p);
170 return (error);
171 }
172
173 /*
174 * Target process must be stopped, owned by (td) and
175 * be set up for tracing (P_TRACED flag set).
176 * Allow DETACH to take place at any time for sanity.

--- 186 unchanged lines hidden ---