コード例 #1
0
ファイル: IOKitDebug.cpp プロジェクト: SbIm/xnu-env
void db_dumpiojunk( const IORegistryPlane * plane )
{
    IORegistryEntry *		next;
    IORegistryIterator * 	iter;
    OSOrderedSet *		all;
    char			format[] = "%xxxs";
    IOService *			service;

    iter = IORegistryIterator::iterateOver( plane );

    all = iter->iterateAll();
    if( all) {
        dbugprintf("Count %d\n", all->getCount() );
        all->release();
    } else dbugprintf("Empty\n");

    iter->reset();
    while( (next = iter->getNextObjectRecursive())) {
		snprintf(format + 1, sizeof(format) - 1, "%ds", 2 * next->getDepth( plane ));
		dbugprintf( format, "");
		dbugprintf( "%s", next->getName( plane ));
		if( (next->getLocation( plane )))
				dbugprintf("@%s", next->getLocation( plane ));
		dbugprintf(" <class %s", next->getMetaClass()->getClassName());
			if( (service = OSDynamicCast(IOService, next)))
				dbugprintf(", busy %ld", service->getBusyState());
		dbugprintf( ">\n");
    }
    iter->release();
}
コード例 #2
0
ファイル: IOKitDebug.cpp プロジェクト: SbIm/xnu-env
void IOPrintPlane( const IORegistryPlane * plane )
{
    IORegistryEntry *		next;
    IORegistryIterator * 	iter;
    OSOrderedSet *		all;
    char			format[] = "%xxxs";
    IOService *			service;

    iter = IORegistryIterator::iterateOver( plane );
    assert( iter );
    all = iter->iterateAll();
    if( all) {
        DEBG("Count %d\n", all->getCount() );
        all->release();
    } else
	DEBG("Empty\n");

    iter->reset();
    while( (next = iter->getNextObjectRecursive())) {
	snprintf(format + 1, sizeof(format) - 1, "%ds", 2 * next->getDepth( plane ));
	DEBG( format, "");
	DEBG( "\033[33m%s", next->getName( plane ));
	if( (next->getLocation( plane )))
            DEBG("@%s", next->getLocation( plane ));
	DEBG("\033[0m <class %s", next->getMetaClass()->getClassName());
        if( (service = OSDynamicCast(IOService, next)))
            DEBG(", busy %ld", (long) service->getBusyState());
	DEBG( ">\n");
//	IOSleep(250);
    }
    iter->release();
}
コード例 #3
0
void
OWCDumpIORegistry::dumpIORegistry (void *argument)
{
	IOSleep (DUMP_DELAY_SECONDS * 1000);
		
	IORegistryIterator *iter = IORegistryIterator::iterateOver (gIOServicePlane, kIORegistryIterateRecursively);
	if (iter == NULL) return;
	
	int maxBufferSize = 2048;
	char *buffer = (char *) IOMalloc (maxBufferSize);
	if (buffer == NULL) return;
	
	OSSerialize *s = OSSerialize::withCapacity (maxBufferSize);
	if (s == NULL) return;
	
	IORegistryEntry *object = iter->getCurrentEntry ();
	while (object) {
		s->clearText ();
		
		int busyState = 0;
		IOService *ios = OSDynamicCast (IOService, object);
		if (ios) busyState = ios->getBusyState ();
					
		int pathSize = maxBufferSize;
		object->getPath (buffer, &pathSize, gIOServicePlane);
		kprintf ("\n--> %s <%s> (%d, %d)\n", buffer, object->getMetaClass ()->getClassName (), object->getRetainCount (), busyState);
		
		if (object->serializeProperties (s)) {
			kprintf ("%s\n", s->text ());
		} else {
			kprintf ("serializeProperties failed\n");
		}
		
		object = iter->getNextObject ();
	} 
	
	IOFree (buffer, maxBufferSize);
	s->release ();
	iter->release ();
}