Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2001 14:23:49 +0000 (GMT)
From:      diman <diman@asd-g.com>
To:        Jiangyi Liu <gzjyliu@public.guangzhou.gd.cn>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Weird PT_DETACH
Message-ID:  <Pine.BSF.4.21.0105301420150.201-100000@portal.none.ua>
In-Reply-To: <006a01c0e911$96e68720$a701160a@fatcow>

next in thread | previous in thread | raw e-mail | index | archive | help


	Hope your program not named "./test"  ??
	I changed it to /bin/sh and it works just fine.
	It was hard to debug due to my own proggie bug :)
	bb.


#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, (caddr_t)1, 0); <---------- also
         exit(0);
     }
}





On Wed, 30 May 2001, Jiangyi Liu wrote:

> 
> > 
> > If i understand ptrace(2) manual page correctly,
> > you should use 
> > ptrace(PT_DETACH,pid,(caddr_t)1,0)
> > instead of 
> > ptrace(PT_DETACH,pid,0,0) .
> > 
> 
> If you read my first post again, you will know that indeed I've tried to use (caddr_t)1 but failed too.
> 
> > BTW you code is *very hard to debug* on my 4.1.1 :)
> > What your uname -a tells you?
> 
> Why? My box is 4.3-STABLE.
> 
> Jiangyi
> 


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?Pine.BSF.4.21.0105301420150.201-100000>