1
/*===========================================================================
2
Copyright (C) 1995-2010 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/*+++++++++++++++++++ MIDAS monitor routines PREPH +++++++++++++++++++++++++++
30
.IDENTIFICATION Module PREPH
31
.AUTHOR K. Banse ESO - Garching
32
.ENVIRONMENT VMS and UNIX
34
MIDAS monitor, process control
36
holds INPREPA, START_IT, RUN_IT, STOP_IT, DCLOP, ASSIO, DCLDEM, HTERM,
39
.VERSION [1.00] 870710: initial vers. built from FORTRAN v. 4.30 as of 870311
42
----------------------------------------------------------------------------*/
55
#include <signal.h> /* for symbolic signal names */
58
static char keyfile[200]; /* full name of MID_WORK:FORGRxy.KEY */
59
static char prefix[8];
62
static int ttchan, mbchan; /* old MONIT.TTCHAN, MONIT.MBCHAN */
66
static char vmsbuf[200];
67
static char Userterm[20];
80
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82
interrupt routine for Cntrl/C in the monitor
84
clean up all the stuff from Midas procedures
87
-----------------------------------------------------------------------*/
95
MONIT.CTRLC = 1; /* indicate the interrupt */
96
osscatch(SIGINT,intmonit); /* reenable CntrlC catching */
106
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
108
link to the keyword file as a shared data structure
109
set initial values for SYSCOM
110
create subprocess FORGRxy and set up everything what's needed for
111
communicating with that subprocess
113
create + map global section for keyword file + hold it until
117
---------------------------------------------------------------------------*/
120
int iwa, mm, kk, stat, fastmem, ibuf[9];
124
extern char DATA_PATH[328];
128
fastmem = myINIT(0); /* clean FCT and do other stuff like in SCSPRO */
131
/* init global data */
138
MONIT.CROSS_COUNT = 0;
140
ERRORS.STATUS = 0; /* init low level error status */
141
ERRORS.SYS = 0; /* and for the Monitor */
145
for (nr=0; nr<MAX_LEVEL; nr++)
148
MONIT.MDEBUG[nr] = 0;
149
MONIT.PDEBUG[nr] = 0;
153
TRANSLATE[nr].PNTR[0] = NULL;
154
TRANSLATE[nr].PNTR[1] = NULL;
155
TRANSLATE[nr].LEN[0] = 0;
156
TRANSLATE[nr].LEN[1] = 0;
159
MONIT.ECKO[MAX_LEVEL] = 0;
160
MONIT.MDEBUG[MAX_LEVEL] = 0;
161
MONIT.PDEBUG[MAX_LEVEL] = 0;
162
MONIT.PROCESS = -1; /* init to no_subprocess */
163
MONIT.CMD_LIST_UPDA = 1; /* => INITCOM will use update_cmd_list() */
165
(void) OSY_TRNLOG("PYMIDAS",cbuf,8,&stat);
166
if (strcmp(cbuf,"YES") == 0) /* check, if this is PyMidas */
169
(void) strcpy(FRONT.PROMPT,"*Midas ");
175
(void) strcpy(BATCH[0].CMND,"IF"); /* same order as in COMPILE !! */
176
(void) strcpy(BATCH[1].CMND,"ELSE");
177
(void) strcpy(BATCH[2].CMND,"ELSEIF");
178
(void) strcpy(BATCH[3].CMND,"ENDIF");
179
(void) strcpy(BATCH[4].CMND,"DO");
180
(void) strcpy(BATCH[5].CMND,"ENDDO");
182
(void) strcpy(PROC.FORMAT,"4.4 18.8 18.8 "); /* init interactive FORMAT */
184
FRAMACC('I',KAUX.OUT,0,&iwa); /* init structure FRAME */
187
/* set error_continue, error_log and error_display flag for the monitor */
189
ERRO_CONT = 1; /* continue always */
190
ERRO_LOG = 0; /* log nothing */
191
ERRO_DISP = 0; /* display nothing */
192
ERRO_INDX = -1; /* clear error message pointers */
196
/* initialize CONTEXT structure */
199
memset((void *)CONTXT.NAME,32,(size_t)kk); /* clear context names */
200
CONTXT.NAME[kk] = '\0'; /* make sure we have an end marker */
203
for (nr=0; nr<MAX_CONTXT; nr++)
205
CONTXT.QUEUE[nr] = 0;
206
CONTXT.pdirec[nr] = (char *) 0;
210
/* prepare name of keyword file + open it */
212
stat = OSY_TRNLOG("MID_WORK",keyfile,160,&kk); /* Decode default directory */
213
if (stat != ERR_NORMAL)
215
(void) printf("we could not translate MID_WORK or MID_WORK > 160 char.\n\r");
220
if (keyfile[kk-1] != FSY_DISKEND)
222
if (keyfile[kk-1] != FSY_DIREND)
224
keyfile[kk++] = FSY_DIREND;
229
if (keyfile[kk-1] != FSY_DIREND)
231
keyfile[kk++] = FSY_DIREND;
236
(void) strcpy(FRONT.STARTUP,keyfile); /* save name of startup directory */
237
(void) strcpy(CPATH[0].STR,keyfile); /* also in CPATH[0] */
238
(void) strcpy(EPATH[0].STR,keyfile); /* also in EPATH[0] */
239
for (nr=1; nr<4; nr++)
241
CPATH[nr].STR[0] = '\0'; /* mark the end */
242
EPATH[nr].STR[0] = '\0'; /* mark the end */
246
/* get foreground keys in */
248
if (FRONT.ENV == '*') /* Unix command line input */
249
stat = MID_MOVKEY("IM","**");
252
(void) strcpy(&keyfile[kk],"FORGR .KEY");
253
keyfile[kk+5] = FRONT.DAZUNIT[0];
254
keyfile[kk+6] = FRONT.DAZUNIT[1];
255
stat = MID_MOVKEY("IM",keyfile);
257
if (stat != ERR_NORMAL) ospexit(1);
259
stat = MID_LOG('I',FRONT.DAZUNIT,2); /* open the logfile */
260
if (stat != ERR_NORMAL)
262
(void) strcpy(cbuf,"INPREPA/MID_LOG:");
263
MID_ERROR("MIDAS",cbuf,stat,1);
266
(void) strcpy(prefix,"FORGR "); /* will be used in DCLOP() */
267
prefix[5] = FRONT.DAZUNIT[0];
268
prefix[6] = FRONT.DAZUNIT[1];
271
/* save offsets for keys P1,...,P8 + Q1, Q2, Q3 */
273
MONIT.POFF[0] = OFF_P1;
274
MONIT.POFF[1] = OFF_P2;
275
MONIT.POFF[2] = OFF_P3;
276
MONIT.POFF[3] = OFF_P4;
277
MONIT.POFF[4] = OFF_P5;
278
MONIT.POFF[5] = OFF_P6;
279
MONIT.POFF[6] = OFF_P7;
280
MONIT.POFF[7] = OFF_P8;
281
MONIT.POFF[8] = OFF_Q1;
282
MONIT.POFF[9] = OFF_Q2;
283
MONIT.POFF[10] = OFF_Q3;
285
KIWORDS[OFF_OUTFLG] = 99; /* init keyword OUT$FLAG */
286
KIWORDS[OFF_OUTFLG+2] = -1;
287
(void) strcpy(&KCWORDS[OFF_OUTNAM]," yyy");
289
KIWORDS[OFF_MODE+6] = 0; /* reset overall program level */
290
KIWORDS[OFF_MONPAR+2] = KEY_MAXENT; /* store no. of global + local keys */
291
KIWORDS[OFF_MONPAR+3] = LOC_MAXENT;
292
KIWORDS[OFF_MONPAR+18] = fastmem; /* save FASTMEM option */
294
KIWORDS[OFF_MONPAR+19] = 2000; /* set MP(20) = 4000 */
296
/* indicate if we're executed from PyMidas */
297
if (MONIT.ENV == 'P')
298
{ /* indicate PyMidas in MID$SESS */
299
KCWORDS[OFF_SESS+27] = 'P';
300
KCWORDS[OFF_SESS+28] = 'Y';
301
KCWORDS[OFF_SESS+29] = ' ';
305
KCWORDS[OFF_SESS+27] = KCWORDS[OFF_SESS+28] = KCWORDS[OFF_SESS+29] = ' ';
308
/* initialize keyword DATA_PATH */
309
memset((void *)&KCWORDS[OFF_DPATH],32,(size_t)319);
310
for (nr=0; nr<320; nr+=80) KCWORDS[OFF_DPATH+nr] = '^';
311
KCWORDS[OFF_DPATH+319] = '\0';
312
(void) strcpy(DATA_PATH,&KCWORDS[OFF_DPATH]); /* copy also to DATA_PATH */
315
PIPE.CONT[0] = '\0'; /* clear PIPE(line) structure */
318
PIPE.INSTRUM[0] = '\0';
320
for (nr=0; nr<5; nr++) /* clear REDIRECT structure */
321
REDIRECT[nr].OUTFLAG[0] = 99;
324
/* clear default definitions + open file internal.cod */
326
(void) PARDEFS('I'," ");
327
(void) INTERNAL("OPEN","COD",&mm);
330
if (KIWORDS[OFF_MODE] == 1 )
331
mm = hostinfo(1,ibuf,cbuf,cbuf+16,cbuf+28);
333
mm = hostinfo(0,ibuf,cbuf,cbuf+16,cbuf+28);
336
/***************** VMS ***********************/
340
/* get channel no. of user ASCII terminal and initialize terminal mode */
341
(void) OSY_TRNLOG("TT",Userterm,19,&kk); /* Decode terminal name */
342
(void) OSY_ASSIGN("TT",2,&ttchan); /* as used in main process! */
345
START_IT(); /* start up foreground process */
349
/***********************************************/
353
osscatch(SIGINT,intmonit); /* set up Control/C interrupt handler */
364
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
366
create subprocess FORGRxy
367
and set up everything what's needed for communicating with that subprocess
369
use lots of system service calls
372
-----------------------------------------------------------------------*/
375
char eqn[2][20], cbuf[200];
378
int DCLDEM(), HTERM(), EXH(); /* external functions */
381
stat = OSY_DCLEXH(EXH); /* declare exit handler */
382
if (stat != ERR_NORMAL)
384
printf("problems with exit handler/event_flag clearing...\n\r");
389
/* Create mailboxes for DCL commands to foreground processes */
391
(void) strcpy(mbx,"FORGR _IN");
392
mbx[5] = FRONT.DAZUNIT[0];
393
mbx[6] = FRONT.DAZUNIT[1];
395
stat = OSY_CREMBX(mbx,&mbchan);
396
if (stat != ERR_NORMAL)
398
(void) printf("problems with mailbox creation...\n\r");
402
stat = OSY_TRNLOG(mbx,&eqn[0][0],20,&mm); /* get equivalence name */
403
if (stat != ERR_NORMAL)
405
(void) printf("could not translate mailbox %s ...\n\r",mbx);
415
/* Enable AST for subprocess's first DCL input request */
418
stat = OSY_ENAST(mbchan,"READATT",DCLDEM,0);
419
if (stat != ERR_NORMAL)
421
(void) printf("could not enable AST for mailbox, status = %x \n\r",stat);
425
/* Create subprocess */
427
mbx[7] = '\0'; /* that's already the process name */
428
stat = OSY_SPAWN(&eqn[0][0],mbx,Userterm,&pid,HTERM,&mm);
431
if (stat != ERR_NORMAL)
433
(void) printf("could not spawn subprocess - delete old FORGRxy process\n\r");
438
/* Hibernate until something happens */
441
if (stat != ERR_NORMAL)
443
(void) printf("problems with hibernating call, status = %x \n\r",stat);
448
/* --- we only get here after having been woken up by the subprocess --- */
453
if (MONIT.PROCESS != 1 ) /* has the subprocess died? */
455
(void) printf(" subprocess %s has died...\n\r",mbx);
460
/* Make subprocess assignments at user level */
462
(void) strcpy(vmsbuf,Userterm);
463
ASSIO(vmsbuf,vmsbuf);
473
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
475
run given image in a subprocess
477
enable CNTRL/C AST to terminate a foreground process
480
---------------------------------------------------------------------*/
482
char *image /*IN: image to be executed in the subprocess */;
488
int DCLDEM(), CNTRLC();
491
/* Enable CTRL/C AST only for interactive foreground process */
495
if (KIWORDS[OFF_MODE+2] != 1)
498
stat = OSY_ENAST(ttchan,"CNTRLC",CNTRLC,0);
499
if (stat != ERR_NORMAL)
501
(void) printf("could not enable AST for CNTRL_C, status = %x\n\r",stat);
505
MONIT.CTRLC = 0; /* just for compatibility */
511
/* check, that subprocess has not died */
513
if (MONIT.PROCESS < 0)
515
(void) printf("RUN_IT: subprocess %s has died...\n\r",mbx);
520
/* image name or host opsys command? */
524
MONIT.PROCESS = 2; /* host opsys command: set flag */
526
if (CGN_INDEXC(dclpntr,'@') > 0) KAUX.DCLINP = 1;
530
MONIT.PROCESS = 3; /* image: set flag + construct RUN command */
532
if (MONIT.MDEBUG[MONIT.LEVEL] != 0)
534
if (MONIT.MDEBUG[MONIT.LEVEL] == 2)
536
(void) strcpy(dclpntr,"$RUN/DEBUG "); /* with debugger */
537
(void) strcpy(dclpntr+11,image);
539
else /* get the current time first */
541
(void) sprintf(vmsbuf,"before %s",image);
545
(void) strcpy(dclpntr,"$RUN/NODEBUG "); /* without debugger */
546
(void) strcpy(dclpntr+13,image);
552
(void) strcpy(dclpntr,"$RUN/NODEBUG "); /* without debugger */
553
(void) strcpy(dclpntr+13,image);
556
/* write keywords out + command string into mailbox */
558
fixout(1,MONIT.LEVEL); /* close any ASCII out file */
559
(void) MID_LOG('O',LINE.STR,2); /* close logfile */
560
(void) MID_MOVKEY("O",vmsbuf); /* write keywords out */
567
/* Enable AST for PREPA -> PROCESS mailbox read demand */
569
stat = OSY_ENAST(mbchan,"READATT",DCLDEM,0);
570
if (stat != ERR_NORMAL)
572
(void) printf("could not enable AST for READATT, status = %x\n\r",stat);
577
/* hibernate until something happens */
580
if (stat != ERR_NORMAL)
582
(void) printf("problems with hibernating call, status = %x\n\r",stat);
587
/* --- we only get here after having been woken up by the subprocess --- */
592
if (MONIT.PROCESS >= 3)
594
(void) strcpy(vmsbuf,FRONT.STARTUP); /* get name of startup directory */
596
(void) strcpy(&vmsbuf[kk],"FORGR .KEY");
597
vmsbuf[kk+5] = FRONT.DAZUNIT[0];
598
vmsbuf[kk+6] = FRONT.DAZUNIT[1];
599
(void) MID_MOVKEY("IM",vmsbuf); /* get keywords back */
600
(void) MID_LOG('I',FRONT.DAZUNIT,2); /* open logfile again */
602
if (MONIT.PROCESS == 9) /* get current time after execution */
604
(void) sprintf(vmsbuf,"after %s",image);
618
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
620
kill foreground subprocess;
622
PID is stored in MONIT.PID - use system service calls
625
----------------------------------------------------------------*/
631
/* flush terminal I/O + delete process */
633
(void) OSY_CANCEL(ttchan);
635
if (MONIT.PROCESS != -1)
637
stat = OSY_DELPRC(&MONIT.PID); /* try to abort foreground process */
638
if (stat != ERR_NORMAL)
639
(void) printf("problems with process deletion, status = %x\n\r",stat);
651
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
653
assign the standard I/O streams for subprocess
655
use DCLOP to pass "$ASSIGN commands" to the subprocess
658
--------------------------------------------------------------------*/
660
char *indev /*IN: point to input device (with '\0') */;
661
char *outdev /*OUT: output device (with '\0') */;
669
DCLOP("$SET NOVERIFY"); /* Switch off verify in subprocess */
671
DCLOP("$SET NOON"); /* Prevent error exit */
673
(void) strcpy(work,"$ASSIGN ");
674
(void) strcpy(&work[8],indev);
677
(void) strcpy(&work[mm]," SYS$COMMAND"); /* $ASSIGN indev SYS$COMMAND */
679
(void) strcpy(&work[mm]," SYS$INPUT"); /* $ASSIGN indev SYS$INPUT */
681
(void) strcpy(&work[mm]," FOR$READ"); /* $ASSIGN indev FOR$READ */
683
(void) strcpy(&work[mm]," DBG$INPUT"); /* $ASSIGN indev DBG$INPUT */
685
(void) strcpy(&work[mm]," TT"); /* $ASSIGN indev SYS$COMMAND */
688
(void) strcpy(&work[8],outdev);
690
(void) strcpy(&work[mm]," SYS$OUTPUT"); /* $ASSIGN outdev SYS$OUTPUT */
701
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
703
service AST when subprocess requests next DCL command
708
---------------------------------------------------------------*/
714
/* If first time, set subprocess status = created */
716
if (MONIT.PROCESS == 0) MONIT.PROCESS = 1;
719
/* Wake the main process */
722
if (stat != ERR_NORMAL)
726
/* for host (DCL) commands we may have to reset SYS$INPUT... */
728
if (KAUX.DCLINP == 1)
731
(void) strcpy(vmsbuf,"$ASSIGN ");
732
(void) strcpy(&vmsbuf[8],Userterm);
733
(void) strcat(vmsbuf," SYS$INPUT");
745
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
747
service AST when subprocess terminates
752
------------------------------------------------------------------*/
757
/* Set the process status flag */
761
/* Wake the main process if hibernating */
765
if (stat != ERR_NORMAL)
776
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
778
kill subprocesses on forced exit of main process
780
will be called as EXH(stat) when main process crashes
784
------------------------------------------------------------------*/
786
int *stat /* IN: status of exit */;
790
/* Last chance to get rid of subprocesses */
792
if (MONIT.PROCESS != -1)
794
*stat = OSY_DELPRC(&MONIT.PID);
798
if (KIWORDS[OFF_AUX+7] == 1) ostraw(0);
808
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
810
pass DCL input to subprocess via mailbox
812
get mailbox from keyword CHANNEL + use system service calls
815
-------------------------------------------------------------------------*/
817
char *dcl /* IN: pointer to host command (terminated by '\0') */;
824
/* Write DCL command to mailbox */
826
stat = OSY_WRCHAN(mbchan,dcl,(int)strlen(dcl));
828
if (stat != ERR_NORMAL)
830
if (strncmp(dcl,"$RUN",4) == 0)
835
for (nr=0; nr<4; nr++)
837
if (EPATH[nr].STR[0] == '\0') break;
839
m = CGN_COPY(string,EPATH[nr].STR);
840
(void) strcpy(&string[m],dcl);
841
stat = OSY_WRCHAN(mbchan,string,(int)strlen(string));
842
if (stat == ERR_NORMAL) return;
845
(void) printf("problems with OSY_WRCHAN of %s ...\n\r",dcl);
856
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
858
AST routine for CTRL/C
860
reset any procedure level, clear local keys + force exit of image in subproce
863
-----------------------------------------------------------------------*/
869
/* proceed unless subprocess isn't running a job */
871
(void) strcpy(vmsbuf,"FORGR ");
872
vmsbuf[5] = FRONT.DAZUNIT[0];
873
vmsbuf[6] = FRONT.DAZUNIT[1];
875
stat = OSY_FORCEX(vmsbuf);
876
if (stat != ERR_NORMAL) ospexit(1);
878
MONIT.CTRLC = 1; /* indicate the interrupt */
887
#else /* Unix part */
891
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
893
run given image in a subprocess
895
enable CNTRL/C AST to terminate a foreground process
898
---------------------------------------------------------------------*/
900
char *image /*IN: image to be executed in the subprocess */;
904
long int oshtime(), startsecs, elapsed;
906
char cbuf[240], *cptr;
913
/* image name or host opsys command? */
917
MONIT.PROCESS = 2; /* host opsys command: set flag */
918
exec_stat = DCLOP(image);
923
MONIT.PROCESS = 3; /* image name: set flag + prepare execution of image */
925
if (MONIT.MDEBUG[MONIT.LEVEL] != 0)
927
if (MONIT.MDEBUG[MONIT.LEVEL] == 2) /* we use the debugger */
931
char debugflags[42], debugopt[42];
934
cptr = cbuf + 1; /* have one byte in front */
935
SCKRDC("MID$DEBUG",40,1,1,&iav,cptr,&uni,&nulo);
938
kk = CGN_INDEXC(cbuf,' ');
940
if (cbuf[1] != '$') /* debugger runs in host OS */
945
SCKRDC("MID$DEBUG",40,2,1,&iav,debugflags,&uni,&nulo);
946
SCKRDC("MID$DEBUG",40,3,1,&iav,debugopt,&uni,&nulo);
947
if (debugflags[0] != '?')
949
for (nr=39; nr>0; nr--)
951
if (debugflags[nr] != ' ') break;
953
debugflags[++nr] = ' ';
954
debugflags[++nr] = '\0';
955
(void) strcat(cptr,debugflags);
957
(void) strcat(cptr,image);
958
if (debugopt[0] != '?')
960
for (nr=39; nr>0; nr--)
962
if (debugopt[nr] != ' ') break;
964
debugopt[nr+1] = '\0';
965
(void) strcat(cptr," ");
966
(void) strcat(cptr,debugopt);
971
else /* get the current time first */
973
startsecs = oshtime();
978
/* close logfile + write keywords out */
980
fixout(1,MONIT.LEVEL); /* close any ASCII out file */
981
(void) MID_LOG('O',LINE.STR,2); /* close logfile */
982
(void) MID_MOVKEY("O",cbuf); /* write keywords out */
984
/* printf("image = %s\n",image); */
985
exec_stat = DCLOP(image);
987
/* on return from subprocess move keyword stuff back in */
989
if (FRONT.ENV == '*') /* from Unix command line */
990
(void) MID_MOVKEY("IM","**"); /* get keywords back in */
992
(void) MID_MOVKEY("IM",keyfile); /* inside Midas */
994
(void) MID_LOG('I',FRONT.DAZUNIT,2); /* open logfile again */
996
if (MONIT.PROCESS >= 8) /* special treatment? */
998
if (MONIT.PROCESS == 9) /* get current time after execution */
1000
elapsed = oshtime();
1001
elapsed -= startsecs;
1002
(void) sprintf(cbuf,"elapsed time: %ld secs for %s",elapsed,image);
1010
if (exec_stat != ERR_NORMAL) /* now we can also log */
1011
{ /* errors from the execution */
1012
if (exec_stat == ERR_OPSSYS)
1014
char *mypr, *osmsg();
1017
(void) sprintf(KAUX.OUT,"(ERR) Problems in executing %s",image);
1022
else /* ERR_INPINV for timeout */
1024
(void) sprintf(KAUX.OUT,"(ERR) %s timed out (%d seconds)",
1025
image,MONIT.MAXTIME);
1030
KIWORDS[OFF_PRSTAT] = kk; /* store status and error source */
1031
KIWORDS[OFF_PRSTAT+1] = 100; /* into key PROGSTAT */
1042
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1044
start up subprocess to run executable
1049
-------------------------------------------------------------------------*/
1051
char *dcl /* IN: pointer to host command (terminated by '\0') */;
1054
int pid, maxtime, stat;
1059
maxtime = MONIT.MXT[MONIT.LEVEL];
1060
if ((maxtime > 0) && (MONIT.LEVEL > 0))
1064
maxtime = (int) (MONIT.ENDT[MONIT.LEVEL] - oshtime());
1065
if (maxtime < 1) return (ERR_INPINV);
1068
stat = OSY_SPAWN(0,dcl,prefix,maxtime,&pid);
1070
if (MONIT.PROCESS == 2)
1072
KIWORDS[OFF_AUX+16] = stat; /* host return status => AUX_MODE(17) */
1077
if ( (stat != ERR_NORMAL) && (oserror == ENOENT) )
1082
for (nr=0; nr<4; nr++)
1084
if (EPATH[nr].STR[0] != '\0')
1086
m = CGN_COPY(string,EPATH[nr].STR);
1087
(void) strcpy(&string[m],dcl);
1088
if ((stat = OSY_SPAWN(0,string,prefix,maxtime,&pid)) == ERR_NORMAL)