STOPRO Stop Process Utility 5-DEC-1990 19:24:22 VAX DIBOL V4.1-00 Page 1 Data Division 5-DEC-1990 17:20:06 DUB0:[DECUS]STOPRO.DBL;1 .title 'Stop Process Utility' ; ; ; S T O P R O . D B L ; ; ; This Utility will force a process to exit ; execution of current image and return to ; command level ($). ; ; Ver/Edit Edit Date By Reason ; ; V1.0-00A ; ; .page .include "$JPIDEF" library "SYS$LIBRARY:DBLSTARLET" .include "$SYIDEF" library "SYS$LIBRARY:DBLSTARLET" STOPRO Stop Process Utility 5-DEC-1990 19:24:22 VAX DIBOL V4.1-00 Page 12 Data Division 5-DEC-1990 17:20:06 DUB0:[DECUS]STOPRO.DBL;1 424 EXTERNAL LITERAL 425 STP_SUCCESS ,I4 426 EXTERNAL FUNCTION 427 LIB$SIGNAL ,%VAL 428 EXTERNAL FUNCTION 429 OTS$CVT_TZ_L ,%VAL 430 EXTERNAL FUNCTION 431 SYS$FORCEX ,%VAL 432 EXTERNAL FUNCTION 433 SYS$GETJPIW ,%VAL 434 EXTERNAL FUNCTION 435 SYS$GETSYIW ,%VAL 436 RECORD 437 GROUP Item_List ,[5]A 438 1 Buff_Length ,I2 439 1 Item_Code ,I2 440 1 Buffer_Addr ,I4 441 1 Return_Length ,I4 442 1 ENDGROUP 443 End_Of_List ,I4 444 RECORD SEARCH 445 SEARCH_PROCESS_ID ,I4 ;Will verify existence of this PID. 446 SEARCH_PROC_NAME ,A15 ;Process Name returned from Search. 447 SEARCH_USER_NAME ,A12 ;User Name returned from Search. 448 SEARCH_TERM_NAME ,A7 ;Terminal Name returned from Search. 449 SEARCH_NODE_NAME ,A15 ;Node Name returned from Search. 450 SEARCH_IMAGE_NAME ,A39 ;Image Name returned from Search. 451 RECORD 452 ZERO ,I4,0 ;Longword Zero 453 PID ,A8 ;Process Id Entered. 454 INT_PID ,I4 ;Integer representation of "PID" 455 INT_PID_LENGTH ,I4 ;Length of Integer PID value returned. 456 PROCESS_NAME ,A15 ;Process Name. 457 COND_VALUE ,I4 ;Conditional Value Returned. 458 CHAIN ,A39 ;Process to chain to from this utility (Optional). 459 BLANK ,A39 ;Blank for compares. 460 STATUS ,I4 ;Status of Forced Exit Call. 461 RESPONSE ,A1 ;Response Entered by User. 462 LOOP ,D3 ;Increment for loop control. 463 PROC_ID ,A8 ;Process ID. 464 PROC_NAME ,A15 ;Process Name. 465 USER_NAME ,A12 ;User Name. 466 TERM_NAME ,A7 ;Terminal Name. 467 NODE_NAME ,A15 ;Process Name. 468 IMAGE_NAME ,A39 ;Image Name. 469 STAT ,I4 ;Status Value of External Call. 470 IOSB ,[4]I2 ;I/O Status Block. STOPRO Stop Process Utility 5-DEC-1990 19:24:22 VAX DIBOL V4.1-00 Page 14 Procedure Division 5-DEC-1990 17:20:06 DUB0:[DECUS]STOPRO.DBL;1 471 PROC 472 AAA_BEGIN_UTILITY, 473 XCALL FLAGS (0001000000) 474 OPEN (1,O,'SYS$OUTPUT:') 475 ABA_OBTAIN_PID, 476 DISPLAY (1,) 477 DISPLAY (1,"STOPRO - Utility to Force Image Exit") 478 DISPLAY (1,"Enter Process ID: ") 479 READS (1,PID) 480 STATUS = %OTS$CVT_TZ_L(%DESCR(PID),%REF(INT_PID), & %VAL(INT_PID_Length),%VAL(1)) 481 IF (.NOT.%SUCCESS(STATUS)) XCALL LIB$STOP (%VAL(STATUS)) 482 CALL BAA_OBTAIN_PID_INFO 483 PROC_ID = %HEX(SEARCH_PROCESS_ID) 484 PROC_NAME = SEARCH_PROC_NAME 485 USER_NAME = SEARCH_USER_NAME 486 TERM_NAME = SEARCH_TERM_NAME 487 NODE_NAME = SEARCH_NODE_NAME 488 IMAGE_NAME = SEARCH_IMAGE_NAME ;Display information we just obtained and ask them ;if they are sure they want to force this image to exit. 489 DISPLAY (1,) 490 DISPLAY (1,"Process ID") 491 DISPLAY (1,PROC_ID) 492 DISPLAY (1,"User Name") 493 DISPLAY (1,USER_NAME) 494 DISPLAY (1,"Node Name") 495 DISPLAY (1,NODE_NAME) 496 DISPLAY (1,"Process Name") 497 DISPLAY (1,PROC_NAME) 498 DISPLAY (1,"Terminal Name") 499 DISPLAY (1,TERM_NAME) 500 DISPLAY (1,"Image Name") 501 DISPLAY (1,IMAGE_NAME) .page STOPRO Stop Process Utility 5-DEC-1990 19:24:22 VAX DIBOL V4.1-00 Page 15 Procedure Division 5-DEC-1990 17:20:06 DUB0:[DECUS]STOPRO.DBL;1 502 ABA_100_ARE_YOU_SURE, 503 DISPLAY (1,"Are you sure you want to force this image to exit (Y/N): " & ) 504 READS (1,RESPONSE) 505 IF (RESPONSE .EQ. 'N') GOTO ABA_OBTAIN_PID 506 IF (RESPONSE .NE. 'Y') GOTO ABA_100_ARE_YOU_SURE 507 ACA_STOP_PROCESS, 508 STATUS = %SYS$FORCEX (%REF(INT_PID),,%VAL(STP_SUCCESS)) 509 IF (.NOT.%SUCCESS(STATUS)) XCALL LIB$STOP (%VAL(STATUS)) 510 STATUS = %LIB$SIGNAL (%VAL(STP_SUCCESS),%VAL(1),IMAGE_NAME) 511 AZA_EXIT_UTILITY, 512 STOP 513 BAA_OBTAIN_PID_INFO, ;Obtain Process info for this PID. 514 Item_List[1].Buff_Length = %SIZE(SEARCH_PROCESS_ID) 515 Item_List[1].Item_Code = JPI$_PID 516 Item_List[1].Buffer_Addr = %ADDR(SEARCH_PROCESS_ID) 517 Item_List[1].Return_Length = Zero 518 Item_List[2].Buff_Length = %SIZE(SEARCH_PROC_NAME) 519 Item_List[2].Item_Code = JPI$_PRCNAM 520 Item_List[2].Buffer_Addr = %ADDR(SEARCH_PROC_NAME) 521 Item_List[2].Return_Length = Zero 522 Item_List[3].Buff_Length = %SIZE(SEARCH_USER_NAME) 523 Item_List[3].Item_Code = JPI$_USERNAME 524 Item_List[3].Buffer_Addr = %ADDR(SEARCH_USER_NAME) 525 Item_List[3].Return_Length = Zero 526 Item_List[4].Buff_Length = %SIZE(SEARCH_TERM_NAME) 527 Item_List[4].Item_Code = JPI$_TERMINAL 528 Item_List[4].Buffer_Addr = %ADDR(SEARCH_TERM_NAME) 529 Item_List[4].Return_Length = Zero 530 Item_List[5].Buff_Length = %SIZE(SEARCH_IMAGE_NAME) 531 Item_List[5].Item_Code = JPI$_IMAGNAME 532 Item_List[5].Buffer_Addr = %ADDR(SEARCH_IMAGE_NAME) 533 Item_List[5].Return_Length = Zero 534 End_Of_List = Zero 535 STAT = %SYS$GETJPIW(,%REF(INT_PID),,%REF(Item_List),%Ref(IOSB),,) 536 IF (.NOT.%SUCCESS(STAT)) XCALL LIB$STOP (%VAL(STAT)) STOPRO Stop Process Utility 5-DEC-1990 19:24:22 VAX DIBOL V4.1-00 Page 17 Procedure Division 5-DEC-1990 17:20:06 DUB0:[DECUS]STOPRO.DBL;1 537 BAA_010_CLEAR_ITEM_LIST, 538 CLEAR LOOP 539 FOR LOOP FROM 1 THRU 5 540 1 BEGIN 541 1 CLEAR Item_List[Loop].Buff_Length 542 1 CLEAR Item_List[Loop].Item_Code 543 1 CLEAR Item_List[Loop].Buffer_Addr 544 1 CLEAR Item_List[Loop].Return_Length 545 1 END 546 BAA_020_CHECK_NODE_NAME, ;Obtain Node Name for Cluster Enviroment. 547 Item_List[1].Buff_Length = %SIZE(SEARCH_NODE_NAME) 548 Item_List[1].Item_Code = SYI$_NODENAME 549 Item_List[1].Buffer_Addr = %ADDR(SEARCH_NODE_NAME) 550 Item_List[1].Return_Length = Zero 551 End_Of_List = Zero 552 STAT = %SYS$GETSYIW (,,,%REF(Item_List),%Ref(IOSB),,) 553 IF (.NOT.%SUCCESS(STAT)) XCALL LIB$STOP (%VAL(STAT)) 554 BAA_EXIT, 555 RETURN No errors detected DIBOL/NOSTANDARD/OBJECT/LIS STOPRO + Begin STOPROMSG.MSG .TITLE Stop Process Routine Messages .IDENT 'Version 1.00' .FACILITY STOPRO,1/PREFIX=STP_ .SEVERITY ERROR SUCCESS .END + End STOPROMSG.MSG + Begin STOPRO.COM $ define lnk$library sys$library:dbluesl $ define lnk$library_1 sys$library:dblossl $ dibol/nostandard/object/lis stopro $ message/object stopromsg $ link/notrace/exe stopro,stopromsg + Begin STOPRO.COM