summaryrefslogtreecommitdiffstats
path: root/sys/dev/systrace.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-02-20 22:23:39 +0000
committerguenther <guenther@openbsd.org>2012-02-20 22:23:39 +0000
commit6b6f3ef98bf3daa3aacb6a0b4d990aea236f8b02 (patch)
tree66bfafe6ff3368eb85847153caa021955c73d541 /sys/dev/systrace.c
parent- add more ptrace() ops (diff)
downloadwireguard-openbsd-6b6f3ef98bf3daa3aacb6a0b4d990aea236f8b02.tar.xz
wireguard-openbsd-6b6f3ef98bf3daa3aacb6a0b4d990aea236f8b02.zip
First steps for making ptrace work with rthreads:
- move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and p_ptstat member from struct proc to struct process - sort the PT_* requests into those that take a PID vs those that can also take a TID - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT ok kettenis@
Diffstat (limited to 'sys/dev/systrace.c')
-rw-r--r--sys/dev/systrace.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index f48ffdec652..16d01c7d53d 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.c,v 1.61 2012/02/15 04:26:27 guenther Exp $ */
+/* $OpenBSD: systrace.c,v 1.62 2012/02/20 22:23:39 guenther Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -1203,12 +1203,12 @@ systrace_attach(struct fsystrace *fst, pid_t pid)
struct proc *proc, *p = curproc;
struct str_process *newstrp;
- if ((proc = pfind(pid)) == NULL) {
+ if ((proc = pfind(pid)) == NULL || (proc->p_flag & P_THREAD)) {
error = ESRCH;
goto out;
}
- if (ISSET(proc->p_flag, P_INEXEC)) {
+ if (ISSET(proc->p_p->ps_flags, PS_INEXEC)) {
error = EAGAIN;
goto out;
}
@@ -1217,7 +1217,7 @@ systrace_attach(struct fsystrace *fst, pid_t pid)
* You can't attach to a process if:
* (1) it's the process that's doing the attaching,
*/
- if (proc->p_pid == p->p_pid) {
+ if (proc->p_p == p->p_p) {
error = EINVAL;
goto out;
}