1: # include <ingres.h>
2: # include <lock.h>
3: # include <sccs.h>
4: # include <signal.h>
5:
6: SCCSID(@(#)rllocks.c 8.1 12/31/84)
7:
8: struct lockreq Lock;
9: /*
10: /*
11: * setrll- set a relation lock
12: */
13: setrll(act, rtid, mod)
14: char act;
15: long rtid;
16: char mod;
17: {
18: register char *r;
19: register int i;
20: auto int ret_val;
21:
22: # ifdef xATR1
23: if ( tTf(28,4) )
24: {
25: printf(" setrll act=%d md=%o ", act, mod);
26: dumptid(&rtid);
27: }
28: # endif
29: if (Alockdes < 0)
30: return(1);
31: Lock.lract = act; /* sleep (act = 2) or error return (act = 1)*/
32: Lock.lrtype = T_REL; /* relation lock */
33: Lock.lrmod = mod; /* exclusive (mod = 1) or shared (mod = 2)*/
34: bmove(&rtid, Lock.lrel, 4); /* copy relation id */
35: r = Lock.lpage;
36:
37: /* zero out page id */
38: for (i = 0; i < 4; i++)
39: *r++ = 0;
40:
41: write(Alockdes, &Lock, KEYSIZE+3);
42: read(Alockdes, &ret_val, sizeof (int));
43: return (ret_val);
44: }
45: /*
46: * unlrel- unlock a relation lock
47: */
48: unlrl(rtid)
49: long rtid;
50: {
51: register char *r;
52: register int i;
53: auto int ret_val;
54:
55: # ifdef xATR1
56: if (tTf(28, 5))
57: {
58: printf(" unlrl ");
59: dumptid(&rtid);
60: }
61: # endif
62: if (Alockdes < 0)
63: return (1);
64: Lock.lract = A_RLS1;
65: Lock.lrtype = T_REL; /* relation lock */
66: bmove(&rtid, Lock.lrel, 4); /* copy relation id */
67: r = Lock.lpage;
68: for (i = 0; i < 4; i++)
69: /* zero out pageid */
70: *r++ = 0;
71: i = write(Alockdes, &Lock, KEYSIZE + 3);
72: read(Alockdes, &ret_val, sizeof (int));
73: return (ret_val);
74: }
Defined functions
unlrl
defined in line
48;
never used
Defined variables
Lock
defined in line
8; used 11 times