1 /* *********************************************************** 2 * * 3 * Copyright, (C) Honeywell Bull Inc., 1987 * 4 * * 5 * Copyright, (C) Honeywell Information Systems Inc., 1986 * 6 * * 7 *********************************************************** */ 8 9 /* HISTORY COMMENTS: 10 1) change(86-05-09,Lee), approve(87-07-13,MCR7580), audit(87-07-13,Leskiw), 11 install(87-08-07,MR12.1-1072): 12 Created. 13 END HISTORY COMMENTS */ 14 15 /* : PROCEDURE FUNCTION (destinst) 16 17 Removes the reference to the application from the CAT, deallocates the message 18 buffers, and generates a message to remove reference to the in the remote 19 system's CAT. 20 */ 21 22 #include <dos.h> 23 #include <cat.h> 24 #include <ws_func.h> 25 #include <ws_dcls.h> 26 #include <ws_error.h> 27 28 #define NULL 0 29 30 extern int local_system; /* Local system id */ 31 32 destinst (mcb_ptr) 33 34 mcb **mcb_ptr; /* MCB to be destroyed */ 35 { 36 int sysid; /* System ID of capability */ 37 int cap_index; /* Index into CAT */ 38 int code; 39 struct destinst_param_struct param; /* Parameter structure to i_desins */ 40 41 /* : if mcb_ptr passed is NULL return error_code = WSINVMCB */ 42 43 if (*mcb_ptr == NULL) 44 return (WSINVMCB); 45 46 /* : otherwise 47 - get the system id and index into the CAT table. 48 - if invalid capability index or not the local system 49 -- set the error code */ 50 51 sysid = (int)((*mcb_ptr) -> system_id); 52 cap_index = (int)((*mcb_ptr) -> major_capability) - MIN_CAPABILITY_NUMBER; 53 54 if (cap_index < 0 || cap_index >= NUMBER_OF_CAT_ENTRIES) 55 return (WSINVMCB); 56 if (sysid != local_system) 57 return (WSINVMCB); 58 59 /* : Call into i_desins which accesses MOWSE data segment to let MOWSE know 60 of the destruction */ 61 62 param.cap_index = cap_index; 63 param.mcb_ptr = *mcb_ptr; 64 if (code = call_mowse_int (I$DESTINST, ¶m, sizeof(param))) 65 return (code); 66 67 /* : free up buffers allocated by create_instance and set mcb pointer passed 68 from caller to NULL */ 69 70 free ((*mcb_ptr) -> inalloc); 71 free ((*mcb_ptr) -> outalloc); 72 free (*mcb_ptr); 73 74 *mcb_ptr = NULL; 75 76 return (0); 77 } 78 ^Z