Exemple #1
0
static void _unload_lib ( void * libhandle )
{
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
  dllfree( (dllhandle*) libhandle );
#else
  dlclose ( libhandle );
#endif
}
Exemple #2
0
/*!
  The function tries to load "lib<id>.so" looking for an entry point
  "<id>_InitCommLayer". The latter one is called to obtain a provider_comm
  structure including the function pointer table for MI calls towards
  remote providers.

  \param id the name of the comm-layer for which the library has to be loaded.
  \param broker broker handle as passed to the init function.
  \param ctx context as passed to the init function.

  \return pointer to the provider_comm structure from the comm-layer, or NULL.
 */
static provider_comm * load_comm_library ( const char * id,
					   CONST CMPIBroker * broker,
					   CONST CMPIContext * ctx )
{
	void * hLibrary;
    CMPIStatus rc = {CMPI_RC_OK, NULL};

	TRACE_VERBOSE(("entered function."));
	TRACE_NORMAL(("loading comm-layer library: lib%s.so", id));

	hLibrary = _load_lib ( id );

	if ( hLibrary != NULL ) {
		char function[255];
		INIT_COMM_LAYER fp;
		sprintf ( function, "%s_InitCommLayer", id );
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
		fp = (INIT_COMM_LAYER) dllqueryfn ( (dllhandle *) hLibrary, function );
#else
		fp = (INIT_COMM_LAYER) dlsym ( hLibrary, function );
#endif

		if ( fp != NULL ) {
			provider_comm * result = fp ( broker, ctx );
			result->id = strdup ( id );
			result->handle = hLibrary;

			TRACE_INFO(("comm-layer successfully initialized."));
			TRACE_VERBOSE(("leaving function."));
			return result;
		}
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
		dllfree ( (dllhandle*) hLibrary );
#else
		dlclose ( hLibrary );
#endif
	}
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
	error_at_line ( 0, errno, __FILE__, __LINE__,
			"Unable to load/init communication-layer library.");
#else
	error_at_line ( 0, 0, __FILE__, __LINE__,
			"Unable to load/init communication-layer library: %s",
			dlerror () );
#endif
	TRACE_VERBOSE(("leaving function."));
	return NULL;
}
Exemple #3
0
static apr_status_t dso_cleanup(void *thedso)
{
    apr_dso_handle_t *dso = thedso;
    int rc;

    if (dso->handle == 0)
        return APR_SUCCESS;
       
    rc = dllfree(dso->handle);

    if (rc == 0) {
        dso->handle = 0;
        return APR_SUCCESS;
    }
    dso->failing_errno = errno;
    return errno;
}
Exemple #4
0
void __wrap_free( void* pPtr )
{
  dllfree(pPtr);
}