Major fixes for procfs..
Implement a "variable" directory structure. Files that do not make sense for the given process do not "appear" and cannot be opened. For example, "system" processes do not have "file", "regs" or "fpregs", because they do not have a user area. "attempt" to fill in the user area of a given process when it is being accessed via /proc/pid/mem (the user struct is just after VM_MAXUSER_ADDRESS in the process address space.) Dont do IO to the U area while it's swapped, hold it in place if possible. Lock off access to the "ctl" file if it's done a setuid like the other pseudo-files in there.
This commit is contained in:
parent
9f25bbeb48
commit
fccbd175ce
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs.h 8.6 (Berkeley) 2/3/94
|
||||
*
|
||||
* $Id: procfs.h,v 1.7 1995/11/09 08:16:01 bde Exp $
|
||||
* $Id: procfs.h,v 1.8 1995/11/16 11:39:09 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -134,6 +134,11 @@ extern int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp,
|
||||
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));
|
||||
|
||||
/* 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 *));
|
||||
|
||||
#define PROCFS_LOCKED 0x01
|
||||
#define PROCFS_WANT 0x02
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_ctl.c 8.3 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: procfs_ctl.c,v 1.7 1995/12/03 14:54:34 bde Exp $
|
||||
* $Id: procfs_ctl.c,v 1.8 1995/12/07 12:47:14 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -72,8 +72,6 @@
|
||||
procfs_fix_sstep(p); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define FIX_SSTEP(p)
|
||||
#endif
|
||||
|
||||
#define PROCFS_CTL_ATTACH 1
|
||||
@ -171,10 +169,13 @@ procfs_control(curp, p, op)
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
|
||||
#ifdef FIX_SSTEP
|
||||
/*
|
||||
* do single-step fixup if needed
|
||||
*/
|
||||
FIX_SSTEP(p);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't deliver any signal by default.
|
||||
@ -218,7 +219,9 @@ procfs_control(curp, p, op)
|
||||
* Step. Let the target process execute a single instruction.
|
||||
*/
|
||||
case PROCFS_CTL_STEP:
|
||||
PHOLD(p);
|
||||
procfs_sstep(p);
|
||||
PRELE(p);
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -301,7 +304,9 @@ procfs_doctl(curp, p, pfs, uio)
|
||||
if (nm) {
|
||||
if (TRACE_WAIT_P(curp, p)) {
|
||||
p->p_xstat = nm->nm_val;
|
||||
#ifdef FIX_SSTEP
|
||||
FIX_SSTEP(p);
|
||||
#endif
|
||||
setrunnable(p);
|
||||
} else {
|
||||
psignal(p, nm->nm_val);
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_fpregs.c 8.1 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_fpregs.c,v 1.1.1.1 1994/05/24 10:05:09 rgrimes Exp $
|
||||
* $Id: procfs_fpregs.c,v 1.2 1994/08/02 07:45:12 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,8 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/reg.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
int
|
||||
procfs_dofpregs(curp, p, pfs, uio)
|
||||
@ -68,6 +70,8 @@ procfs_dofpregs(curp, p, pfs, uio)
|
||||
if (kl > uio->uio_resid)
|
||||
kl = uio->uio_resid;
|
||||
|
||||
PHOLD(p);
|
||||
|
||||
if (kl < 0)
|
||||
error = EINVAL;
|
||||
else
|
||||
@ -80,7 +84,15 @@ procfs_dofpregs(curp, p, pfs, uio)
|
||||
else
|
||||
error = procfs_write_fpregs(p, &r);
|
||||
}
|
||||
PRELE(p);
|
||||
|
||||
uio->uio_offset = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_validfpregs(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return ((p->p_flag & P_SYSTEM) == 0);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
*
|
||||
* @(#)procfs_mem.c 8.4 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: procfs_mem.c,v 1.14 1995/12/17 07:19:24 bde Exp $
|
||||
* $Id: procfs_mem.c,v 1.15 1996/01/19 03:58:32 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -62,6 +62,7 @@
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_extern.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
static int procfs_rwmem __P((struct proc *p, struct uio *uio));
|
||||
|
||||
@ -96,10 +97,18 @@ procfs_rwmem(p, uio)
|
||||
|
||||
uva = (vm_offset_t) uio->uio_offset;
|
||||
if (uva >= VM_MAXUSER_ADDRESS) {
|
||||
|
||||
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
|
||||
error = 0;
|
||||
break;
|
||||
}
|
||||
/* we are reading the "U area", fill it in */
|
||||
PHOLD(p);
|
||||
if (p->p_flag & P_INMEM) {
|
||||
p->p_addr->u_kproc.kp_proc = *p;
|
||||
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
|
||||
}
|
||||
PRELE(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_regs.c 8.3 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_regs.c,v 1.1.1.1 1994/05/24 10:05:08 rgrimes Exp $
|
||||
* $Id: procfs_regs.c,v 1.2 1994/08/02 07:45:18 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,8 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/reg.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
int
|
||||
procfs_doregs(curp, p, pfs, uio)
|
||||
@ -68,6 +70,8 @@ procfs_doregs(curp, p, pfs, uio)
|
||||
if (kl > uio->uio_resid)
|
||||
kl = uio->uio_resid;
|
||||
|
||||
PHOLD(p);
|
||||
|
||||
if (kl < 0)
|
||||
error = EINVAL;
|
||||
else
|
||||
@ -80,7 +84,15 @@ procfs_doregs(curp, p, pfs, uio)
|
||||
else
|
||||
error = procfs_write_regs(p, &r);
|
||||
}
|
||||
PRELE(p);
|
||||
|
||||
uio->uio_offset = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_validregs(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return ((p->p_flag & P_SYSTEM) == 0);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.18 1995/11/09 08:16:04 bde Exp $
|
||||
* $Id: procfs_vnops.c,v 1.19 1995/11/16 11:39:11 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -81,21 +81,20 @@ static struct pfsnames {
|
||||
u_short d_namlen;
|
||||
char d_name[PROCFS_NAMELEN];
|
||||
pfstype d_pfstype;
|
||||
int (*d_valid) __P((struct proc *));
|
||||
} procent[] = {
|
||||
#define N(s) sizeof(s)-1, s
|
||||
/* namlen, nam, type */
|
||||
{ N("."), Pproc },
|
||||
{ N(".."), Proot },
|
||||
#if 0
|
||||
{ N("file"), Pfile },
|
||||
#endif
|
||||
{ N("mem"), Pmem },
|
||||
{ N("regs"), Pregs },
|
||||
{ N("fpregs"), Pfpregs },
|
||||
{ N("ctl"), Pctl },
|
||||
{ N("status"), Pstatus },
|
||||
{ N("note"), Pnote },
|
||||
{ N("notepg"), Pnotepg },
|
||||
/* namlen, nam, type validp */
|
||||
{ N("."), Pproc, NULL },
|
||||
{ N(".."), Proot, NULL },
|
||||
{ N("file"), Pfile, procfs_validfile },
|
||||
{ N("mem"), Pmem, NULL },
|
||||
{ N("regs"), Pregs, procfs_validregs },
|
||||
{ N("fpregs"), Pfpregs, procfs_validfpregs },
|
||||
{ N("ctl"), Pctl, NULL },
|
||||
{ N("status"), Pstatus, NULL },
|
||||
{ N("note"), Pnote, NULL },
|
||||
{ N("notepg"), Pnotepg, NULL },
|
||||
#undef N
|
||||
};
|
||||
#define Nprocent (sizeof(procent)/sizeof(procent[0]))
|
||||
@ -356,6 +355,7 @@ procfs_getattr(ap)
|
||||
* that only root can gain access.
|
||||
*/
|
||||
switch (pfs->pfs_type) {
|
||||
case Pctl:
|
||||
case Pregs:
|
||||
case Pfpregs:
|
||||
if (procp->p_flag & P_SUGID)
|
||||
@ -599,7 +599,8 @@ procfs_lookup(ap)
|
||||
struct pfsnames *dp = &procent[i];
|
||||
|
||||
if (cnp->cn_namelen == dp->d_namlen &&
|
||||
bcmp(pname, dp->d_name, dp->d_namlen) == 0) {
|
||||
bcmp(pname, dp->d_name, dp->d_namlen) == 0 &&
|
||||
(dp->d_valid == NULL || (*dp->d_valid)(procp))) {
|
||||
pfs_type = dp->d_pfstype;
|
||||
goto found;
|
||||
}
|
||||
@ -632,6 +633,16 @@ procfs_lookup(ap)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Does this process have a text file?
|
||||
*/
|
||||
int
|
||||
procfs_validfile(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return (procfs_findtextvp(p) != NULLVP);
|
||||
}
|
||||
|
||||
/*
|
||||
* readdir returns directory entries from pfsnode (vp).
|
||||
*
|
||||
@ -676,6 +687,12 @@ procfs_readdir(ap)
|
||||
* from the procent[] table (top of this file).
|
||||
*/
|
||||
case Pproc: {
|
||||
struct proc *p;
|
||||
|
||||
p = PFIND(pfs->pfs_pid);
|
||||
if (p == NULL)
|
||||
break;
|
||||
|
||||
while (uio->uio_resid >= UIO_MX) {
|
||||
struct pfsnames *dt;
|
||||
|
||||
@ -684,6 +701,12 @@ procfs_readdir(ap)
|
||||
|
||||
dt = &procent[i];
|
||||
|
||||
/* see if we should show this one. */
|
||||
if (dt->d_valid && (*dt->d_valid)(p) == 0) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
dp->d_reclen = UIO_MX;
|
||||
dp->d_fileno = PROCFS_FILENO(pfs->pfs_pid, dt->d_pfstype);
|
||||
dp->d_type = DT_REG;
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs.h 8.6 (Berkeley) 2/3/94
|
||||
*
|
||||
* $Id: procfs.h,v 1.7 1995/11/09 08:16:01 bde Exp $
|
||||
* $Id: procfs.h,v 1.8 1995/11/16 11:39:09 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -134,6 +134,11 @@ extern int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp,
|
||||
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));
|
||||
|
||||
/* 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 *));
|
||||
|
||||
#define PROCFS_LOCKED 0x01
|
||||
#define PROCFS_WANT 0x02
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_ctl.c 8.3 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: procfs_ctl.c,v 1.7 1995/12/03 14:54:34 bde Exp $
|
||||
* $Id: procfs_ctl.c,v 1.8 1995/12/07 12:47:14 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -72,8 +72,6 @@
|
||||
procfs_fix_sstep(p); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define FIX_SSTEP(p)
|
||||
#endif
|
||||
|
||||
#define PROCFS_CTL_ATTACH 1
|
||||
@ -171,10 +169,13 @@ procfs_control(curp, p, op)
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
|
||||
#ifdef FIX_SSTEP
|
||||
/*
|
||||
* do single-step fixup if needed
|
||||
*/
|
||||
FIX_SSTEP(p);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't deliver any signal by default.
|
||||
@ -218,7 +219,9 @@ procfs_control(curp, p, op)
|
||||
* Step. Let the target process execute a single instruction.
|
||||
*/
|
||||
case PROCFS_CTL_STEP:
|
||||
PHOLD(p);
|
||||
procfs_sstep(p);
|
||||
PRELE(p);
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -301,7 +304,9 @@ procfs_doctl(curp, p, pfs, uio)
|
||||
if (nm) {
|
||||
if (TRACE_WAIT_P(curp, p)) {
|
||||
p->p_xstat = nm->nm_val;
|
||||
#ifdef FIX_SSTEP
|
||||
FIX_SSTEP(p);
|
||||
#endif
|
||||
setrunnable(p);
|
||||
} else {
|
||||
psignal(p, nm->nm_val);
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_fpregs.c 8.1 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_fpregs.c,v 1.1.1.1 1994/05/24 10:05:09 rgrimes Exp $
|
||||
* $Id: procfs_fpregs.c,v 1.2 1994/08/02 07:45:12 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,8 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/reg.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
int
|
||||
procfs_dofpregs(curp, p, pfs, uio)
|
||||
@ -68,6 +70,8 @@ procfs_dofpregs(curp, p, pfs, uio)
|
||||
if (kl > uio->uio_resid)
|
||||
kl = uio->uio_resid;
|
||||
|
||||
PHOLD(p);
|
||||
|
||||
if (kl < 0)
|
||||
error = EINVAL;
|
||||
else
|
||||
@ -80,7 +84,15 @@ procfs_dofpregs(curp, p, pfs, uio)
|
||||
else
|
||||
error = procfs_write_fpregs(p, &r);
|
||||
}
|
||||
PRELE(p);
|
||||
|
||||
uio->uio_offset = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_validfpregs(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return ((p->p_flag & P_SYSTEM) == 0);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
*
|
||||
* @(#)procfs_mem.c 8.4 (Berkeley) 1/21/94
|
||||
*
|
||||
* $Id: procfs_mem.c,v 1.14 1995/12/17 07:19:24 bde Exp $
|
||||
* $Id: procfs_mem.c,v 1.15 1996/01/19 03:58:32 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -62,6 +62,7 @@
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_extern.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
static int procfs_rwmem __P((struct proc *p, struct uio *uio));
|
||||
|
||||
@ -96,10 +97,18 @@ procfs_rwmem(p, uio)
|
||||
|
||||
uva = (vm_offset_t) uio->uio_offset;
|
||||
if (uva >= VM_MAXUSER_ADDRESS) {
|
||||
|
||||
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
|
||||
error = 0;
|
||||
break;
|
||||
}
|
||||
/* we are reading the "U area", fill it in */
|
||||
PHOLD(p);
|
||||
if (p->p_flag & P_INMEM) {
|
||||
p->p_addr->u_kproc.kp_proc = *p;
|
||||
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
|
||||
}
|
||||
PRELE(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_regs.c 8.3 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_regs.c,v 1.1.1.1 1994/05/24 10:05:08 rgrimes Exp $
|
||||
* $Id: procfs_regs.c,v 1.2 1994/08/02 07:45:18 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,8 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/reg.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
int
|
||||
procfs_doregs(curp, p, pfs, uio)
|
||||
@ -68,6 +70,8 @@ procfs_doregs(curp, p, pfs, uio)
|
||||
if (kl > uio->uio_resid)
|
||||
kl = uio->uio_resid;
|
||||
|
||||
PHOLD(p);
|
||||
|
||||
if (kl < 0)
|
||||
error = EINVAL;
|
||||
else
|
||||
@ -80,7 +84,15 @@ procfs_doregs(curp, p, pfs, uio)
|
||||
else
|
||||
error = procfs_write_regs(p, &r);
|
||||
}
|
||||
PRELE(p);
|
||||
|
||||
uio->uio_offset = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_validregs(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return ((p->p_flag & P_SYSTEM) == 0);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.18 1995/11/09 08:16:04 bde Exp $
|
||||
* $Id: procfs_vnops.c,v 1.19 1995/11/16 11:39:11 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -81,21 +81,20 @@ static struct pfsnames {
|
||||
u_short d_namlen;
|
||||
char d_name[PROCFS_NAMELEN];
|
||||
pfstype d_pfstype;
|
||||
int (*d_valid) __P((struct proc *));
|
||||
} procent[] = {
|
||||
#define N(s) sizeof(s)-1, s
|
||||
/* namlen, nam, type */
|
||||
{ N("."), Pproc },
|
||||
{ N(".."), Proot },
|
||||
#if 0
|
||||
{ N("file"), Pfile },
|
||||
#endif
|
||||
{ N("mem"), Pmem },
|
||||
{ N("regs"), Pregs },
|
||||
{ N("fpregs"), Pfpregs },
|
||||
{ N("ctl"), Pctl },
|
||||
{ N("status"), Pstatus },
|
||||
{ N("note"), Pnote },
|
||||
{ N("notepg"), Pnotepg },
|
||||
/* namlen, nam, type validp */
|
||||
{ N("."), Pproc, NULL },
|
||||
{ N(".."), Proot, NULL },
|
||||
{ N("file"), Pfile, procfs_validfile },
|
||||
{ N("mem"), Pmem, NULL },
|
||||
{ N("regs"), Pregs, procfs_validregs },
|
||||
{ N("fpregs"), Pfpregs, procfs_validfpregs },
|
||||
{ N("ctl"), Pctl, NULL },
|
||||
{ N("status"), Pstatus, NULL },
|
||||
{ N("note"), Pnote, NULL },
|
||||
{ N("notepg"), Pnotepg, NULL },
|
||||
#undef N
|
||||
};
|
||||
#define Nprocent (sizeof(procent)/sizeof(procent[0]))
|
||||
@ -356,6 +355,7 @@ procfs_getattr(ap)
|
||||
* that only root can gain access.
|
||||
*/
|
||||
switch (pfs->pfs_type) {
|
||||
case Pctl:
|
||||
case Pregs:
|
||||
case Pfpregs:
|
||||
if (procp->p_flag & P_SUGID)
|
||||
@ -599,7 +599,8 @@ procfs_lookup(ap)
|
||||
struct pfsnames *dp = &procent[i];
|
||||
|
||||
if (cnp->cn_namelen == dp->d_namlen &&
|
||||
bcmp(pname, dp->d_name, dp->d_namlen) == 0) {
|
||||
bcmp(pname, dp->d_name, dp->d_namlen) == 0 &&
|
||||
(dp->d_valid == NULL || (*dp->d_valid)(procp))) {
|
||||
pfs_type = dp->d_pfstype;
|
||||
goto found;
|
||||
}
|
||||
@ -632,6 +633,16 @@ procfs_lookup(ap)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Does this process have a text file?
|
||||
*/
|
||||
int
|
||||
procfs_validfile(p)
|
||||
struct proc *p;
|
||||
{
|
||||
return (procfs_findtextvp(p) != NULLVP);
|
||||
}
|
||||
|
||||
/*
|
||||
* readdir returns directory entries from pfsnode (vp).
|
||||
*
|
||||
@ -676,6 +687,12 @@ procfs_readdir(ap)
|
||||
* from the procent[] table (top of this file).
|
||||
*/
|
||||
case Pproc: {
|
||||
struct proc *p;
|
||||
|
||||
p = PFIND(pfs->pfs_pid);
|
||||
if (p == NULL)
|
||||
break;
|
||||
|
||||
while (uio->uio_resid >= UIO_MX) {
|
||||
struct pfsnames *dt;
|
||||
|
||||
@ -684,6 +701,12 @@ procfs_readdir(ap)
|
||||
|
||||
dt = &procent[i];
|
||||
|
||||
/* see if we should show this one. */
|
||||
if (dt->d_valid && (*dt->d_valid)(p) == 0) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
dp->d_reclen = UIO_MX;
|
||||
dp->d_fileno = PROCFS_FILENO(pfs->pfs_pid, dt->d_pfstype);
|
||||
dp->d_type = DT_REG;
|
||||
|
Loading…
Reference in New Issue
Block a user