home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4518 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.3 KB  |  63 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!ftpbox!motsrd!white!glas!glas!hartnett
  3. From: hartnett@glas.rtsg.mot.com (Ger Hartnett)
  4. Subject: calling system() with SIGCLD ignored (SysV).
  5. Message-ID: <1992Sep2.164144.11558@glas.rtsg.mot.com>
  6. Sender: news@glas.rtsg.mot.com
  7. Nntp-Posting-Host: glas8
  8. Organization: Motorola Cellular Infrastructure Div., Cork, Ireland.
  9. Distribution: comp
  10. Date: Wed, 2 Sep 1992 17:41:37 GMT
  11. Lines: 50
  12.  
  13.  
  14. Hi there,
  15.  
  16. Apologies if this is a previously discussed topic.
  17.  
  18. I have a few questions about the interactions between the system() and
  19. ignoring the SIGCLD signal under SYS V.
  20.  
  21. I need to spawn off processes and not allow them to become zombie when
  22. finished. I also need to make calls to the system() function in the
  23. parent process.
  24.  
  25. I have set up a simple test program which sets SIGCLD to be ignored,
  26. forks a child process and then calls system(). The system() call
  27. hangs in wait(). It does exit with ECHILD when the system call
  28. finishes but will not do this if other children have been started and
  29. not yet exited.
  30.  
  31. I then set up a signal handler for SIGCLD which just calls wait. This
  32. also ensured the spawned processes do not go zombie but the system()
  33. function call exits with errno set to EINTR (when the command
  34. submitted has been executed). Re-submitting the system() call executes
  35. the complete command again.
  36.  
  37. I can't spawn off daemons (setpgrp and double fork) as I need the
  38. spawned processes to stop when the terminal logs out.
  39.  
  40. So I really haven't found a satisfactory solution. What I really need
  41. to know is if this is a catch 22 situation. Is there any better way of
  42. doing what I need to do.
  43.  
  44. (I am using Tandem NonStop-UX rA21 and UNIX System V/88 Release
  45. R32V2).
  46.  
  47. Thanks,
  48. gerH.
  49.  
  50. --
  51.          +----------------------------------------------------+
  52.          | Ger Hartnett,                      |
  53.          |      PaperNet:  Motorola Ireland Ltd.              |
  54.          |           Cellular Infrastructure Division   |
  55.     _____  __  __|           Mahon Industrial Estate            |
  56.    / ___/ / /_/ /|           Cork, Republic of Ireland.         |
  57.   / / _  / __  / |                              |
  58.  / /_/ // / / /  |    InterNet:  hartnett@glas.rtsg.mot.com         |
  59. /_____//_/ /_/   |      UUCP:        ...motcid!glas!hartnett            |
  60.          |     Voice:        +353 21 357 101                    |
  61.          |         FAX:          +353 21 357 635                    |
  62.          +----------------------------------------------------+
  63.