From owner-freebsd-hackers Wed May 30 7:29: 9 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from sivka.carrier.kiev.ua (sivka.carrier.kiev.ua [193.193.193.101]) by hub.freebsd.org (Postfix) with ESMTP id 631F237B422 for ; Wed, 30 May 2001 07:28:58 -0700 (PDT) (envelope-from diman@asd-g.com) Received: from core.is.kiev.ua (p187.is.kiev.ua [62.244.5.187] (may be forged)) by sivka.carrier.kiev.ua (8/Kilkenny_is_better) with ESMTP id RLA53874; Wed, 30 May 2001 17:28:40 +0300 (EEST) (envelope-from diman@asd-g.com) Received: from [10.203.1.10] ([10.203.1.10]) by core.is.kiev.ua (8.11.1/ASDG-2.3-NR) with ESMTP id f4UEScM34319; Wed, 30 May 2001 17:28:38 +0300 (EEST) (envelope-from diman@asd-g.com) Date: Wed, 30 May 2001 14:23:49 +0000 (GMT) From: diman X-Sender: diman@portal.none.ua To: Jiangyi Liu Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Weird PT_DETACH In-Reply-To: <006a01c0e911$96e68720$a701160a@fatcow> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 #include #include 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