]> granicus.if.org Git - p11-kit/commitdiff
Better debug output for initialization and loading modules.
authorStef Walter <stefw@collabora.co.uk>
Wed, 3 Aug 2011 06:16:32 +0000 (08:16 +0200)
committerStef Walter <stefw@collabora.co.uk>
Wed, 3 Aug 2011 06:16:32 +0000 (08:16 +0200)
p11-kit/modules.c

index 0185450ee3329bf45449de30355a0c80f3f976c0..f068510637a980b4369652d8300e29d97b5186de 100644 (file)
@@ -104,7 +104,6 @@ typedef struct _Module {
 
        /* Loaded modules */
        void *dl_module;
-       int dlopen_count;
 
        /* Initialized modules */
        CK_C_INITIALIZE_ARGS init_args;
@@ -260,8 +259,6 @@ dlopen_and_get_function_list (Module *mod, const char *path)
                return CKR_GENERAL_ERROR;
        }
 
-       mod->dlopen_count++;
-
        gfl = dlsym (mod->dl_module, "C_GetFunctionList");
        if (!gfl) {
                _p11_message ("couldn't find C_GetFunctionList entry point in module: %s: %s",
@@ -276,6 +273,7 @@ dlopen_and_get_function_list (Module *mod, const char *path)
                return rv;
        }
 
+       debug ("opened module: %s", path);
        return CKR_OK;
 }
 
@@ -300,6 +298,7 @@ load_module_from_file_unlocked (const char *path, Module **result)
        prev = hash_get (gl.modules, mod->funcs);
 
        if (prev != NULL) {
+               debug ("duplicate module %s, using previous", path);
                free_module_unlocked (mod);
                mod = prev;
 
@@ -454,6 +453,8 @@ initialize_module_unlocked_reentrant (Module *mod)
 
        if (!mod->initialize_count) {
 
+               debug ("C_Initialize: calling");
+
                _p11_unlock ();
 
                        assert (mod->funcs);
@@ -461,6 +462,8 @@ initialize_module_unlocked_reentrant (Module *mod)
 
                _p11_lock ();
 
+               debug ("C_Initialize: result: %lu", rv);
+
                /*
                 * Because we have the mutex unlocked above, two initializes could
                 * race. Therefore we need to take CKR_CRYPTOKI_ALREADY_INITIALIZED
@@ -1086,7 +1089,7 @@ p11_kit_load_initialize_module (const char *module_path,
        CK_RV rv = CKR_OK;
 
        /* WARNING: This function must be reentrant for the same arguments */
-       debug ("in");
+       debug ("in: %s", module_path);
 
        _p11_lock ();