static int check_deadlock(event_content_type * event_content, SERVER_lp_state_type * pointer) { if (pointer == NULL || event_content == NULL) return -1; return check_cycle(pointer->cc_metadata->locks[event_content->applicative_content.object_key_id], event_content->applicative_content.tx_id, pointer); }
/** * checkheap - Function to check the consistency of the heap * @param verbose How much information to be printed on the screen */ void checkheap(int verbose) { /* Checks: * 1. Check each block for * a. Alignment * b. Header and Footer : * i. Size Match * ii. Header Footer Match Each other * c. In Heap * 2. Get next block in free list. * 3. Check for no extra block in heap, from the seg lists * 4. Check for the cycle in the list. * 5. Check Epilogue Block * 6. Check Prologue Block * 7. Check proper coalescing - no previous and next free blocks */ char *bp = heap_listp; /** * run checkheap with verbose =9 to avoid compiler from giving error, * and also making sure that checkheap doesnot run */ if(verbose == 9) { return; } /** * Following condition never will be true. * A place function to avoid compiler compalaining */ if(verbose ==10) { print_free_block(GET_SEGI(seg_list,0)); } if (verbose){ dbg_printf("Heap (%p):\n", heap_listp); } /*Check for epilogue*/ if ((GET_SIZE(HDRP(heap_listp)) != DSIZE) || !GET_ALLOC(HDRP(heap_listp))){ printf("ERROR: Bad prologue header\n"); } /*Check header block for issues*/ checkblock(heap_listp); /*Now check the complete heap*/ for (bp = heap_listp; GET_SIZE(HDRP(bp)) > 0; bp = NEXT_BLKP(bp)) { if (verbose) { printblock(bp);/*If Verbose , Print the heap*/ } checkblock(bp); } if (verbose) printblock(bp); /*Check for Epilogue*/ if ((GET_SIZE(HDRP(bp)) != 0) || !(GET_ALLOC(HDRP(bp)))) { printf("ERROR: Bad epilogue header for block \n"); printblock(bp); } /** * Checks with respect to seg list */ /*Check if all the pointers in all the free lists are aligned*/ check_seg_pointers(); /* Check for count of free blocks, iterating over blocks and by * going through next pointers*/ check_count_free_list(); /*Check for cycle in the free list*/ check_cycle(); }