g_waitpid(int pid)
{
#if defined(_WIN32)
  return 0;
#else
  int rv = 0;
  if (pid < 0) {
    rv = -1;
  }
  else {
    rv = waitpid(pid, 0, 0);
    if (rv == -1)
    {
      if (errno == EINTR) /* signal occurred */
      {
        rv = 0;
      }
    }
  }
  return rv;
#endif
}
g_waitpid(int pid)
{
#if defined(_WIN32)
  return 0;
#else
  int rv = 0;
  if (pid < 0) {
    rv = -1;
  }
  else {
    rv = waitpid(pid, 0, 0);
    if (rv == -1)
    {
      if (errno == EINTR)  
      {
        rv = 0;
      }
    }
  }
  return rv;
#endif
}