home *** CD-ROM | disk | FTP | other *** search
- /****** rsbx.lib/OrphanChild() ***********************************************
- *
- * NAME
- * OrphanChild -- Dis-associate a child process from this process.
- *
- * SYNOPSIS
- * success = OrphanChild(child)
- *
- * int OrphanChild(struct ChildNode * );
- *
- * FUNCTION
- * This function will dis-associate a child process from this process and
- * free the structures used to track the child process.
- *
- * INPUTS
- * child - Child identifier returned by LaunchChildl() or by
- * LaunchChildv().
- *
- * RESULT
- * success - Zero if invalid child identifier.
- *
- * NOTES
- *
- * SEE ALSO
- * ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
- * LaunchChildv(), OrphanChildren(), WaitChild().
- *
- * BUGS
- * None Known.
- *
- ******************************************************************************
- *
- */
-
- #include <rsbx/childtasking.h>
-
- /*
- * name OrphanChild --
- *
- * synopsis error = OrphanChild(child);
- *
- * int error; error if 0
- * struct ChildNode *child; child identifier
- *
- * description This function removes all records of a child process.
- * Returns 0 if child unknown.
- */
-
- int OrphanChild(struct ChildNode *child)
- {
- struct ChildNode *node;
-
- Forbid();
- EmptyMorgue();
-
- for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
- node->node.mln_Succ;
- node = (struct ChildNode *)node->node.mln_Succ)
- {
- if (node == child)
- {
- if (child->notice.noticeptr)
- {
- *child->notice.noticeptr = 0;
- }
- Remove((struct Node*)child);
- FreeMem(child, sizeof(*child));
- return -1;
- }
- }
-
- return 0;
- }
-