library/src/semaphores/BP-Semaphores.cc
// Will look into /system/semaphores and display all semaphores.
Will look into /system/semaphores and display all semaphores.
Will look into / system / semaphores and display all semaphores .
BP_ERROR_T BP_DisplaySemaphores(BP_BOOL display_lock_order)
{
	BP_SEMAPHORE_VALIDATE_WORKING_ENVIRONMENT(ERR_FAILURE);
	char * table_path[] = {"system", "semaphores", NULL};
	P_BP_HASH_TABLE_KEYED_ENTRY semaphores_table = BP_HashRegLookupTableByPath
	(
		NULL,
		(BP_HASH_TABLE_TRAVERSAL_PATH) &table_path
	);
	if(!semaphores_table)
	{
		printf("\n [!!] Error: Could not lookup global semaphores table when attempting to display semaphores.  This is critical.");
		return ERR_FAILURE;
	}
	if(!semaphores_table->data)
		return ERR_FAILURE;
	semaphores_table = (P_BP_HASH_TABLE_KEYED_ENTRY) semaphores_table->data;
	printf("\n [+] Displaying all GHT Semaphores found in /system/semaphores:");
	P_BP_HASH_TABLE_KEYED_ENTRY entry     = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY tmp       = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY tmp_table = NULL;
	HASH_ITER(hh, semaphores_table, entry, tmp)
	{
		tmp_table = (P_BP_HASH_TABLE_KEYED_ENTRY) entry->data;
		if(entry->type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		{
			printf("\n Got Semaphore Entry!!");
			continue;
		}
		else
		{
			BP_DisplaySemaphoreTable(entry);
		}
	}
	printf("\n");
	return ERR_SUCCESS;
}
BP_ERROR_T BP_DisplaySemaphores ( BP_BOOL display_lock_order ) { BP_SEMAPHORE_VALIDATE_WORKING_ENVIRONMENT ( ERR_FAILURE ) ; char * table_path [ ] = { " " , " " , NULL } ; P_BP_HASH_TABLE_KEYED_ENTRY semaphores_table = BP_HashRegLookupTableByPath ( NULL , ( BP_HASH_TABLE_TRAVERSAL_PATH ) & table_path ) ; if ( ! semaphores_table ) { printf ( " \n " ) ; return ERR_FAILURE ; } if ( ! semaphores_table -> data ) return ERR_FAILURE ; semaphores_table = ( P_BP_HASH_TABLE_KEYED_ENTRY ) semaphores_table -> data ; printf ( " \n " ) ; P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp_table = NULL ; HASH_ITER ( hh , semaphores_table , entry , tmp ) { tmp_table = ( P_BP_HASH_TABLE_KEYED_ENTRY ) entry -> data ; if ( entry -> type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) { printf ( " \n " ) ; continue ; } else { BP_DisplaySemaphoreTable ( entry ) ; } } printf ( " \n " ) ; return ERR_SUCCESS ; }
Will look into /system/semaphores and display all semaphores.
Will look into / system / semaphores and display all semaphores .
// validate that there is a working environment // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Lookup Semaphores Table %%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create table path // attempt to lookup table // ensure the semaphores table exists // ensure there's a data member, if not we have nothing to display // advance table past the actual semaphores table // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Now Display Entries %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // temporary iterator values used during the HASH_ITER loop below // iterate entries // set temp table // It's either a data entry or a hash table.  Display either based on // parameter preference. // display the data entry /*
			BP_HashRegDisplayDataEntry
			(
					hreg,
					entry,
					display_tab_depth
			);
			*/ // continue the loop // printf("\n Got Semaphore TABLE!!"); // display the semaphore table // recurse here // BP_HashRegDisplayTable(NULL, entry, BP_FALSE, BP_FALSE, BP_FALSE); // iterate // return indicating success