예제 #1
0
static bool
check_and_mark_native_exec(module_area_t *ma, bool add)
{
    bool is_native = false;
    const char *name = GET_MODULE_NAME(&ma->names);
    ASSERT(os_get_module_info_locked());
    if (DYNAMO_OPTION(native_exec) && name != NULL &&
        on_native_exec_list(name)) {
        LOG(GLOBAL, LOG_INTERP|LOG_VMAREAS, 1,
            "module %s is on native_exec list\n", name);
        is_native = true;
    }

    if (add && is_native) {
        RSTATS_INC(num_native_module_loads);
        vmvector_add(native_exec_areas, ma->start, ma->end, NULL);
    } else if (!add) {
        /* If we're removing and it's native, it should be on there already.  If
         * it's not native, then it shouldn't be present, but we'll remove
         * whatever is there.
         */
        DEBUG_DECLARE(bool present =)
            vmvector_remove(native_exec_areas, ma->start, ma->end);
        ASSERT_CURIOSITY((is_native && present) || (!is_native && !present));
    }
예제 #2
0
ret_state _bridge_modloader_remove(const void * entity) {
#define NULL_END(val) if (val == nullptr) return ES_NORMAL;
    NULL_END(entity);
    const char * mod_name = GET_MODULE_NAME(entity);
    CALL_MODULE_FINALIZER(entity);
    entities->clear(mod_name);
    std::string * dylib_path = (std::string *) dylibpaths->get(mod_name);
    NULL_END(dylib_path);
    void * dylib = dylibs->get(*dylib_path);
    NULL_END(dylib);
    dlclose(dylib);
    return ES_NORMAL;
#undef NULL_END
}