aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-fork.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-11-22 17:44:29 +0100
committerTom de Vries <tdevries@suse.de>2024-11-22 17:44:29 +0100
commita9791f1438a47bbb3a336e0fbdfff2e1d28a8da3 (patch)
tree76ac04426248d3a65bf89adef08bacb4c8a4272e /gdb/linux-fork.c
parent658a03e9e85698fa8815915d1a858371ea51da83 (diff)
downloadbinutils-a9791f1438a47bbb3a336e0fbdfff2e1d28a8da3.zip
binutils-a9791f1438a47bbb3a336e0fbdfff2e1d28a8da3.tar.gz
binutils-a9791f1438a47bbb3a336e0fbdfff2e1d28a8da3.tar.bz2
[gdb] Use gdb::waitpid more often
Use gdb::waitpid instead of plain waitpid, making sure that EINTR is handled. Tested on x86_64-linux.
Diffstat (limited to 'gdb/linux-fork.c')
-rw-r--r--gdb/linux-fork.c7
1 files changed, 4 insertions, 3 deletions
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 <dirent.h>
#include <ctype.h>
@@ -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;
}