From a9791f1438a47bbb3a336e0fbdfff2e1d28a8da3 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 22 Nov 2024 17:44:29 +0100 Subject: [gdb] Use gdb::waitpid more often Use gdb::waitpid instead of plain waitpid, making sure that EINTR is handled. Tested on x86_64-linux. --- gdb/linux-fork.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gdb/linux-fork.c') diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index c457a90..7d3505b 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -32,6 +32,7 @@ #include "nat/gdb_ptrace.h" #include "gdbsupport/gdb_wait.h" +#include "gdbsupport/eintr.h" #include "target/waitstatus.h" #include #include @@ -314,7 +315,7 @@ linux_fork_killall (void) /* Use SIGKILL instead of PTRACE_KILL because the former works even if the thread is running, while the later doesn't. */ kill (pid, SIGKILL); - ret = waitpid (pid, &status, 0); + ret = gdb::waitpid (pid, &status, 0); /* We might get a SIGCHLD instead of an exit status. This is aggravated by the first kill above - a child has just died. MVS comment cut-and-pasted from linux-nat. */ @@ -339,7 +340,7 @@ linux_fork_mourn_inferior (void) Do not check whether this succeeds though, since we may be dealing with a process that we attached to. Such a process will only report its exit status to its original parent. */ - waitpid (inferior_ptid.pid (), &status, 0); + gdb::waitpid (inferior_ptid.pid (), &status, 0); /* OK, presumably inferior_ptid is the one who has exited. We need to delete that one from the fork_list, and switch @@ -548,7 +549,7 @@ Please switch to another checkpoint before deleting the current one")); this succeeds though, since we may be dealing with a process that we attached to. Such a process will only report its exit status to its original parent. */ - waitpid (ptid.pid (), &status, 0); + gdb::waitpid (ptid.pid (), &status, 0); return; } -- cgit v1.1