Clean-up the new VM map procfs code, and also add support for executable

format file "etype".  It contains a description of the binary type for
a process.
This commit is contained in:
John Dyson
1996-06-18 05:16:00 +00:00
parent 2a7a2545a4
commit 6ead3edd9c
14 changed files with 63 additions and 19 deletions
+3 -1
View File
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_sysvec.c,v 1.5 1996/05/01 06:31:18 jkh Exp $
* $Id: linux_sysvec.c,v 1.6 1996/06/12 05:06:29 gpalmer Exp $
*/
/* XXX we use functions that might not exist. */
@@ -382,6 +382,7 @@ struct sysentvec linux_sysvec = {
linux_sigcode,
&linux_szsigcode,
linux_prepsyscall,
"Linux a.out"
};
struct sysentvec elf_linux_sysvec = {
@@ -397,6 +398,7 @@ struct sysentvec elf_linux_sysvec = {
linux_sigcode,
&linux_szsigcode,
linux_prepsyscall,
"Linux ELF"
};
/*
+7 -2
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs.h 8.6 (Berkeley) 2/3/94
*
* $Id: procfs.h,v 1.9 1996/01/24 18:40:37 peter Exp $
* $Id: procfs.h,v 1.10 1996/06/17 22:43:35 dyson Exp $
*/
/*
@@ -53,7 +53,8 @@ typedef enum {
Pstatus, /* process status */
Pnote, /* process notifier */
Pnotepg, /* process group notifier */
Pmap /* memory map */
Pmap, /* memory map */
Ptype /* executable type */
} pfstype;
/*
@@ -134,11 +135,15 @@ extern int procfs_dofpregs __P((struct proc *, struct proc *, struct pfsnode *pf
extern int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_doctl __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_dostatus __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_domap __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_dotype __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
/* check to see if the process has the "items" (regs/file) */
int procfs_validfile __P((struct proc *));
int procfs_validfpregs __P((struct proc *));
int procfs_validregs __P((struct proc *));
int procfs_validmap __P((struct proc *));
int procfs_validtype __P((struct proc *));
#define PROCFS_LOCKED 0x01
#define PROCFS_WANT 0x02
+8 -1
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_status.c 8.3 (Berkeley) 2/17/94
*
* $Id: procfs_status.c,v 1.5 1996/02/02 05:19:20 wosch Exp $
* $Id: procfs_map.c,v 1.1 1996/06/17 22:53:27 dyson Exp $
*/
#include <sys/param.h>
@@ -167,3 +167,10 @@ case OBJT_DEVICE:
kmem_free(kernel_map, (vm_offset_t)kbuffer, MAXKBUFFER);
return error;
}
int
procfs_validmap(p)
struct proc *p;
{
return ((p->p_flag & P_SYSTEM) == 0);
}
+5 -1
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_subr.c 8.4 (Berkeley) 1/27/94
*
* $Id: procfs_subr.c,v 1.6 1996/06/12 03:37:36 davidg Exp $
* $Id: procfs_subr.c,v 1.7 1996/06/17 22:43:35 dyson Exp $
*/
#include <sys/param.h>
@@ -166,6 +166,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
pfs->pfs_mode = (VWRITE);
break;
case Ptype:
case Pmap:
case Pstatus:
pfs->pfs_mode = (VREAD) |
@@ -257,6 +258,9 @@ procfs_rw(ap)
case Pmem:
return (procfs_domem(curp, p, pfs, uio));
case Ptype:
return (procfs_dotype(curp, p, pfs, uio));
default:
return (EOPNOTSUPP);
}
+4 -2
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
*
* $Id: procfs_vnops.c,v 1.21 1996/03/11 06:13:09 hsu Exp $
* $Id: procfs_vnops.c,v 1.22 1996/06/17 22:43:36 dyson Exp $
*/
/*
@@ -95,7 +95,8 @@ static struct pfsnames {
{ N("status"), Pstatus, NULL },
{ N("note"), Pnote, NULL },
{ N("notepg"), Pnotepg, NULL },
{ N("map"), Pmap, NULL },
{ N("map"), Pmap, procfs_validmap },
{ N("etype"), Ptype, procfs_validtype },
#undef N
};
#define Nprocent (sizeof(procent)/sizeof(procent[0]))
@@ -431,6 +432,7 @@ procfs_getattr(ap)
vap->va_gid = KMEM_GROUP;
break;
case Ptype:
case Pmap:
case Pregs:
case Pfpregs:
+3 -2
View File
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ibcs2_sysvec.c,v 1.2 1996/03/02 19:37:43 peter Exp $
* $Id: ibcs2_sysvec.c,v 1.3 1996/03/27 18:39:40 swallace Exp $
*/
#include <sys/param.h>
@@ -53,5 +53,6 @@ struct sysentvec ibcs2_svr3_sysvec = {
sendsig,
sigcode, /* use generic trampoline */
&szsigcode, /* use generic trampoline size */
0 /* prepsyscall */
0, /* prepsyscall */
"IBCS2 COFF"
};
+3 -1
View File
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_sysvec.c,v 1.5 1996/05/01 06:31:18 jkh Exp $
* $Id: linux_sysvec.c,v 1.6 1996/06/12 05:06:29 gpalmer Exp $
*/
/* XXX we use functions that might not exist. */
@@ -382,6 +382,7 @@ struct sysentvec linux_sysvec = {
linux_sigcode,
&linux_szsigcode,
linux_prepsyscall,
"Linux a.out"
};
struct sysentvec elf_linux_sysvec = {
@@ -397,6 +398,7 @@ struct sysentvec elf_linux_sysvec = {
linux_sigcode,
&linux_szsigcode,
linux_prepsyscall,
"Linux ELF"
};
/*
+2 -1
View File
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: imgact_elf.c,v 1.5 1996/05/01 02:42:43 bde Exp $
* $Id: imgact_elf.c,v 1.6 1996/06/12 05:07:25 gpalmer Exp $
*/
#include <sys/param.h>
@@ -90,6 +90,7 @@ static struct sysentvec elf_freebsd_sysvec = {
sigcode,
&szsigcode,
0,
"FreeBSD ELF"
};
static Elf32_Interp_info freebsd_interp = {
+2 -1
View File
@@ -1,7 +1,7 @@
/*
* sysentvec for native FreeBSD a.out executable format.
*
* $Id$
* $Id: init_sysvec.c,v 1.1 1996/03/02 19:38:08 peter Exp $
*/
#include <sys/types.h>
@@ -26,4 +26,5 @@ struct sysentvec aout_sysvec = {
sigcode,
&szsigcode,
0,
"FreeBSD a.out"
};
+7 -2
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs.h 8.6 (Berkeley) 2/3/94
*
* $Id: procfs.h,v 1.9 1996/01/24 18:40:37 peter Exp $
* $Id: procfs.h,v 1.10 1996/06/17 22:43:35 dyson Exp $
*/
/*
@@ -53,7 +53,8 @@ typedef enum {
Pstatus, /* process status */
Pnote, /* process notifier */
Pnotepg, /* process group notifier */
Pmap /* memory map */
Pmap, /* memory map */
Ptype /* executable type */
} pfstype;
/*
@@ -134,11 +135,15 @@ extern int procfs_dofpregs __P((struct proc *, struct proc *, struct pfsnode *pf
extern int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_doctl __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_dostatus __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_domap __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
extern int procfs_dotype __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
/* check to see if the process has the "items" (regs/file) */
int procfs_validfile __P((struct proc *));
int procfs_validfpregs __P((struct proc *));
int procfs_validregs __P((struct proc *));
int procfs_validmap __P((struct proc *));
int procfs_validtype __P((struct proc *));
#define PROCFS_LOCKED 0x01
#define PROCFS_WANT 0x02
+8 -1
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_status.c 8.3 (Berkeley) 2/17/94
*
* $Id: procfs_status.c,v 1.5 1996/02/02 05:19:20 wosch Exp $
* $Id: procfs_map.c,v 1.1 1996/06/17 22:53:27 dyson Exp $
*/
#include <sys/param.h>
@@ -167,3 +167,10 @@ case OBJT_DEVICE:
kmem_free(kernel_map, (vm_offset_t)kbuffer, MAXKBUFFER);
return error;
}
int
procfs_validmap(p)
struct proc *p;
{
return ((p->p_flag & P_SYSTEM) == 0);
}
+5 -1
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_subr.c 8.4 (Berkeley) 1/27/94
*
* $Id: procfs_subr.c,v 1.6 1996/06/12 03:37:36 davidg Exp $
* $Id: procfs_subr.c,v 1.7 1996/06/17 22:43:35 dyson Exp $
*/
#include <sys/param.h>
@@ -166,6 +166,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
pfs->pfs_mode = (VWRITE);
break;
case Ptype:
case Pmap:
case Pstatus:
pfs->pfs_mode = (VREAD) |
@@ -257,6 +258,9 @@ procfs_rw(ap)
case Pmem:
return (procfs_domem(curp, p, pfs, uio));
case Ptype:
return (procfs_dotype(curp, p, pfs, uio));
default:
return (EOPNOTSUPP);
}
+4 -2
View File
@@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
*
* $Id: procfs_vnops.c,v 1.21 1996/03/11 06:13:09 hsu Exp $
* $Id: procfs_vnops.c,v 1.22 1996/06/17 22:43:36 dyson Exp $
*/
/*
@@ -95,7 +95,8 @@ static struct pfsnames {
{ N("status"), Pstatus, NULL },
{ N("note"), Pnote, NULL },
{ N("notepg"), Pnotepg, NULL },
{ N("map"), Pmap, NULL },
{ N("map"), Pmap, procfs_validmap },
{ N("etype"), Ptype, procfs_validtype },
#undef N
};
#define Nprocent (sizeof(procent)/sizeof(procent[0]))
@@ -431,6 +432,7 @@ procfs_getattr(ap)
vap->va_gid = KMEM_GROUP;
break;
case Ptype:
case Pmap:
case Pregs:
case Pfpregs:
+2 -1
View File
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sysent.h,v 1.8 1996/03/29 14:29:50 bde Exp $
* $Id: sysent.h,v 1.9 1996/04/04 01:08:20 smpatel Exp $
*/
#ifndef _SYS_SYSENT_H_
@@ -62,6 +62,7 @@ struct sysentvec {
int *sv_szsigcode; /* size of sigtramp code */
void (*sv_prepsyscall) __P((struct trapframe *, int *,
u_int *, caddr_t *));
char *sv_name; /* name of binary type */
};
#ifdef KERNEL