From f8009b4d504de0ed752b867893acd263108409e0 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 24 Jan 2011 21:41:55 -0600 Subject: Reinitialize modules after fork(). --- module/p11-kit-proxy.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'module/p11-kit-proxy.c') diff --git a/module/p11-kit-proxy.c b/module/p11-kit-proxy.c index b02722b..02f8ac3 100644 --- a/module/p11-kit-proxy.c +++ b/module/p11-kit-proxy.c @@ -191,6 +191,24 @@ finalize_mappings_unlocked (void) gl.sessions = NULL; } +void +_p11_kit_proxy_after_fork (void) +{ + /* + * After a fork the callers are supposed to call C_Initialize and all. + * In addition the underlying libraries may change their state so free + * up any mappings and all + */ + + _p11_lock (); + + gl.mappings_refs = 1; + finalize_mappings_unlocked (); + assert (!gl.mappings); + + _p11_unlock (); +} + static CK_RV proxy_C_Finalize (CK_VOID_PTR reserved) { -- cgit v1.2.3