|
|
1.1 ! root 1: static char ID[] = "@(#) disconnect.c: 1.2 12/8/82"; ! 2: #include <stdio.h> ! 3: #include "sdp.h" ! 4: #include "define3.h" ! 5: ! 6: #ifdef SHORT ! 7: #define DI01 "DI01 " ! 8: #define DI02 "DI02 " ! 9: #define DI03 "DI03 " ! 10: #define DI04 "DI04 " ! 11: #define DI05 "DI05 " ! 12: #define DI06 "DI06 " ! 13: #define DIAU "DIAU " ! 14: #else ! 15: #define DI01 "DI01 -- space to be disconnected has item in use\n%o\n",sp ! 16: #define DI02 "DI02 -- permission conflict\n%d\t%d\t%d\n",sp->perms,j,manager[j].ref_chng ! 17: #define DI03 "DI03 -- error return from writeframe\n%o\n",sp ! 18: #define DI04 "DI04 -- fail to close open file\n%o\n",sp ! 19: #define DI05 "DI05 -- error return from wrtSPACE\n%o\n",sp ! 20: #define DI06 "DI06 -- space not connected\n%o\n",sp ! 21: #define DIAU "%s","DIAU -- audit failed in sdp_disconnect\n" ! 22: #endif ! 23: ! 24: #ifdef SWEET ! 25: #define PROLOG ! 26: #define EPILOG ! 27: #else ! 28: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\ ! 29: ERR_RET(DIAU,ERROR) ! 30: #define EPILOG if(aud_flag == AUDITON)\ ! 31: aud_set() ;\ ! 32: if(hist_fp != NULL)\ ! 33: fprintf(hist_fp,"DI\t%o\n",sp) ; ! 34: #endif ! 35: ! 36: extern int aud_flag ; ! 37: extern struct LIBFILE *Glib_file ; ! 38: extern FILE *hist_fp ; ! 39: extern struct SPACE *first_space ; ! 40: ! 41: extern aud_set() ; ! 42: extern int aud_check() ; ! 43: extern FATAL() ; ! 44: extern rem_frame() ; ! 45: extern writeframe() ; ! 46: extern int wtSPACE() ; ! 47: extern freeSPACE() ; ! 48: ! 49: int /* SUCCESS or ERROR */ ! 50: sdp_disconnect(sp) ! 51: struct SPACE *sp ; ! 52: { ! 53: register int j ; ! 54: register int k ; ! 55: register struct MANAGER *manager ; ! 56: register struct SPACE *curr ; ! 57: register struct SPACE *next ; ! 58: register struct SPACE *prev ; ! 59: ! 60: PROLOG ! 61: prev = NULL ; ! 62: for(curr=first_space; curr!=NULL; curr=next) ! 63: { ! 64: next = curr->next_space ; ! 65: ! 66: if( (sp==curr) || (sp==NULL) ) ! 67: { ! 68: Glib_file = curr->lib_file ; ! 69: ! 70: manager = (curr->environ)->manp ; ! 71: for(j=0; j<(curr->environ)->num_frames; j++) ! 72: if(manager[j].space == curr) ! 73: { ! 74: if(manager[j].usecount != 0) ! 75: ERR_RET(DI01,ERROR) ! 76: ! 77: if(manager[j].ref_chng == WRTN) ! 78: if(curr->perms != WRTN) ! 79: ERR_RET(DI02,ERROR) ! 80: else ! 81: if(writeframe(curr,j) == ERROR) ! 82: ERR_RET(DI03,ERROR) ! 83: manager[j].space = NULL ; ! 84: manager[j].page_id = IDNULL ; ! 85: manager[j].ref_chng = RCNULL ; ! 86: rem_frame(curr->environ,j) ; ! 87: manager[j].forward = (curr->environ)->empties ; ! 88: (curr->environ)->empties = j ; ! 89: } ! 90: ! 91: for(k=0; k<curr->numbfile; k++) ! 92: switch(curr->fileinfo[k].desc) ! 93: { ! 94: case CLOSED: ! 95: case NOTMADE: ! 96: break ; ! 97: ! 98: default: ! 99: if(MCLOSE(curr->fileinfo[k].desc) == ERROR) ! 100: ERR_RET(DI04,ERROR) ! 101: curr->fileinfo[k].desc = CLOSED ; ! 102: } ! 103: ! 104: (curr->environ)->cnct_count-- ; ! 105: if( (curr->perms == WRTN) && (wtSPACE(curr) == ERROR) ) ! 106: ERR_RET(DI05,ERROR) ! 107: ! 108: freeSPACE(curr) ; ! 109: ! 110: if(prev == NULL) ! 111: first_space = next ; ! 112: else ! 113: prev->next_space = next ; ! 114: if(sp == curr) ! 115: break ; ! 116: } ! 117: else ! 118: prev = curr ; ! 119: ! 120: } ! 121: ! 122: if( (curr==NULL) && (sp!=NULL) ) ! 123: ERR_RET(DI06,ERROR) ! 124: ! 125: EPILOG ! 126: return(SUCCESS) ; ! 127: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.