1: # include <ingres.h> 2: # include <aux.h> 3: # include <access.h> 4: # include <sccs.h> 5: 6: SCCSID(@(#)closecat.c 8.1 12/31/84) 7: 8: /* 9: ** CLOSECATALOG -- close system catalog 10: ** 11: ** This routine closes the sysetm relations opened by calls 12: ** to opencatalog. 13: ** 14: ** The 'Desxx' struct defines which relations will be closed 15: ** in this manner and is defined in .../source/aux.h. 16: ** 17: ** The actual desxx structure definition is in the file 18: ** 19: ** catalog_desc.c 20: ** 21: ** which defines which relations can be cached and if any 22: ** alias descriptors exist for the relations. That file 23: ** can be redefined to include various caching. 24: ** 25: ** Parameters: 26: ** really - whether to actually close the relations 27: ** or just update and flush them. 28: ** 29: ** Returns: 30: ** none 31: ** 32: ** Side Effects: 33: ** A relation is (may be) closed and its pages flushed 34: ** 35: ** Trace Flags: 36: ** none 37: */ 38: 39: 40: closecatalog(really) 41: bool really; 42: { 43: register struct desxx *p; 44: extern struct desxx Desxx[]; 45: extern long CmOfiles; 46: 47: for (p = Desxx; p->cach_relname; p++) 48: { 49: if (really && !p->cach_alias) 50: { 51: CmOfiles &= ~(1 << p->cach_desc->relfp); 52: if (closer(p->cach_desc) < 0) 53: syserr("closecat %s", p->cach_relname); 54: } 55: else 56: { 57: if (noclose(p->cach_desc) < 0) 58: syserr("closecat %s", p->cach_relname); 59: if (really) 60: p->cach_desc->relopn = 0; 61: } 62: } 63: }