示例#1
0
/* If action is 0, like waitpid.  If action is 1, just release the PID?  */
static pid_t
my_waitpid (assuan_context_t ctx, pid_t pid,
	    int nowait, int *status, int options)
{
#ifdef HAVE_W32_SYSTEM
  CloseHandle ((HANDLE) pid);
#else
  /* We can't just release the PID, a waitpid is mandatory.  But
     NOWAIT in POSIX systems just means the caller already did the
     waitpid for this child.  */
  if (! nowait)
    return _gpgme_ath_waitpid (pid, status, options);
#endif
  return 0;
}
示例#2
0
static int
_gpgme_io_waitpid(int pid, int hang, int *r_status, int *r_signal)
{
    int status;

    *r_status = 0;
    *r_signal = 0;
    if(_gpgme_ath_waitpid(pid, &status, hang ? 0 : WNOHANG) == pid)
    {
        if(WIFSIGNALED(status))
        {
            *r_status = 4; /* Need some value here.  */
            *r_signal = WTERMSIG(status);
        }
        else if(WIFEXITED(status))
            *r_status = WEXITSTATUS(status);
        else
            *r_status = 4; /* Oops.  */
        return 1;
    }
    return 0;
}