public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: Daniel Barlow <dan@telent.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.4.x, can't ptrace a task created with clone() ?
Date: Wed, 15 Jan 2003 15:27:51 -0500	[thread overview]
Message-ID: <20030115202751.GA7696@nevyn.them.org> (raw)
In-Reply-To: <87r8bebcct.fsf@noetbook.telent.net>

On Wed, Jan 15, 2003 at 04:34:58PM +0000, Daniel Barlow wrote:
> 
> Tested with 4.2.20 and 2.4.21-pre3, after PTRACE_ATTACHing to a
> process I created with clone(), wait() returns ECHILD .  strace
> of the parent shows
> 
> clone(child_stack=0x80599a8, flags=CLONE_VM) = 1292
> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
> rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> nanosleep({5, 0}, {5, 0})               = 0
> ptrace(PTRACE_ATTACH, 1292, 0, 0)       = 0
> --- SIGCHLD (Child exited) ---
> wait4(-1, 0xbffffbf0, 0, NULL)          = -1 ECHILD (No child processes)
> write(2, "waitpid: No child processes\n", 28) = 28
> 
> If I replace the clone in my test program with a fork, everything
> works as I expected.  Is this a bug, or are my expectations at fault?
> if the latter, how _do_ I attach to one of my cloned children?

You did attach.  But if you want to wait for a cloned child, you need
to use __WCLONE or __WALL.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

      reply	other threads:[~2003-01-15 20:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-15 16:34 2.4.x, can't ptrace a task created with clone() ? Daniel Barlow
2003-01-15 20:27 ` Daniel Jacobowitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030115202751.GA7696@nevyn.them.org \
    --to=dan@debian.org \
    --cc=dan@telent.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox