perror ("Failed to killed test process");
perror ("Failed to kill test process");
timeout_handler (int sig __attribute__ ((unused))){  int killed;  int status;  /* Send signal.  */  kill (pid, SIGKILL);  /* Wait for it to terminate.  */  int i;  for (i = 0; i < 5; ++i)    {      killed = waitpid (pid, &status, WNOHANG|WUNTRACED);      if (killed != 0)	break;      /* Delay, give the system time to process the kill.  If the	 nanosleep() call return prematurely, all the better.  We	 won't restart it since this probably means the child process	 finally died.  */      struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };      nanosleep (&ts, NULL);    }  if (killed != 0 && killed != pid)    {      perror ("Failed to killed test process");      exit (1);    }#ifdef CLEANUP_HANDLER  CLEANUP_HANDLER;#endif  /* If we expected this signal: good!  */#ifdef EXPECTED_SIGNAL  if (EXPECTED_SIGNAL == SIGALRM)    exit (0);#endif  if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))    fputs ("Timed out: killed the child process\n", stderr);  else if (WIFSTOPPED (status))    fprintf (stderr, "Timed out: the child process was %s\n",	     strsignal (WSTOPSIG (status)));  else if (WIFSIGNALED (status))    fprintf (stderr, "Timed out: the child process got signal %s\n",	     strsignal (WTERMSIG (status)));  else    fprintf (stderr, "Timed out: killed the child process but it exited %d\n",	     WEXITSTATUS (status));  /* Exit with an error.  */  exit (1);}