From: CSBVAX::MRGATE!info-vax-request@kl.sri.com@SMTP 17-JAN-1988 07:57 To: ARISIA::EVERHART Subj: How to be notified if a child process dies prematurely. Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Sun 17 Jan 88 03:57:01-PST Received: by ucbvax.Berkeley.EDU (5.58/1.26) id AA26078; Sun, 17 Jan 88 03:37:27 PST Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-vax@kl.sri.com (info-vax@kl.sri.com) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 17 Jan 88 06:27:21 GMT From: bsu-cs!wendi@iuvax.cs.indiana.edu () Organization: CS Dept, Ball St U, Muncie, Indiana Subject: How to be notified if a child process dies prematurely. Message-Id: <1880@bsu-cs.UUCP> Sender: info-vax-request@kl.sri.com To: info-vax@kl.sri.com } } We are porting our product from a HP9000 running unix to a } VAX running VMS. The product is written in c. } } The way the product works is that the frontend (the editor, etc) } forks off a child process (which does the real work) and the } two processes talk to each other thru pipes. All this works fine. } } The question is, how can the parent process tell if the child has } died? If something went wrong and the child dies, unless the } parent knows this, it will hang waiting for input. In UNIX we use } the death of child signal. } } There seem to be several options in VMS. The first is to } ask the system if the child process (I have the process id) is } still alive using LIB$GETJPI before every read or write. } I would assume that this would be slow, but I'm not sure. } } The second approach would be to use AST's somehow. Being new to } VMS I'm not sure how yet. } } Since this is a fairly common thing to do, I hope someone out there has } already done it! I would appreciate any help. Please remember } that I am new to VMS so make your responses fairly detailed. } } Thanks } } Jill Diewald } Innovative Systems } 1 Gateway Center Suite 910 } Newton, Ma 02158 } Phone: 617-965-8450 } } email: ... /harvard/axiom/insyte/jad Yes, I agree the AST would seem to be the best way to go about it. If you are using Lib$Spawn to create the process, then use the completion-astadr parameter to specify an AST to be executed when and if the "child" process "dies." Or if you are using Sys$CrePrc, then the following procedure might be the best way. First create a mailbox with Sys$CreMbx. Second obtain the mailbox's unit number by using Sys$GetDVI. Third set a write attention AST to the mailbox with Sys$QIO. Then call Sys$CrePrc to create the subprocess and make sure that you specify the mailbox unit number. Now if the child process dies, an accounting message will be written to the mailbox and the AST will fire. The following manuals would be most helpful: Run-Time-Library Reference Manual, System Services Reference Manual, and the I/O User's Guide in the terminal driver section. ****************************************************************************** * * * * Walter H. Dick, III * Programming Suggestions * * CS Sophomore * * * German Department * by * * Ball State University * * * * < Lord Vader > * * * * ******************************************************************************