added edg_wll_gss_set_signal_handler()
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 12 Apr 2011 11:31:15 +0000 (11:31 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 12 Apr 2011 11:31:15 +0000 (11:31 +0000)
org.glite.lbjp-common.gss/interface/glite_gss.h
org.glite.lbjp-common.gss/src/glite_gss.c

index 37f719f..5a1e3fc 100644 (file)
@@ -181,6 +181,11 @@ edg_wll_gss_unread(edg_wll_GssConnection *connection,
                    void *data,
                    size_t len);
 
+
+int
+edg_wll_gss_set_signal_handler(int signum,
+                              void (*handler_func)(int));
+
 #ifdef __cplusplus
 } 
 #endif
index f77c3c3..db0fdb8 100644 (file)
@@ -1551,3 +1551,31 @@ edg_wll_gss_unread(edg_wll_GssConnection *con, void *data, size_t len)
 
    return 0;
 }
+
+
+int
+edg_wll_gss_set_signal_handler(int signum,
+                              void (*handler_func)(int))
+{
+   int ret;
+
+   ret = globus_module_activate(GLOBUS_COMMON_MODULE);
+   if (ret != GLOBUS_SUCCESS) {
+          struct sigaction     sa,osa;
+          
+          memset(&sa, 0, sizeof(sa));
+          sigemptyset(&sa.sa_mask);
+          sa.sa_handler = handler_func;
+          ret = sigaction(signum, &sa, &osa);
+          return ret;
+   }
+   ret = globus_callback_space_register_signal_handler(signum,
+                                                      GLOBUS_TRUE,
+                                                      (globus_callback_func_t)handler_func,
+                                                      (void *)signum,
+                                                      GLOBUS_CALLBACK_GLOBAL_SPACE);
+
+   globus_module_deactivate(GLOBUS_COMMON_MODULE);
+
+   return ret;
+}