From bf5bfe45abafa8fdd4e3622caba07996e593ee28 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Wed, 24 Jan 1996 18:11:23 +0000 Subject: [PATCH] proc.h: Add PHOLD()/PRELE() macros to ensure the U area is not swapped while doing ptrace/procfs in it. ptrace.h: uncomment PT_ATTACH/PT_DETACH, I am committing code to do this. --- sys/sys/proc.h | 9 ++++++++- sys/sys/ptrace.h | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 49b1b525b3d8..c276b879aa31 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.8 (Berkeley) 1/21/94 - * $Id: proc.h,v 1.17 1995/03/16 18:16:22 bde Exp $ + * $Id: proc.h,v 1.18 1995/07/13 08:48:03 davidg Exp $ */ #ifndef _SYS_PROC_H_ @@ -234,6 +234,13 @@ struct pcred { FREE(s, M_SESSION); \ } +/* hold process U-area in memory, normally for ptrace/procfs work */ +#define PHOLD(p) { \ + if ((p)->p_lock++ == 0 && ((p)->p_flag & P_INMEM) == 0) \ + faultin(p); \ +} +#define PRELE(p) (--(p)->p_lock) + extern struct proc *pidhash[]; /* In param.c. */ extern struct pgrp *pgrphash[]; /* In param.c. */ extern struct proc *curproc; /* Current running proc. */ diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 9c6c15945a9b..55b176e0ceeb 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ptrace.h 8.2 (Berkeley) 1/4/94 - * $Id: ptrace.h,v 1.3 1994/08/08 13:00:27 davidg Exp $ + * $Id: ptrace.h,v 1.4 1995/03/16 18:16:23 bde Exp $ */ #ifndef _SYS_PTRACE_H_ @@ -48,10 +48,8 @@ #define PT_KILL 8 /* kill the child process */ #define PT_STEP 9 /* single step the child */ -#ifdef notdef #define PT_ATTACH 10 /* trace some running process */ #define PT_DETACH 11 /* stop tracing a process */ -#endif #define PT_FIRSTMACH 32 /* for machine-specific requests */ #include /* machine-specific requests, if any */