|
|
1.1 ! root 1: /* ! 2: * static char ID_lckc[] = "@(#) lock.c: 1.1 1/7/82"; ! 3: */ ! 4: ! 5: char *lock(itemid, partnbr, permissions) ! 6: ITEMID itemid; ! 7: int partnbr, permissions; ! 8: { ! 9: ! 10: register int framenbr, spacenbr; ! 11: ! 12: spacenbr = XTRCTSP(itemid); ! 13: if( open_spacenumbers[spacenbr] != YES ) ! 14: return( (char *) fatal("attempt to access unopened address space") ); ! 15: if( XTRCTPN(itemid) > global_frames[spacenbr].maxpage ) ! 16: return( (char *) fatal("attempt to read unallocated page") ); ! 17: ! 18: LD_lock++; ! 19: #if DEBUG ! 20: if( dflag > 15 ) ! 21: fprintf( stderr, " lock %08lx ", itemid ); ! 22: #endif ! 23: ! 24: if( (framenbr = sojourn((itemid & ~BYTEMASK), partnbr, YES)) < 0 ) ! 25: return( (char *) fatal("unable to obtain frame for item") ); ! 26: ! 27: if( manager[framenbr].lock_count++ == 0 ) ! 28: if( delist(framenbr) < 0 ) ! 29: return( (char *) fatal("unable to delist frame for item") ); ! 30: ! 31: if( permissions == WRTN ) ! 32: manager[framenbr].ref_chng = WRTN; ! 33: ! 34: return( (char *) (((int) manager[framenbr].frame_pntr) + XTRCTBY(itemid)) ); ! 35: ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.