kernel - Add per-process token, adjust signal code to use it.
[dragonfly.git] / sys / vfs / procfs / procfs_ctl.c
index f5b260e..3fb9295 100644 (file)
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+#include <sys/priv.h>
 #include <sys/vnode.h>
 #include <sys/ptrace.h>
 #include <sys/signalvar.h>
-#include <sys/signal2.h>
 #include <vfs/procfs/procfs.h>
 
+#include <sys/signal2.h>
+#include <sys/thread2.h>
+#include <sys/mplock2.h>
+
 #include <vm/vm.h>
 
 #ifndef FIX_SSTEP
@@ -110,6 +114,9 @@ procfs_control(struct proc *curp, struct lwp *lp, int op)
        struct proc *p = lp->lwp_proc;
        int error;
 
+       ASSERT_LWKT_TOKEN_HELD(&p->p_token);
+       ASSERT_LWKT_TOKEN_HELD(&proc_token);
+
        /* Can't trace a process that's currently exec'ing. */ 
        if ((p->p_flag & P_INEXEC) != 0)
                return EAGAIN;
@@ -288,6 +295,9 @@ procfs_doctl(struct proc *curp, struct lwp *lp, struct pfsnode *pfs,
        char msg[PROCFS_CTLLEN+1];
        vfs_namemap_t *nm;
 
+       ASSERT_LWKT_TOKEN_HELD(&p->p_token);
+       ASSERT_LWKT_TOKEN_HELD(&proc_token);
+
        if (uio->uio_rw != UIO_WRITE)
                return (EOPNOTSUPP);