当前位置: 首页>>代码示例>>C++>>正文


C++ DSOerr函数代码示例

本文整理汇总了C++中DSOerr函数的典型用法代码示例。如果您正苦于以下问题:C++ DSOerr函数的具体用法?C++ DSOerr怎么用?C++ DSOerr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DSOerr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dlfcn_load

static int dlfcn_load(DSO *dso)
	{
	void *ptr = NULL;
	/* See applicable comments in dso_dl.c */
	char *filename = DSO_convert_filename(dso, NULL);
	int flags = DLOPEN_FLAG;

	if(filename == NULL)
		{
		DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME);
		goto err;
		}

#ifdef RTLD_GLOBAL
	if (dso->flags & DSO_FLAG_GLOBAL_SYMBOLS)
		flags |= RTLD_GLOBAL;
#endif
	ptr = dlopen(filename, flags);
	if(ptr == NULL)
		{
		DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED);
		ERR_add_error_data(4, "filename(", filename, "): ", dlerror());
		goto err;
		}
	if(!sk_void_push(dso->meth_data, (char *)ptr))
		{
		DSOerr(DSO_F_DLFCN_LOAD,DSO_R_STACK_ERROR);
		goto err;
		}
	/* Success */
	dso->loaded_filename = filename;
	return(1);
err:
	/* Cleanup! */
	if(filename != NULL)
		OPENSSL_free(filename);
	if(ptr != NULL)
		dlclose(ptr);
	return(0);
}
开发者ID:Cpasjuste,项目名称:platform_external_openssl,代码行数:40,代码来源:dso_dlfcn.c

示例2: dl_load

static int dl_load(DSO *dso)
{
    shl_t ptr = NULL;
    /*
     * We don't do any fancy retries or anything, just take the method's (or
     * DSO's if it has the callback set) best translation of the
     * platform-independant filename and try once with that.
     */
    char *filename = DSO_convert_filename(dso, NULL);

    if (filename == NULL) {
        DSOerr(DSO_F_DL_LOAD, DSO_R_NO_FILENAME);
        goto err;
    }
    ptr = shl_load(filename, BIND_IMMEDIATE |
                   (dso->flags & DSO_FLAG_NO_NAME_TRANSLATION ? 0 :
                    DYNAMIC_PATH), 0L);
    if (ptr == NULL) {
        DSOerr(DSO_F_DL_LOAD, DSO_R_LOAD_FAILED);
        ERR_add_error_data(4, "filename(", filename, "): ", strerror(errno));
        goto err;
    }
    if (!sk_push(dso->meth_data, (char *)ptr)) {
        DSOerr(DSO_F_DL_LOAD, DSO_R_STACK_ERROR);
        goto err;
    }
    /*
     * Success, stick the converted filename we've loaded under into the DSO
     * (it also serves as the indicator that we are currently loaded).
     */
    dso->loaded_filename = filename;
    return (1);
 err:
    /* Cleanup! */
    if (filename != NULL)
        OPENSSL_free(filename);
    if (ptr != NULL)
        shl_unload(ptr);
    return (0);
}
开发者ID:03050903,项目名称:godot,代码行数:40,代码来源:dso_dl.c

示例3: DSO_set_filename

int DSO_set_filename(DSO *dso, const char *filename)
{
    char *copied;

    if ((dso == NULL) || (filename == NULL)) {
        DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER);
        return (0);
    }
    if (dso->loaded_filename) {
        DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED);
        return (0);
    }
    /* We'll duplicate filename */
    copied = strdup(filename);
    if (copied == NULL) {
        DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE);
        return (0);
    }
    free(dso->filename);
    dso->filename = copied;
    return (1);
}
开发者ID:vigortls,项目名称:vigortls,代码行数:22,代码来源:dso_lib.c

示例4: win32_load

static int win32_load(DSO *dso)
{
    HINSTANCE h = NULL, *p = NULL;
    /* See applicable comments from dso_dl.c */
    char *filename = DSO_convert_filename(dso, NULL);

    if (filename == NULL) {
        DSOerr(DSO_F_WIN32_LOAD, DSO_R_NO_FILENAME);
        goto err;
    }
    h = LoadLibraryA(filename);
    if (h == NULL) {
        DSOerr(DSO_F_WIN32_LOAD, DSO_R_LOAD_FAILED);
        ERR_add_error_data(3, "filename(", filename, ")");
        goto err;
    }
    p = (HINSTANCE *) OPENSSL_malloc(sizeof(HINSTANCE));
    if (p == NULL) {
        DSOerr(DSO_F_WIN32_LOAD, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    *p = h;
    if (!sk_void_push(dso->meth_data, p)) {
        DSOerr(DSO_F_WIN32_LOAD, DSO_R_STACK_ERROR);
        goto err;
    }
    /* Success */
    dso->loaded_filename = filename;
    return (1);
 err:
    /* Cleanup ! */
    if (filename != NULL)
        OPENSSL_free(filename);
    if (p != NULL)
        OPENSSL_free(p);
    if (h != NULL)
        FreeLibrary(h);
    return (0);
}
开发者ID:Adallom,项目名称:openssl,代码行数:39,代码来源:dso_win32.c

示例5: dlfcn_unload

static int
dlfcn_unload(DSO *dso)
{
	void *ptr;
	if (dso == NULL) {
		DSOerr(DSO_F_DLFCN_UNLOAD, ERR_R_PASSED_NULL_PARAMETER);
		return (0);
	}
	if (sk_void_num(dso->meth_data) < 1)
		return (1);
	ptr = sk_void_pop(dso->meth_data);
	if (ptr == NULL) {
		DSOerr(DSO_F_DLFCN_UNLOAD, DSO_R_NULL_HANDLE);
		/* Should push the value back onto the stack in
		 * case of a retry. */
		sk_void_push(dso->meth_data, ptr);
		return (0);
	}
	/* For now I'm not aware of any errors associated with dlclose() */
	dlclose(ptr);
	return (1);
}
开发者ID:Basskrapfen,项目名称:openbsd,代码行数:22,代码来源:dso_dlfcn.c

示例6: DSOerr

void *DSO_bind_var(DSO *dso, const char *symname)
	{
	void *ret = NULL;

	if((dso == NULL) || (symname == NULL))
		{
		DSOerr(DSO_F_DSO_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
		return(NULL);
		}
	if(dso->meth->dso_bind_var == NULL)
		{
		DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_UNSUPPORTED);
		return(NULL);
		}
	if((ret = dso->meth->dso_bind_var(dso, symname)) == NULL)
		{
		DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_SYM_FAILURE);
		return(NULL);
		}
	/* Success */
	return(ret);
	}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:22,代码来源:dso_lib.c

示例7: DSO_bind_func

DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname)
	{
	DSO_FUNC_TYPE ret = NULL;

	if((dso == NULL) || (symname == NULL))
		{
		DSOerr(DSO_F_DSO_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
		return(NULL);
		}
	if(dso->meth->dso_bind_func == NULL)
		{
		DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_UNSUPPORTED);
		return(NULL);
		}
	if((ret = dso->meth->dso_bind_func(dso, symname)) == NULL)
		{
		DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_SYM_FAILURE);
		return(NULL);
		}
	/* Success */
	return(ret);
	}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:22,代码来源:dso_lib.c

示例8: DSO_set_name_converter

int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
                           DSO_NAME_CONVERTER_FUNC *oldcb)
{
    if (dso == NULL) {
        DSOerr(DSO_F_DSO_SET_NAME_CONVERTER,
               ERR_R_PASSED_NULL_PARAMETER);
        return (0);
    }
    if (oldcb)
        *oldcb = dso->name_converter;
    dso->name_converter = cb;
    return (1);
}
开发者ID:vigortls,项目名称:vigortls,代码行数:13,代码来源:dso_lib.c

示例9: dl_unload

static int dl_unload(DSO *dso)
{
    shl_t ptr;
    if (dso == NULL) {
        DSOerr(DSO_F_DL_UNLOAD, ERR_R_PASSED_NULL_PARAMETER);
        return (0);
    }
    if (sk_num(dso->meth_data) < 1)
        return (1);
    /* Is this statement legal? */
    ptr = (shl_t) sk_pop(dso->meth_data);
    if (ptr == NULL) {
        DSOerr(DSO_F_DL_UNLOAD, DSO_R_NULL_HANDLE);
        /*
         * Should push the value back onto the stack in case of a retry.
         */
        sk_push(dso->meth_data, (char *)ptr);
        return (0);
    }
    shl_unload(ptr);
    return (1);
}
开发者ID:1564143452,项目名称:kbengine,代码行数:22,代码来源:dso_dl.c

示例10: DSO_new_method

DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
{
    DSO *ret;
    int allocated = 0;

    if (dso == NULL) {
        ret = DSO_new_method(meth);
        if (ret == NULL) {
            DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);
            goto err;
        }
        allocated = 1;
        /* Pass the provided flags to the new DSO object */
        if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
            DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
            goto err;
        }
    } else
        ret = dso;
    /* Don't load if we're currently already loaded */
    if (ret->filename != NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED);
        goto err;
    }
    /*
     * filename can only be NULL if we were passed a dso that already has one
     * set.
     */
    if (filename != NULL)
        if (!DSO_set_filename(ret, filename)) {
            DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
            goto err;
        }
    filename = ret->filename;
    if (filename == NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
        goto err;
    }
    if (ret->meth->dso_load == NULL) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
        goto err;
    }
    if (!ret->meth->dso_load(ret)) {
        DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
        goto err;
    }
    /* Load succeeded */
    return (ret);
 err:
    if (allocated)
        DSO_free(ret);
    return (NULL);
}
开发者ID:benlaurie,项目名称:openssl-old-2,代码行数:53,代码来源:dso_lib.c

示例11: dl_ctrl

static long dl_ctrl(DSO *dso, int cmd, long larg, void *parg)
	{
	if(dso == NULL)
		{
		DSOerr(DSO_F_DL_CTRL,ERR_R_PASSED_NULL_PARAMETER);
		return(-1);
		}
	switch(cmd)
		{
	case DSO_CTRL_GET_FLAGS:
		return dso->flags;
	case DSO_CTRL_SET_FLAGS:
		dso->flags = larg;
		return(0);
	case DSO_CTRL_OR_FLAGS:
		dso->flags |= larg;
		return(0);
	default:
		break;
		}
	DSOerr(DSO_F_DL_CTRL,DSO_R_UNKNOWN_COMMAND);
	return(-1);
	}
开发者ID:aosm,项目名称:OpenSSL096,代码行数:23,代码来源:dso_dl.c

示例12: DSO_up_ref

int DSO_up_ref(DSO *dso)
{
    int i;

    if (dso == NULL) {
        DSOerr(DSO_F_DSO_UP_REF, ERR_R_PASSED_NULL_PARAMETER);
        return 0;
    }

    if (CRYPTO_atomic_add(&dso->references, 1, &i, dso->lock) <= 0)
        return 0;

    return ((i > 1) ? 1 : 0);
}
开发者ID:vigortls,项目名称:vigortls,代码行数:14,代码来源:dso_lib.c

示例13: strlen

static char *dlfcn_name_converter(DSO *dso, const char *filename)
	{
	char *translated;
	int len, rsize, transform;

	len = strlen(filename);
	rsize = len + 1;
	transform = (strstr(filename, "/") == NULL);
	if(transform)
		{
#ifndef SYMBIAN		
		/* We will convert this to "%s.so" or "lib%s.so" */
		rsize += 3;	/* The length of ".so" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
#else
	/* We will convert this to "%s.dll" or "lib%s.dll" */
		rsize += 4;	/* The length of ".dll" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
#endif			
		}
	translated = OPENSSL_malloc(rsize);
	if(translated == NULL)
		{
		DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
				DSO_R_NAME_TRANSLATION_FAILED);
		return(NULL);
		}
	if(transform)
		{
#ifndef SYMBIAN		
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			sprintf(translated, "lib%s.so", filename);
		else
			sprintf(translated, "%s.so", filename);
#else
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			sprintf(translated, "lib%s.dll", filename);
		else
			sprintf(translated, "%s.dll", filename);

#endif		
		
		}
	else
		sprintf(translated, "%s", filename);
	return(translated);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:49,代码来源:dso_dlfcn.c

示例14: DSO_free

int DSO_free(DSO *dso)
{
    int i;

    if (dso == NULL)
        return (1);

    i = CRYPTO_add(&dso->references, -1, CRYPTO_LOCK_DSO);
#ifdef REF_PRINT
    REF_PRINT("DSO", dso);
#endif
    if (i > 0)
        return (1);
#ifdef REF_CHECK
    if (i < 0) {
        fprintf(stderr, "DSO_free, bad reference count\n");
        abort();
    }
#endif

    if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) {
        DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED);
        return (0);
    }

    if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) {
        DSOerr(DSO_F_DSO_FREE, DSO_R_FINISH_FAILED);
        return (0);
    }

    sk_void_free(dso->meth_data);
    OPENSSL_free(dso->filename);
    OPENSSL_free(dso->loaded_filename);
    OPENSSL_free(dso);
    return (1);
}
开发者ID:benlaurie,项目名称:openssl-old-2,代码行数:36,代码来源:dso_lib.c

示例15: DSO_METHOD_openssl

DSO *DSO_new_method(DSO_METHOD *meth)
	{
	DSO *ret;

	if(default_DSO_meth == NULL)
		/* We default to DSO_METH_openssl() which in turn defaults
		 * to stealing the "best available" method. Will fallback
		 * to DSO_METH_null() in the worst case. */
		default_DSO_meth = DSO_METHOD_openssl();
	ret = (DSO *)OPENSSL_malloc(sizeof(DSO));
	if(ret == NULL)
		{
		DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
		return(NULL);
		}
	memset(ret, 0, sizeof(DSO));
	ret->meth_data = sk_void_new_null();
	if(ret->meth_data == NULL)
		{
		/* sk_new doesn't generate any errors so we do */
		DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
		OPENSSL_free(ret);
		return(NULL);
		}
	if(meth == NULL)
		ret->meth = default_DSO_meth;
	else
		ret->meth = meth;
	ret->references = 1;
	if((ret->meth->init != NULL) && !ret->meth->init(ret))
		{
		OPENSSL_free(ret);
		ret=NULL;
		}
	return(ret);
	}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:36,代码来源:dso_lib.c


注:本文中的DSOerr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。