#include <arpbase.h>
#include <arp_proto.h>
#include "Launch.h"
#include "LaunchPriv.h"


/*
 *	NAME
 *		IsChild -- verifies if the process is a child to another one.
 *
 *	SYNOPSIS
 *		pp = IsChild (Proc)
 *
 *		struct ProcPair *IsChild (struct Process *);
 *
 *	FUNCTION
 *		Check if the process that started it still exists (it should)
 *		a return a pointer to the process pair.
 *
 *	DESCRIPTION
 *		Scan the process pair linked list for a pair which is has the
 *		input process as the child.  If it find one, return a pointer
 *		to it.
 *
 *	INPUT
 *		Proc - a pointer to the process to be checked.
 *
 *	OUTPUT
 *		pp - a ProcPair structure pointer.
 *
 *	NOTE
 *		Assume Forbid() has been called to make sure the list is not
 *		modified while we scan it.
 *
 *	HISTORY
 *		1992/09/06	Pierre Baillargeon		Creation
 *
 *	SEE ALSO
 *		IsParent()
 */

struct ProcPair *IsChild (struct Process *Proc)
{
	struct ProcPair *pp;
	if (NULL != ProcPairList)
	{
		for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
		{
			if (Proc == pp->pp_Child)
				return pp;
		}
	}
	return NULL;
}
