1: # include   <ingres.h>
   2: # include   <access.h>
   3: # include   <aux.h>
   4: # include   <lock.h>
   5: # include   <sccs.h>
   6: 
   7: SCCSID(@(#)readadmin.c	8.2	1/18/85)
   8: 
   9: /*
  10: **  READADMIN -- read admin file into 'Admin' cache
  11: **
  12: **	The admin file in the current directory is opened and read
  13: **	into the 'Admin' cache.  The admin file contains the following
  14: **	information:
  15: **
  16: **	A header block, containing the owner of the database (that is,
  17: **	the DBA), and a set of status bits for the database as a whole.
  18: **	These bits are defined in aux.h.  This header also includes a
  19: **	field that defines the length of the header part & a version
  20: **	stamp.
  21: **
  22: **	Descriptors for the relation and attribute relations.  These
  23: **	descriptors should be completely correct except for the
  24: **	relfp and relopn fields.  These are required so that the
  25: **	process of opening a relation is not recursive.
  26: **
  27: **	After the admin file is read in, the relation and attribute
  28: **	files are opened, and the relfp and relopn fields in both
  29: **	descriptors are correctly initialized.  Both catalogs are
  30: **	opened read/write.
  31: **
  32: **	WARNING:
  33: **		This routine is redefined by creatdb.  If this
  34: **		routine is changed, check that program also!!
  35: **
  36: **	Parameters:
  37: **		none
  38: **
  39: **	Returns:
  40: **		none
  41: **
  42: **	Side Effects:
  43: **		The 'Admin' struct is filled in from the 'admin' file
  44: **			in the current directory.
  45: **		The 'relation....xx' and 'attribute...xx' files are
  46: **			opened.
  47: **
  48: **	Files:
  49: **		./admin
  50: **			The bootstrap description of the database,
  51: **			described above.
  52: **
  53: **	Trace Flags:
  54: **		none
  55: */
  56: 
  57: readadmin()
  58: {
  59:     register int    i;
  60:     char        relname[MAXNAME + 4];
  61:     extern long lseek();
  62: 
  63:     /* read the stuff from the admin file */
  64:     i = open("admin", O_RDONLY);
  65:     if (i < 0)
  66:         syserr("readadmin: open admin %d", i);
  67:     checkadmin(i);
  68:     close(i);
  69: 
  70:     /* open the physical files for 'relation' and 'attribute' */
  71:     ingresname(Admin.adreld.reldum.relid, Admin.adreld.reldum.relowner, relname);
  72:     if ((Admin.adreld.relfp = open(relname, O_RDWR)) < 0)
  73:         syserr("readadmin: open rel %d", Admin.adreld.relfp);
  74:     ingresname(Admin.adattd.reldum.relid, Admin.adattd.reldum.relowner, relname);
  75:     if ((Admin.adattd.relfp = open(relname, O_RDWR)) < 0)
  76:         syserr("readadmin: open att %d", Admin.adattd.relfp);
  77:     Admin.adreld.relopn = (Admin.adreld.relfp + 1) * -5;
  78:     /* we just want to read here create, modify and destroy fix it up */
  79:     Admin.adattd.relopn = (Admin.adattd.relfp + 1) * 5;
  80: 
  81:     return;
  82: }

Defined functions

readadmin defined in line 7; used 1 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 744
Valid CSS Valid XHTML 1.0 Strict