|
|
1.1 root 1: /*
2: * static char ID_unlckc[] = "@(#) unlock.c: 1.1 1/7/82";
3: */
4:
5: unlock(itemid, permissions)
6: ITEMID itemid;
7: int permissions;
8: {
9:
10: register index;
11:
12: LD_unlock++;
13: #if DEBUG
14: if( dflag > 15 )
15: fprintf( stderr, "unlock %08lx ", itemid );
16: #endif
17:
18: itemid &= ~BYTEMASK;
19:
20: for( index = 0; index < NUMBERFRAMES; index++ )
21: if( itemid == manager[index].page_id) {
22: manager[index].lock_count--;
23: if( permissions == WRTN )
24: manager[index].ref_chng = WRTN;
25: if( manager[index].lock_count < 0 )
26: return( fatal("attempt to unlock unlocked frame") );
27: if( manager[index].lock_count == 0 )
28: if( enlist(index, MRU) < 0 )
29: return( fatal("unable to replace frame on free list") );
30: return(SUCCESS);
31: }
32:
33: return( fatal("attempt to unlock non-resident item") );
34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.