public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [Linux] Assume waitpid/__WALL is available
@ 2015-12-10 15:04 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2015-12-10 15:04 UTC (permalink / raw)
  To: GDB Patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-10 15:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 15:04 [Linux] Assume waitpid/__WALL is available Pedro Alves

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).