This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[Linux] Assume waitpid/__WALL is available
- From: Pedro Alves <palves at redhat dot com>
- To: GDB Patches <gdb at sourceware dot org>
- Date: Thu, 10 Dec 2015 15:04:36 +0000
- Subject: [Linux] Assume waitpid/__WALL is available
- Authentication-results: sourceware.org; auth=none
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