home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d2xx / d282 / rcs.lha / RCS / rcs.zoo / rcs / rsbx.lib / orphanchild.c < prev    next >
C/C++ Source or Header  |  1989-11-04  |  2KB  |  74 lines

  1. /****** rsbx.lib/OrphanChild() ***********************************************
  2. *
  3. *   NAME
  4. *    OrphanChild -- Dis-associate a child process from this process.
  5. *
  6. *   SYNOPSIS
  7. *    success = OrphanChild(child)
  8. *
  9. *    int OrphanChild(struct ChildNode * );
  10. *
  11. *   FUNCTION
  12. *    This function will dis-associate a child process from this process and
  13. *        free the structures used to track the child process.
  14. *
  15. *   INPUTS
  16. *    child         - Child identifier returned by LaunchChildl() or by
  17. *                    LaunchChildv().
  18. *
  19. *   RESULT
  20. *    success       - Zero if invalid child identifier.
  21. *
  22. *   NOTES
  23. *
  24. *   SEE ALSO
  25. *    ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
  26. *    LaunchChildv(), OrphanChildren(), WaitChild().
  27. *
  28. *   BUGS
  29. *    None Known.
  30. *
  31. ******************************************************************************
  32. *
  33. */
  34.  
  35. #include <rsbx/childtasking.h>
  36.  
  37. /*
  38.  * name        OrphanChild --
  39.  *
  40.  * synopsis    error = OrphanChild(child);
  41.  *
  42.  *        int error;                 error if 0
  43.  *        struct ChildNode *child;   child identifier
  44.  *
  45.  * description    This function removes all records of a child process.
  46.  *        Returns 0 if child unknown.
  47.  */
  48.  
  49. int OrphanChild(struct ChildNode *child)
  50.     {
  51.     struct ChildNode *node;
  52.  
  53.     Forbid();
  54.     EmptyMorgue();
  55.  
  56.     for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  57.         node->node.mln_Succ;
  58.         node = (struct ChildNode *)node->node.mln_Succ)
  59.         {
  60.         if (node == child)
  61.             {
  62.             if (child->notice.noticeptr)
  63.                 {
  64.                 *child->notice.noticeptr = 0;
  65.                 }
  66.             Remove((struct Node*)child);
  67.             FreeMem(child, sizeof(*child));
  68.             return -1;
  69.             }
  70.         }
  71.  
  72.     return 0;
  73.     }
  74.