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