public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: GDB Patches <gdb@sourceware.org>
Subject: [Linux] Assume waitpid/__WALL is available
Date: Thu, 10 Dec 2015 15:04:00 -0000	[thread overview]
Message-ID: <56699484.3040103@redhat.com> (raw)

As next step in the spring^W cleaning, since we now assume that
PTRACE_O_TRACECLONE is available, we should be able to assume that
everything that predates it is available as well.

__WALL immediately comes to mind.

man ptrace says:

              PTRACE_O_TRACECLONE (since Linux 2.5.46)

and man waitpid says:

       __WALL (since Linux 2.4)
              Wait for all children, regardless of type ("clone" or "non-clone").

Making use of __WALL should simplify linux-nat.c, in all the places
that first check __WCLONE then !__WCLONE.  See comments at top of
linux-nat.c.  E.g.:

		  new_pid = my_waitpid (lwpid, &status, WNOHANG);
		  if (new_pid == -1 && errno == ECHILD)
		    new_pid = my_waitpid (lwpid, &status, __WCLONE | WNOHANG);
		  if (new_pid != -1)

gdbserver's linux-low.c uses __WALL, but note that in reality that doesn't
reach the kernel, because nat/linux-waitpid.c:my_waitpid actually emulates
__WALL.  We should be able to simplify that too now.

Thanks,
Pedro Alves

                 reply	other threads:[~2015-12-10 15:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=56699484.3040103@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).