Date: 30 May 2001 20:45:12 +0800 From: Jiangyi Liu <gzjyliu@public.guangzhou.gd.cn> To: freebsd-hackers@FreeBSD.org Subject: Weird PT_DETACH Message-ID: <878zjf0zvr.fsf@fatcow.home>
next in thread | raw e-mail | index | archive | help
Hi all, The ptrace(2) man page is probably outdated. I used PT_DETACH in the following code, but it didn't run ./test. I also tried to use ptrace(PT_DETACH, pid, (caddr_t)1, 0) to detach, but it failed too. BTW, if I omit wait(0) and ptrace(PT_DETACH, ...) in the code, after it runs there is a process sticking to the system. Even kill -9 can't kill it. $ ps aux | grep jyliu ... jyliu 423 0.0 0.1 216 100 p2 TX 7:41AM 0:00.00 (test) ... $ kill -9 423 $ ps aux | grep jyliu ... jyliu 423 0.0 0.1 216 100 p2 TX 7:41AM 0:00.00 (test) ... So it's still there. Quite funny. Any clue? Jiangyi ---code begins here #include <unistd.h> #include <sys/types.h> #include <sys/ptrace.h> int main() { pid_t pid; if(!(pid=fork())) { /* child */ ptrace(PT_TRACE_ME, 0, 0, 0); puts("child speaking"); execve("./test", NULL, NULL); } else { wait(0); ptrace(PT_DETACH, pid, 0, 0); exit(0); } } ---code ends here To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?878zjf0zvr.fsf>