iter->release();
}
+extern "C" kern_return_t kmod_unload_cache(void);
+
static void _OSMetaClassConsiderUnloads(thread_call_param_t p0,
thread_call_param_t p1)
{
while ( (kmodName = (OSSymbol *) kmods->getNextObject()) ) {
if (ki) {
- kfree(ki, sizeof(kmod_info_t));
+ kfree((vm_offset_t) ki, sizeof(kmod_info_t));
ki = 0;
}
} while (didUnload);
mutex_unlock(loadLock);
+
+ kmod_unload_cache();
}
void OSMetaClass::considerUnloads()
OSDictionary * OSMetaClass::getClassDictionary()
{
- return sAllClassesDict;
+ panic("OSMetaClass::getClassDictionary(): Obsoleted\n");
+ return 0;
}
bool OSMetaClass::serialize(OSSerialize *s) const
{
- OSDictionary * dict;
- OSNumber * off;
- bool ok = false;
+ panic("OSMetaClass::serialize(): Obsoleted\n");
+ return false;
+}
+
+void OSMetaClass::serializeClassDictionary(OSDictionary *serializeDictionary)
+{
+ OSDictionary *classDict;
+
+ classDict = OSDictionary::withCapacity(sAllClassesDict->getCount());
+ if (!classDict)
+ return;
- if (s->previouslySerialized(this)) return true;
+ mutex_lock(loadLock);
+ do {
+ OSCollectionIterator *classes;
+ const OSSymbol *className;
- dict = 0;// IODictionary::withCapacity(2);
- off = OSNumber::withNumber(getInstanceCount(), 32);
+ classes = OSCollectionIterator::withCollection(sAllClassesDict);
+ if (!classes)
+ break;
+
+ while ((className = (const OSSymbol *) classes->getNextObject())) {
+ const OSMetaClass *meta;
+ OSNumber *count;
+
+ meta = (OSMetaClass *) sAllClassesDict->getObject(className);
+ count = OSNumber::withNumber(meta->getInstanceCount(), 32);
+ if (count) {
+ classDict->setObject(className, count);
+ count->release();
+ }
+ }
+ classes->release();
- if (dict) {
- dict->setObject("InstanceCount", off );
- ok = dict->serialize(s);
- } else if( off)
- ok = off->serialize(s);
+ serializeDictionary->setObject("Classes", classDict);
+ } while (0);
- if (dict)
- dict->release();
- if (off)
- off->release();
+ mutex_unlock(loadLock);
- return ok;
+ classDict->release();
}
-