1: # include   <ingres.h>
   2: # include   <lock.h>
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)dblocks.c	8.1	12/31/84)
   6: 
   7: struct  lockreq Lock;
   8: /*
   9:  *	setdbl - set data base lock for either exclusive or shared
  10:  *		 access.
  11:  */
  12: setdbl(act, mod)
  13: char    act;            /* type request */
  14: char    mod;            /* mod of lock: = 1 for exclusive, = 2 for shared*/
  15: {
  16:     register char   *r;
  17:     register int    i;
  18:     auto    int ret_val;
  19: 
  20: #	ifdef xATR1
  21:     if ( tTf(28,6) )
  22:         printf(" setdbl act=%o md=%o\n", act, mod);
  23: #	endif
  24:     if (Alockdes < 0)
  25:         return (1);
  26:     Lock.lract = act;       /* type of request */
  27:     Lock.lrtype = T_DB;     /* data base lock */
  28:     Lock.lrmod = mod;       /* exclusive or shared */
  29:                     /* zero out rest of key */
  30:     r = Lock.lrel;
  31:     for (i = 0; i < 8; i++)
  32:         *r++ = 0;
  33:     i = write(Alockdes, &Lock, KEYSIZE + 3);
  34:     read(Alockdes, &ret_val, sizeof (int));
  35:     return (ret_val);
  36: }
  37: /*
  38:  *	unldb	- release the data base lock
  39:  */
  40: unldb()
  41: {
  42:     register char   *r;
  43:     register int    i;
  44:     auto    int ret_val;
  45: 
  46: #	ifdef xATR1
  47:     if (tTf(28, 7))
  48:         printf(" unldb\n");
  49: #	endif
  50:     if (Alockdes < 0)
  51:         return (1);
  52:     Lock.lract = A_RLS1;        /* release 1 lock */
  53:     Lock.lrtype = T_DB;     /* a data base lock*/
  54:     r = Lock.lrel;
  55:     for (i = 0; i < 8; i++)     /* zero out part of key*/
  56:         *r++ = 0;
  57:     i = write(Alockdes, &Lock, KEYSIZE + 3);
  58:     read(Alockdes, &ret_val, sizeof (int));
  59:     return (ret_val);
  60: }

Defined functions

setdbl defined in line 12; used 1 times
unldb defined in line 40; never used

Defined variables

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