static int
nto_thread_alive (ptid_t ptid)
{
  int res;

  TRACE ("%s pid:%d tid:%d\n", __func__, ptid_get_pid (ptid),
	 ptid_get_lwp (ptid));
  if (SignalKill (0, ptid_get_pid (ptid), ptid_get_lwp (ptid),
		  0, 0, 0) == -1)
    res = 0;
  else
    res = 1;
  TRACE ("%s: %s\n", __func__, res ? "yes" : "no");
  return res;
}
Beispiel #2
0
void procmgr_nozombie(PROCESS *prp, int status) {
	/*
	 * This should use CLD_EXITED instead of SI_USER, but the SignalKill()
	 * kernel call does not allow it. SI_USER is alowable though, and this
	 * is only used by QNX functions right now.
	 */
	if(!(prp->flags & _NTO_PF_NOZOMBIE)) {
		PROCESS								*parent;
		struct wait_entry					*wap, **pwap;

		prp->siginfo.si_signo = SIGCHLD;
		prp->siginfo.si_code = CLD_EXITED;
		prp->siginfo.si_pid = prp->pid;
		prp->siginfo.si_status = status;

		parent = proc_lock_parent(prp);

		if(!sigismember(&(prp->parent->sig_ignore), SIGCHLD)) {
			prp->flags |= _NTO_PF_WAITINFO;
		}
		for(pwap = &parent->wap; (wap = *pwap);) {
			if((status = procmgr_wait_check(prp, parent, wap, WEXITED)) > 0) {
				*pwap = wap->next;
				proc_object_free(&wait_souls, wap);
				if(status == WEXITED) {
					break;
				}
			} else {
				pwap = &wap->next;
			}
		}
		prp->flags |= _NTO_PF_NOZOMBIE;
		proc_unlock(parent);
		SignalKill(ND_LOCAL_NODE, prp->parent->pid, 0, SIGCHLD, SI_USER, prp->pid);
	}
}