remove dead code and other misc cleanup.

This commit is contained in:
chs 2000-11-24 18:58:37 +00:00
parent ccbcd7c873
commit b0ec16cc38
5 changed files with 19 additions and 114 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs.h,v 1.29 2000/03/16 18:08:26 jdolecek Exp $ */
/* $NetBSD: procfs.h,v 1.30 2000/11/24 18:58:37 chs Exp $ */
/*
* Copyright (c) 1993 Jan-Simon Pendry
@ -116,7 +116,6 @@ vfs_namemap_t *vfs_findname __P((vfs_namemap_t *, char *, int));
#define PFIND(pid) ((pid) ? pfind(pid) : &proc0)
int procfs_freevp __P((struct vnode *));
int procfs_allocvp __P((struct mount *, struct vnode **, long, pfstype));
struct vnode *procfs_findtextvp __P((struct proc *));
int procfs_donote __P((struct proc *, struct proc *, struct pfsnode *,
struct uio *));
int procfs_doregs __P((struct proc *, struct proc *, struct pfsnode *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_map.c,v 1.8 2000/06/28 02:44:07 mrg Exp $ */
/* $NetBSD: procfs_map.c,v 1.9 2000/11/24 18:58:37 chs Exp $ */
/*
* Copyright (c) 1993 Jan-Simon Pendry
@ -92,26 +92,18 @@ procfs_domap(curp, p, pfs, uio)
if (UVM_ET_ISSUBMAP(entry))
continue;
/*
* format:
* start, end, resident, private resident, cow, access, type.
*/
snprintf(mebuffer, sizeof(mebuffer),
"0x%lx 0x%lx %c%c%c %c%c%c %s %s %d %d %d\n",
entry->start, entry->end,
(entry->protection & VM_PROT_READ) ? 'r' : '-',
(entry->protection & VM_PROT_WRITE) ? 'w' : '-',
(entry->protection & VM_PROT_EXECUTE) ? 'x' : '-',
(entry->max_protection & VM_PROT_READ) ? 'r' : '-',
(entry->max_protection & VM_PROT_WRITE) ? 'w' : '-',
(entry->max_protection & VM_PROT_EXECUTE) ? 'x' : '-',
(entry->etype & UVM_ET_COPYONWRITE) ? "COW" : "NCOW",
(entry->etype & UVM_ET_NEEDSCOPY) ? "NC" : "NNC",
entry->inheritance, entry->wired_count , entry->advice
);
entry->start, entry->end,
(entry->protection & VM_PROT_READ) ? 'r' : '-',
(entry->protection & VM_PROT_WRITE) ? 'w' : '-',
(entry->protection & VM_PROT_EXECUTE) ? 'x' : '-',
(entry->max_protection & VM_PROT_READ) ? 'r' : '-',
(entry->max_protection & VM_PROT_WRITE) ? 'w' : '-',
(entry->max_protection & VM_PROT_EXECUTE) ? 'x' : '-',
(entry->etype & UVM_ET_COPYONWRITE) ? "COW" : "NCOW",
(entry->etype & UVM_ET_NEEDSCOPY) ? "NC" : "NNC",
entry->inheritance, entry->wired_count, entry->advice);
len = strlen(mebuffer);
if (len > uio->uio_resid) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_mem.c,v 1.26 2000/09/26 23:28:01 thorpej Exp $ */
/* $NetBSD: procfs_mem.c,v 1.27 2000/11/24 18:58:37 chs Exp $ */
/*
* Copyright (c) 1993 Jan-Simon Pendry
@ -100,25 +100,6 @@ procfs_domem(curp, p, pfs, uio)
return (error);
}
/*
* Given process (p), find the vnode from which
* it's text segment is being executed.
*
* It would be nice to grab this information from
* the VM system, however, there is no sure-fire
* way of doing that. Instead, fork(), exec() and
* wait() all maintain the p_textvp field in the
* process proc structure which contains a held
* reference to the exec'ed vnode.
*/
struct vnode *
procfs_findtextvp(p)
struct proc *p;
{
return (p->p_textvp);
}
/*
* Ensure that a process has permission to perform I/O on another.
* Arguments:
@ -160,70 +141,3 @@ procfs_checkioperm(p, t)
return (0);
}
#ifdef probably_never
/*
* Given process (p), find the vnode from which
* it's text segment is being mapped.
*
* (This is here, rather than in procfs_subr in order
* to keep all the VM related code in one place.)
*/
struct vnode *
procfs_findtextvp(p)
struct proc *p;
{
int error;
vm_object_t object;
vaddr_t pageno; /* page number */
/* find a vnode pager for the user address space */
for (pageno = VM_MIN_ADDRESS;
pageno < VM_MAXUSER_ADDRESS;
pageno += PAGE_SIZE) {
vm_map_t map;
vm_map_entry_t out_entry;
vm_prot_t out_prot;
boolean_t wired, single_use;
vaddr_t off;
map = &p->p_vmspace->vm_map;
error = vm_map_lookup(&map, pageno,
VM_PROT_READ,
&out_entry, &object, &off, &out_prot,
&wired, &single_use);
if (!error) {
vm_pager_t pager;
printf("procfs: found vm object\n");
vm_map_lookup_done(map, out_entry);
printf("procfs: vm object = %p\n", object);
/*
* At this point, assuming no errors, object
* is the VM object mapping UVA (pageno).
* Ensure it has a vnode pager, then grab
* the vnode from that pager's handle.
*/
pager = object->pager;
printf("procfs: pager = %p\n", pager);
if (pager)
printf("procfs: found pager, type = %d\n",
pager->pg_type);
if (pager && pager->pg_type == PG_VNODE) {
struct vnode *vp;
vp = (struct vnode *) pager->pg_handle;
printf("procfs: vp = %p\n", vp);
return (vp);
}
}
}
printf("procfs: text object not found\n");
return (0);
}
#endif /* probably_never */

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_subr.c,v 1.32 2000/11/08 14:28:14 ad Exp $ */
/* $NetBSD: procfs_subr.c,v 1.33 2000/11/24 18:58:37 chs Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou. All rights reserved.
@ -108,7 +108,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
if ((error = getnewvnode(VT_PROCFS, mp, procfs_vnodeop_p, vpp)) != 0) {
*vpp = NULL;
lockmgr(&pfs_hashlock, LK_RELEASE, 0);
lockmgr(&pfs_hashlock, LK_RELEASE, NULL);
return (error);
}
vp = *vpp;
@ -167,7 +167,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
}
procfs_hashins(pfs);
lockmgr(&pfs_hashlock, LK_RELEASE, 0);
lockmgr(&pfs_hashlock, LK_RELEASE, NULL);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_vnops.c,v 1.74 2000/08/09 23:30:49 tv Exp $ */
/* $NetBSD: procfs_vnops.c,v 1.75 2000/11/24 18:58:37 chs Exp $ */
/*
* Copyright (c) 1993 Jan-Simon Pendry
@ -806,7 +806,7 @@ procfs_lookup(v)
found:
if (pt->pt_pfstype == Pfile) {
fvp = procfs_findtextvp(p);
fvp = p->p_textvp;
/* We already checked that it exists. */
VREF(fvp);
vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY);
@ -837,7 +837,7 @@ int
procfs_validfile(p)
struct proc *p;
{
return (procfs_findtextvp(p) != NULLVP);
return (p->p_textvp != NULL);
}
#ifdef COMPAT_LINUX