summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
committerjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
commit5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch)
treeb1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/fs/procfs
parent83e00d4274950d2b531c24692cd123538ffbddb9 (diff)
downloadFreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip
FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/fs/procfs')
-rw-r--r--sys/fs/procfs/procfs.h28
-rw-r--r--sys/fs/procfs/procfs_ctl.c10
-rw-r--r--sys/fs/procfs/procfs_dbregs.c9
-rw-r--r--sys/fs/procfs/procfs_fpregs.c9
-rw-r--r--sys/fs/procfs/procfs_map.c5
-rw-r--r--sys/fs/procfs/procfs_regs.c9
-rw-r--r--sys/fs/procfs/procfs_status.c10
-rw-r--r--sys/fs/procfs/procfs_subr.c6
-rw-r--r--sys/fs/procfs/procfs_type.c5
-rw-r--r--sys/fs/procfs/procfs_vfsops.c20
-rw-r--r--sys/fs/procfs/procfs_vnops.c46
11 files changed, 81 insertions, 76 deletions
diff --git a/sys/fs/procfs/procfs.h b/sys/fs/procfs/procfs.h
index b46b9c0..d97f825 100644
--- a/sys/fs/procfs/procfs.h
+++ b/sys/fs/procfs/procfs.h
@@ -119,14 +119,14 @@ void procfs_exit __P((struct proc *));
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_sstep __P((struct proc *));
-void procfs_fix_sstep __P((struct proc *));
-int procfs_read_regs __P((struct proc *, struct reg *));
-int procfs_write_regs __P((struct proc *, struct reg *));
-int procfs_read_fpregs __P((struct proc *, struct fpreg *));
-int procfs_write_fpregs __P((struct proc *, struct fpreg *));
-int procfs_read_dbregs __P((struct proc *, struct dbreg *));
-int procfs_write_dbregs __P((struct proc *, struct dbreg *));
+int procfs_sstep __P((struct thread *));
+void procfs_fix_sstep __P((struct thread *));
+int procfs_read_regs __P((struct thread *, struct reg *));
+int procfs_write_regs __P((struct thread *, struct reg *));
+int procfs_read_fpregs __P((struct thread *, struct fpreg *));
+int procfs_write_fpregs __P((struct thread *, struct fpreg *));
+int procfs_read_dbregs __P((struct thread *, struct dbreg *));
+int procfs_write_dbregs __P((struct thread *, struct dbreg *));
int procfs_donote __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
int procfs_doregs __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
int procfs_dofpregs __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
@@ -140,12 +140,12 @@ int procfs_docmdline __P((struct proc *, struct proc *, struct pfsnode *pfsp, st
int procfs_dorlimit __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
/* functions to check whether or not files should be displayed */
-int procfs_validfile __P((struct proc *));
-int procfs_validfpregs __P((struct proc *));
-int procfs_validregs __P((struct proc *));
-int procfs_validdbregs __P((struct proc *));
-int procfs_validmap __P((struct proc *));
-int procfs_validtype __P((struct proc *));
+int procfs_validfile __P((struct thread *));
+int procfs_validfpregs __P((struct thread *));
+int procfs_validregs __P((struct thread *));
+int procfs_validdbregs __P((struct thread *));
+int procfs_validmap __P((struct thread *));
+int procfs_validtype __P((struct thread *));
#define PROCFS_LOCKED 0x01
#define PROCFS_WANT 0x02
diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c
index 30b61f2..eacf32a 100644
--- a/sys/fs/procfs/procfs_ctl.c
+++ b/sys/fs/procfs/procfs_ctl.c
@@ -190,7 +190,7 @@ out:
/*
* do single-step fixup if needed
*/
- FIX_SSTEP(p);
+ FIX_SSTEP(&p->p_thread); /* XXXKSE */
#endif
/*
@@ -246,7 +246,7 @@ out:
case PROCFS_CTL_STEP:
_PHOLD(p);
PROC_UNLOCK(p);
- error = procfs_sstep(p);
+ error = procfs_sstep(&p->p_thread); /* XXXKSE */
PRELE(p);
if (error)
return (error);
@@ -300,7 +300,7 @@ out:
mtx_lock_spin(&sched_lock);
if (p->p_stat == SSTOP)
- setrunnable(p);
+ setrunnable(&p->p_thread); /* XXXKSE */
mtx_unlock_spin(&sched_lock);
return (0);
}
@@ -347,9 +347,9 @@ procfs_doctl(curp, p, pfs, uio)
if (TRACE_WAIT_P(curp, p)) {
p->p_xstat = nm->nm_val;
#ifdef FIX_SSTEP
- FIX_SSTEP(p);
+ FIX_SSTEP(&p->p_thread); /* XXXKSE */
#endif
- setrunnable(p);
+ setrunnable(&p->p_thread); /* XXXKSE */
mtx_unlock_spin(&sched_lock);
} else {
mtx_unlock_spin(&sched_lock);
diff --git a/sys/fs/procfs/procfs_dbregs.c b/sys/fs/procfs/procfs_dbregs.c
index d61b8c9..5de041a 100644
--- a/sys/fs/procfs/procfs_dbregs.c
+++ b/sys/fs/procfs/procfs_dbregs.c
@@ -83,14 +83,14 @@ procfs_dodbregs(curp, p, pfs, uio)
if (kl < 0)
error = EINVAL;
else
- error = procfs_read_dbregs(p, &r);
+ error = procfs_read_dbregs(&p->p_thread, &r); /* XXXKSE */
if (error == 0)
error = uiomove(kv, kl, uio);
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (p->p_stat != SSTOP)
error = EBUSY;
else
- error = procfs_write_dbregs(p, &r);
+ error = procfs_write_dbregs(&p->p_thread, &r); /* XXXKSE */
}
PRELE(p);
@@ -99,9 +99,8 @@ procfs_dodbregs(curp, p, pfs, uio)
}
int
-procfs_validdbregs(p)
- struct proc *p;
+procfs_validdbregs(struct thread *td)
{
- return ((p->p_flag & P_SYSTEM) == 0);
+ return ((td->td_proc->p_flag & P_SYSTEM) == 0);
}
diff --git a/sys/fs/procfs/procfs_fpregs.c b/sys/fs/procfs/procfs_fpregs.c
index 9b6cd3a..2b68693 100644
--- a/sys/fs/procfs/procfs_fpregs.c
+++ b/sys/fs/procfs/procfs_fpregs.c
@@ -80,14 +80,14 @@ procfs_dofpregs(curp, p, pfs, uio)
if (kl < 0)
error = EINVAL;
else
- error = procfs_read_fpregs(p, &r);
+ error = procfs_read_fpregs(&p->p_thread, &r);
if (error == 0)
error = uiomove(kv, kl, uio);
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (p->p_stat != SSTOP)
error = EBUSY;
else
- error = procfs_write_fpregs(p, &r);
+ error = procfs_write_fpregs(&p->p_thread, &r);
}
PRELE(p);
@@ -96,9 +96,8 @@ procfs_dofpregs(curp, p, pfs, uio)
}
int
-procfs_validfpregs(p)
- struct proc *p;
+procfs_validfpregs(struct thread *td)
{
- return ((p->p_flag & P_SYSTEM) == 0);
+ return (( td->td_proc->p_flag & P_SYSTEM) == 0);
}
diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c
index 692594d..945639a 100644
--- a/sys/fs/procfs/procfs_map.c
+++ b/sys/fs/procfs/procfs_map.c
@@ -182,8 +182,7 @@ case OBJT_DEVICE:
}
int
-procfs_validmap(p)
- struct proc *p;
+procfs_validmap(struct thread *td)
{
- return ((p->p_flag & P_SYSTEM) == 0);
+ return ((td->td_proc->p_flag & P_SYSTEM) == 0);
}
diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c
index 6a00ecd..f590075 100644
--- a/sys/fs/procfs/procfs_regs.c
+++ b/sys/fs/procfs/procfs_regs.c
@@ -81,14 +81,14 @@ procfs_doregs(curp, p, pfs, uio)
if (kl < 0)
error = EINVAL;
else
- error = procfs_read_regs(p, &r);
+ error = procfs_read_regs(&p->p_thread, &r); /* XXXKSE */
if (error == 0)
error = uiomove(kv, kl, uio);
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (p->p_stat != SSTOP)
error = EBUSY;
else
- error = procfs_write_regs(p, &r);
+ error = procfs_write_regs(&p->p_thread, &r); /* XXXKSE */
}
PRELE(p);
@@ -97,9 +97,8 @@ procfs_doregs(curp, p, pfs, uio)
}
int
-procfs_validregs(p)
- struct proc *p;
+procfs_validregs(struct thread *td)
{
- return ((p->p_flag & P_SYSTEM) == 0);
+ return ((td->td_proc->p_flag & P_SYSTEM) == 0);
}
diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c
index 3a2a814..c75294b 100644
--- a/sys/fs/procfs/procfs_status.c
+++ b/sys/fs/procfs/procfs_status.c
@@ -145,8 +145,14 @@ procfs_dostatus(curp, p, pfs, uio)
}
DOCHECK();
- ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s",
- (p->p_wchan && p->p_wmesg) ? p->p_wmesg : "nochan");
+ if (p->p_flag & P_KSES) {
+ ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s",
+ "-kse- ");
+ } else {
+ ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s",
+ (p->p_thread.td_wchan && p->p_thread.td_wmesg) ?
+ p->p_thread.td_wmesg : "nochan");
+ }
DOCHECK();
cr = p->p_ucred;
diff --git a/sys/fs/procfs/procfs_subr.c b/sys/fs/procfs/procfs_subr.c
index 8575058..a411546 100644
--- a/sys/fs/procfs/procfs_subr.c
+++ b/sys/fs/procfs/procfs_subr.c
@@ -88,7 +88,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type)
long pid;
pfstype pfs_type;
{
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct pfsnode *pfs;
struct vnode *vp;
struct pfsnode **pp;
@@ -100,7 +100,7 @@ loop:
if (pfs->pfs_pid == pid &&
pfs->pfs_type == pfs_type &&
vp->v_mount == mp) {
- if (vget(vp, 0, p))
+ if (vget(vp, 0, td))
goto loop;
*vpp = vp;
return (0);
@@ -246,7 +246,7 @@ procfs_rw(ap)
{
struct vnode *vp = ap->a_vp;
struct uio *uio = ap->a_uio;
- struct proc *curp = uio->uio_procp;
+ struct proc *curp = uio->uio_td->td_proc;
struct pfsnode *pfs = VTOPFS(vp);
struct proc *p;
int rtval;
diff --git a/sys/fs/procfs/procfs_type.c b/sys/fs/procfs/procfs_type.c
index 3919c88..31cbcf0 100644
--- a/sys/fs/procfs/procfs_type.c
+++ b/sys/fs/procfs/procfs_type.c
@@ -78,8 +78,7 @@ procfs_dotype(curp, p, pfs, uio)
}
int
-procfs_validtype(p)
- struct proc *p;
+procfs_validtype(struct thread *td)
{
- return ((p->p_flag & P_SYSTEM) == 0);
+ return ((td->td_proc->p_flag & P_SYSTEM) == 0);
}
diff --git a/sys/fs/procfs/procfs_vfsops.c b/sys/fs/procfs/procfs_vfsops.c
index c0d7add..2442022 100644
--- a/sys/fs/procfs/procfs_vfsops.c
+++ b/sys/fs/procfs/procfs_vfsops.c
@@ -52,11 +52,11 @@
#include <fs/procfs/procfs.h>
static int procfs_mount __P((struct mount *mp, char *path, caddr_t data,
- struct nameidata *ndp, struct proc *p));
+ struct nameidata *ndp, struct thread *td));
static int procfs_statfs __P((struct mount *mp, struct statfs *sbp,
- struct proc *p));
+ struct thread *td));
static int procfs_unmount __P((struct mount *mp, int mntflags,
- struct proc *p));
+ struct thread *td));
/*
* VFS Operations.
@@ -65,12 +65,12 @@ static int procfs_unmount __P((struct mount *mp, int mntflags,
*/
/* ARGSUSED */
static int
-procfs_mount(mp, path, data, ndp, p)
+procfs_mount(mp, path, data, ndp, td)
struct mount *mp;
char *path;
caddr_t data;
struct nameidata *ndp;
- struct proc *p;
+ struct thread *td;
{
size_t size;
int error;
@@ -90,7 +90,7 @@ procfs_mount(mp, path, data, ndp, p)
size = sizeof("procfs") - 1;
bcopy("procfs", mp->mnt_stat.f_mntfromname, size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
- (void)procfs_statfs(mp, &mp->mnt_stat, p);
+ (void)procfs_statfs(mp, &mp->mnt_stat, td);
return (0);
}
@@ -99,10 +99,10 @@ procfs_mount(mp, path, data, ndp, p)
* unmount system call
*/
static int
-procfs_unmount(mp, mntflags, p)
+procfs_unmount(mp, mntflags, td)
struct mount *mp;
int mntflags;
- struct proc *p;
+ struct thread *td;
{
int error;
int flags = 0;
@@ -133,10 +133,10 @@ procfs_root(mp, vpp)
* Get file system statistics.
*/
static int
-procfs_statfs(mp, sbp, p)
+procfs_statfs(mp, sbp, td)
struct mount *mp;
struct statfs *sbp;
- struct proc *p;
+ struct thread *td;
{
sbp->f_bsize = PAGE_SIZE;
sbp->f_iosize = PAGE_SIZE;
diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c
index 206f3e5..5367078 100644
--- a/sys/fs/procfs/procfs_vnops.c
+++ b/sys/fs/procfs/procfs_vnops.c
@@ -91,7 +91,7 @@ static struct proc_target {
u_char pt_namlen;
char *pt_name;
pfstype pt_pfstype;
- int (*pt_valid) __P((struct proc *p));
+ int (*pt_valid) __P((struct thread *p));
} proc_targets[] = {
#define N(s) sizeof(s)-1, s
/* name type validp */
@@ -133,7 +133,7 @@ procfs_open(ap)
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
struct pfsnode *pfs = VTOPFS(ap->a_vp);
@@ -143,7 +143,7 @@ procfs_open(ap)
p2 = PFIND(pfs->pfs_pid);
if (p2 == NULL)
return (ENOENT);
- if (pfs->pfs_pid && p_cansee(ap->a_p, p2)) {
+ if (pfs->pfs_pid && p_cansee(ap->a_td->td_proc, p2)) {
error = ENOENT;
goto out;
}
@@ -156,7 +156,7 @@ procfs_open(ap)
goto out;
}
- p1 = ap->a_p;
+ p1 = ap->a_td->td_proc;
error = p_candebug(p1, p2);
if (error)
return (error);
@@ -185,7 +185,7 @@ procfs_close(ap)
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
struct pfsnode *pfs = VTOPFS(ap->a_vp);
@@ -235,7 +235,7 @@ procfs_ioctl(ap)
struct procfs_status *psp;
unsigned char flags;
- p = ap->a_p;
+ p = ap->a_td->td_proc;
procp = pfind(pfs->pfs_pid);
if (procp == NULL) {
return ENOTTY;
@@ -380,7 +380,7 @@ procfs_getattr(ap)
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
struct pfsnode *pfs = VTOPFS(ap->a_vp);
@@ -407,7 +407,7 @@ procfs_getattr(ap)
return (ENOENT);
}
- if (p_cansee(ap->a_p, procp)) {
+ if (p_cansee(ap->a_td->td_proc, procp)) {
PROC_UNLOCK(procp);
return (ENOENT);
}
@@ -569,7 +569,7 @@ procfs_setattr(ap)
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
@@ -603,7 +603,7 @@ procfs_access(ap)
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
struct pfsnode *pfs = VTOPFS(ap->a_vp);
@@ -621,7 +621,7 @@ procfs_access(ap)
procp = PFIND(pfs->pfs_pid);
if (procp == NULL)
return (ENOENT);
- if (p_cansee(ap->a_p, procp)) {
+ if (p_cansee(ap->a_td->td_proc, procp)) {
PROC_UNLOCK(procp);
return (ENOENT);
}
@@ -629,7 +629,7 @@ procfs_access(ap)
}
vap = &vattr;
- error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
+ error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td);
if (error)
return (error);
@@ -658,12 +658,13 @@ procfs_lookup(ap)
struct vnode **vpp = ap->a_vpp;
struct vnode *dvp = ap->a_dvp;
char *pname = cnp->cn_nameptr;
- struct proc *curp = cnp->cn_proc;
+ struct proc *curp = cnp->cn_thread->td_proc;
struct proc_target *pt;
pid_t pid;
struct pfsnode *pfs;
struct proc *p;
int i;
+ struct thread *td;
*vpp = NULL;
@@ -708,13 +709,14 @@ procfs_lookup(ap)
return (procfs_root(dvp->v_mount, vpp));
p = PFIND(pfs->pfs_pid);
+ td = &p->p_thread; /* XXXKSE */
if (p == NULL)
break;
for (pt = proc_targets, i = 0; i < nproc_targets; pt++, i++) {
if (cnp->cn_namelen == pt->pt_namlen &&
bcmp(pt->pt_name, pname, cnp->cn_namelen) == 0 &&
- (pt->pt_valid == NULL || (*pt->pt_valid)(p)))
+ (pt->pt_valid == NULL || (*pt->pt_valid)(td)))
goto found;
}
PROC_UNLOCK(p);
@@ -735,11 +737,11 @@ procfs_lookup(ap)
* Does this process have a text file?
*/
int
-procfs_validfile(p)
- struct proc *p;
+procfs_validfile(td)
+ struct thread *td;
{
- return (procfs_findtextvp(p) != NULLVP);
+ return (procfs_findtextvp(td->td_proc) != NULLVP);
}
/*
@@ -765,6 +767,7 @@ procfs_readdir(ap)
struct pfsnode *pfs;
int count, error, i, off;
static u_int delen;
+ struct thread *td;
if (!delen) {
@@ -794,16 +797,17 @@ procfs_readdir(ap)
struct proc_target *pt;
p = PFIND(pfs->pfs_pid);
+ td = &p->p_thread; /* XXXKSE */
if (p == NULL)
break;
- if (p_cansee(curproc, p)) {
+ if (p_cansee(curthread->td_proc, p)) {
PROC_UNLOCK(p);
break;
}
for (pt = &proc_targets[i];
uio->uio_resid >= delen && i < nproc_targets; pt++, i++) {
- if (pt->pt_valid && (*pt->pt_valid)(p) == 0)
+ if (pt->pt_valid && (*pt->pt_valid)(td) == 0)
continue;
dp->d_reclen = delen;
@@ -864,11 +868,11 @@ procfs_readdir(ap)
p = LIST_NEXT(p, p_list);
if (p == NULL)
goto done;
- if (p_cansee(curproc, p))
+ if (p_cansee(curthread->td_proc, p))
continue;
pcnt++;
}
- while (p_cansee(curproc, p)) {
+ while (p_cansee(curthread->td_proc, p)) {
p = LIST_NEXT(p, p_list);
if (p == NULL)
goto done;
OpenPOWER on IntegriCloud