1: # include   "../ingres.h"
   2: # include   "../lock.h"
   3: struct lockreq  Lock;
   4: /*
   5: /*
   6:  *	setrll- set a relation lock
   7:  */
   8: setrll(act, rtid, mod)
   9: char    act;
  10: long    rtid;
  11: char    mod;
  12: {
  13:     register char   *r;
  14:     register int    i;
  15: 
  16: #	ifdef xATR1
  17:     if (tTf(98,  4))
  18:         printf(" setrll a=%d r=%s m=%o \n", act, locv(rtid),  mod);
  19: #	endif
  20:     if (Alockdes < 0)
  21:         return(1);
  22:     Lock.lract = act;   /* sleep (act = 2) or error return (act = 1)*/
  23:     Lock.lrtype = T_REL;    /* relation lock */
  24:     Lock.lrmod = mod;   /* exclusive (mod = 1) or shared (mod = 2)*/
  25:     bmove(&rtid, Lock.lrel, 4); /* copy relation id */
  26:     r = Lock.lpage;
  27:     for (i = 0; i < 4; i++)
  28:             /* zero out page id */
  29:         *r++ = 0;
  30:     i = write(Alockdes, &Lock, sizeof(struct lockreq));
  31:     return(i);
  32: }
  33: /*
  34:  *	unlrel- unlock a relation lock
  35:  */
  36: unlrl(rtid)
  37: long    rtid;
  38: {
  39:     register char   *r;
  40:     register int    i;
  41: 
  42: #	ifdef xATR1
  43:     if (tTf(98,  5))
  44:         printf(" unlrl r=%s \n", locv(rtid));
  45: #	endif
  46:     if (Alockdes < 0)
  47:         return (1);
  48:     Lock.lract = A_RLS1;
  49:     Lock.lrtype = T_REL;    /* relation lock */
  50:     bmove(&rtid, Lock.lrel, 4); /* copy relation id */
  51:     r = Lock.lpage;
  52:     for (i = 0; i < 4; i++)
  53:             /* zero out pageid */
  54:         *r++ = 0;
  55:     i = write(Alockdes, &Lock, sizeof(struct lockreq));
  56:     return (i);
  57: }
Last modified: 1995-02-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2274
Valid CSS Valid XHTML 1.0 Strict