FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Unload a dlopened object and its dependencies from memory and from
 * our data structures.  It is assumed that the DAG rooted in the
 * object has already been unreferenced, and that the object has a
 * reference count of 0.
 */
Unload a dlopened object and its dependencies from memory and from
our data structures.  It is assumed that the DAG rooted in the
object has already been unreferenced, and that the object has a
reference count of 0.
Unload a dlopened object and its dependencies from memory and from our data structures . It is assumed that the DAG rooted in the object has already been unreferenced and that the object has a reference count of 0 .
static void
unload_object(Obj_Entry *root)
{
	Obj_Entry *obj, *obj1;
	assert(root->refcount == 0);
	unlink_object(root);
	TAILQ_FOREACH_SAFE(obj, &obj_list, next, obj1) {
		if (obj->marker || obj->refcount != 0)
			continue;
		LD_UTRACE(UTRACE_UNLOAD_OBJECT, obj, obj->mapbase,
		    obj->mapsize, 0, obj->path);
		dbg("unloading \"%s\"", obj->path);
		unload_filtees(root);
		munmap(obj->mapbase, obj->mapsize);
		linkmap_delete(obj);
		TAILQ_REMOVE(&obj_list, obj, next);
		obj_count--;
		obj_free(obj);
	}
}
static void unload_object ( Obj_Entry * root ) { Obj_Entry * obj , * obj1 ; assert ( root -> refcount == 0 ) ; unlink_object ( root ) ; TAILQ_FOREACH_SAFE ( obj , & obj_list , next , obj1 ) { if ( obj -> marker || obj -> refcount != 0 ) continue ; LD_UTRACE ( UTRACE_UNLOAD_OBJECT , obj , obj -> mapbase , obj -> mapsize , 0 , obj -> path ) ; dbg ( " \" \" " , obj -> path ) ; unload_filtees ( root ) ; munmap ( obj -> mapbase , obj -> mapsize ) ; linkmap_delete ( obj ) ; TAILQ_REMOVE ( & obj_list , obj , next ) ; obj_count -- ; obj_free ( obj ) ; } }
Unload a dlopened object and its dependencies from memory and from
 our data structures.
Unload a dlopened object and its dependencies from memory and from our data structures .
/*
	 * Pass over the DAG removing unreferenced objects from
	 * appropriate lists.
	 */ /* Unmap all objects that are no longer referenced. */