aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/procfs/procfs_regs.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-01-24 18:41:41 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-01-24 18:41:41 +0000
commit0cc7521383b386b3c46d6aca27e1420c9c79d6a0 (patch)
tree8145e3cd1e1aac0b3dde9729abaeda8149c107ae /sys/fs/procfs/procfs_regs.c
parentb0281cef04e99be73e7eeac25e77c54e72657c20 (diff)
downloadsrc-0cc7521383b386b3c46d6aca27e1420c9c79d6a0.tar.gz
src-0cc7521383b386b3c46d6aca27e1420c9c79d6a0.zip
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.
Notes
Notes: svn path=/head/; revision=13608
Diffstat (limited to 'sys/fs/procfs/procfs_regs.c')
-rw-r--r--sys/fs/procfs/procfs_regs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c
index 8b0600a480d0..bc5520c6617d 100644
--- a/sys/fs/procfs/procfs_regs.c
+++ b/sys/fs/procfs/procfs_regs.c
@@ -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);
+}