+ {
+ child_ops.to_resume (rpid, step, signo);
+ }
+ }
+}
+
+/* Abstract out the child_wait functionality. */
+int
+linux_child_wait (pid, rpid, status)
+ int pid;
+ int *rpid;
+ int *status;
+{
+ int save_errno;
+
+ /* Note: inftarg has these inside the loop. */
+ set_sigint_trap (); /* Causes SIGINT to be passed on to the
+ attached process. */
+ set_sigio_trap ();
+
+ errno = save_errno = 0;
+ for (;;)
+ {
+ errno = 0;
+ *rpid = waitpid (pid, status, __WCLONE | WNOHANG);
+ save_errno = errno;
+
+ if (*rpid > 0)
+ {
+ /* Got an event -- break out */
+ break;
+ }
+ if (errno == EINTR) /* interrupted by signal, try again */
+ {
+ continue;
+ }
+
+ errno = 0;
+ *rpid = waitpid (pid, status, WNOHANG);
+ if (*rpid > 0)
+ {
+ /* Got an event -- break out */
+ break;
+ }
+ if (errno == EINTR)
+ {
+ continue;
+ }
+ if (errno != 0 && save_errno != 0)
+ {
+ break;
+ }
+ sigsuspend(&linuxthreads_block_mask);