[Linux] Assume waitpid/__WALL is available
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
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