summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-05-19 21:44:03 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-05-19 21:44:03 +0000
commit7a364110ab787a3a7001c41dce6be5ca4f60479a (patch)
treebc9d1468cc9fb238ef8080b80f73a8eacdef1a37
parent640fddb401d38e6086c5787bc8ea3e23615d3397 (diff)
make fsystrace available in systrace.h; keep some more stats.
-rw-r--r--sys/dev/systrace.c26
-rw-r--r--sys/dev/systrace.h23
2 files changed, 26 insertions, 23 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index bc8fdc6af05..587f43214ec 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -100,26 +100,6 @@ struct str_process {
struct str_message msg;
};
-struct fsystrace {
- struct lock lock;
- struct selinfo si;
-
- TAILQ_HEAD(strprocessq, str_process) processes;
- TAILQ_HEAD(strpolicyq, str_policy) policies;
-
- struct strprocessq messages;
-
- int npolicynr;
- int npolicies;
-
- int issuser;
-
- /* cwd magic */
- pid_t fd_pid;
- struct vnode *fd_cdir;
- struct vnode *fd_rdir;
-};
-
void systrace_lock(void);
void systrace_unlock(void);
@@ -400,9 +380,6 @@ systracef_close(fp, p)
strp = TAILQ_FIRST(&fst->processes)) {
struct proc *q = strp->proc;
- if (ISSET(strp->flags, STR_PROC_ONQUEUE))
- TAILQ_REMOVE(&fst->messages, strp, msg_next);
-
systrace_detach(strp);
psignal(q, SIGKILL);
}
@@ -1055,6 +1032,8 @@ systrace_detach(struct str_process *strp)
TAILQ_REMOVE(&fst->messages, strp, msg_next);
TAILQ_REMOVE(&fst->processes, strp, next);
+ fst->nprocesses--;
+
if (strp->policy)
systrace_closepolicy(fst, strp->policy);
pool_put(&systr_proc_pl, strp);
@@ -1094,6 +1073,7 @@ systrace_insert_process(struct fsystrace *fst, struct proc *proc)
strp->parent = fst;
TAILQ_INSERT_TAIL(&fst->processes, strp, next);
+ fst->nprocesses++;
proc->p_systrace = strp;
SET(proc->p_flag, P_SYSTRACE);
diff --git a/sys/dev/systrace.h b/sys/dev/systrace.h
index 732a90d0bfa..c7223b10ddf 100644
--- a/sys/dev/systrace.h
+++ b/sys/dev/systrace.h
@@ -102,6 +102,29 @@ struct systrace_policy {
#define SYSTR_FLAGS_RESULT 0x001
#ifdef _KERNEL
+struct str_process;
+struct fsystrace {
+ struct lock lock;
+ struct selinfo si;
+
+ TAILQ_HEAD(strprocessq, str_process) processes;
+ int nprocesses;
+
+ TAILQ_HEAD(strpolicyq, str_policy) policies;
+
+ struct strprocessq messages;
+
+ int npolicynr;
+ int npolicies;
+
+ int issuser;
+
+ /* cwd magic */
+ pid_t fd_pid;
+ struct vnode *fd_cdir;
+ struct vnode *fd_rdir;
+};
+
/* Internal prototypes */
int systrace_redirect(int, struct proc *, void *, register_t *);