[gdb] Add gdb::wait

Add gdb::wait, and use it in gdb/procfs.c, making sure that EINTR is handled.

Tested on x86_64-linux.
This commit is contained in:
Tom de Vries
2024-11-22 17:44:29 +01:00
parent a9791f1438
commit 4e4dfc4728
2 changed files with 11 additions and 4 deletions

View File

@@ -2062,8 +2062,9 @@ wait_again:
{ {
int wait_retval; int wait_retval;
/* /proc file not found; presumably child has terminated. */ /* /proc file not found; presumably child has terminated. Wait
wait_retval = ::wait (&wstat); /* "wait" for the child's exit. */ for the child's exit. */
wait_retval = gdb::wait (&wstat);
/* Wrong child? */ /* Wrong child? */
if (wait_retval != inf->pid) if (wait_retval != inf->pid)
@@ -2150,7 +2151,7 @@ wait_again:
} }
else else
{ {
int temp = ::wait (&wstat); int temp = gdb::wait (&wstat);
/* FIXME: shouldn't I make sure I get the right /* FIXME: shouldn't I make sure I get the right
event from the right process? If (for event from the right process? If (for
@@ -2562,7 +2563,7 @@ unconditionally_kill_inferior (procinfo *pi)
ret = gdb::waitpid (pi->pid, &status, 0); ret = gdb::waitpid (pi->pid, &status, 0);
#else #else
wait (NULL); gdb::wait (NULL);
#endif #endif
} }
} }

View File

@@ -83,6 +83,12 @@ open (const char *pathname, int flags)
return gdb::handle_eintr (-1, ::open, pathname, flags); return gdb::handle_eintr (-1, ::open, pathname, flags);
} }
inline pid_t
wait (int *wstatus)
{
return gdb::handle_eintr (-1, ::wait, wstatus);
}
inline int inline int
close (int fd) close (int fd)
{ {