]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Add gdb::wait
authorTom de Vries <tdevries@suse.de>
Fri, 22 Nov 2024 16:44:29 +0000 (17:44 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 22 Nov 2024 16:44:29 +0000 (17:44 +0100)
Add gdb::wait, and use it in gdb/procfs.c, making sure that EINTR is handled.

Tested on x86_64-linux.

gdb/procfs.c
gdbsupport/eintr.h

index 22e012f0f31050a6ced05b095c5dbc1e5a044094..d5177f3735d8d410d6ad600d2ebb94fb206dc9b8 100644 (file)
@@ -2062,8 +2062,9 @@ wait_again:
            {
              int wait_retval;
 
-             /* /proc file not found; presumably child has terminated.  */
-             wait_retval = ::wait (&wstat); /* "wait" for the child's exit.  */
+             /* /proc file not found; presumably child has terminated.  Wait
+                for the child's exit.  */
+             wait_retval = gdb::wait (&wstat);
 
              /* Wrong child?  */
              if (wait_retval != inf->pid)
@@ -2150,7 +2151,7 @@ wait_again:
                      }
                    else
                      {
-                       int temp = ::wait (&wstat);
+                       int temp = gdb::wait (&wstat);
 
                        /* FIXME: shouldn't I make sure I get the right
                           event from the right process?  If (for
@@ -2562,7 +2563,7 @@ unconditionally_kill_inferior (procinfo *pi)
 
       ret = gdb::waitpid (pi->pid, &status, 0);
 #else
-      wait (NULL);
+      gdb::wait (NULL);
 #endif
     }
 }
index 1b99d1c55c594d2067a5d78367fc078a50234f81..fa2af61559293eb43b15382db80648bff37661ec 100644 (file)
@@ -83,6 +83,12 @@ open (const char *pathname, int flags)
   return gdb::handle_eintr (-1, ::open, pathname, flags);
 }
 
+inline pid_t
+wait (int *wstatus)
+{
+  return gdb::handle_eintr (-1, ::wait, wstatus);
+}
+
 inline int
 close (int fd)
 {