[Info-vax] CREPRC MBXUNT (Handle Process Termination)

IanMiller gxys at uk2.net
Mon Mar 9 14:03:38 EDT 2009


On Mar 9, 5:39 pm, Craiger... at gmail.com wrote:
> I have some C code running on OpenMVS VAX 6.2. The code creates
> subprocesses.  I need to perform some clean up tasks when my sub
> processes terminate. I wrote a function "processTermination", but I
> can't seem to get it to fire when the sub process terminates. I can't
> find any example code where anyone is actually doing this. My code is
> C. Here are the relevant snippets. It runs without error, but the
> "processTermination" function does not run. I appreciate any
> assistance!
>
>         unsigned short int termMbx2;
>
>         /* Create Termination MBX  */
>         status = sys$crembx (0,                 /* 0=temp, 1=perm */
>               &termMbx2,
>               512,       /* Max message size */
>               512, /* Buffer space for messages */
>               prot,
>               PSL$C_USER,
>               0,
>               0,
>               0);
>         if (!(status & STS$M_SUCCESS)) {
>              printf ("  (sys_crembx) Error creating term MBX.\n") ;
>              show_error (status);
>              exit(1);
>         }
>
>         /* Set AST on Term MBX  */
>         status = sys$qio(0, termMbx2, IO$_READVBLK,
>               &termBuf->iosb,
>               processTermination,
>               &termBuf,
>               0, 0, 0, 0, 0, 0);
>         if (!(status & STS$M_SUCCESS)) {
>              printf ("  (sys_qio) Error setting qio to Term MBX.\n") ;
>              show_error (status);
>              exit(1);
>         }
>
>         /* Create the Sub Process linked to the Term Mbx */
>         status = sys$creprc (&pid, &image_name_d, &command_proc_d,
>            &log_file, 0, 0, 0, &process_name_d, 0, 0, &termMbx2, 0,
> 0);
>         if (!(status & STS$M_SUCCESS)) {
>            printf ("  (sys_creprc) Error Creating Child process.\n") ;
>            show_error (status);
>            sys$exit(status);
>         }  else {
>            printf ("  Client Server PID : %08x\n\n",pid);
>         }


$CREMBX returns a channel number but for $CREPRC you need a unit
number, I usually feed the channel number to LIB$GETDVI to get the
unit number.



More information about the Info-vax mailing list