From 71d2a32512fb46470ee34c5d72fad13176cf30f4 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Mon, 22 Jun 2009 18:18:15 +0000 Subject: [PATCH] Add dump_state to coroapi.h. Need to remove logging output from signal handlers. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2281 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/apidef.c | 3 ++- exec/main.c | 11 ++++++++++- exec/main.h | 2 ++ include/corosync/engine/coroapi.h | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/exec/apidef.c b/exec/apidef.c index 5746b484..656a6988 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -140,7 +140,8 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = { .plugin_interface_release = lcr_ifact_release, .error_memory_failure = _corosync_out_of_memory_error, .fatal_error = _corosync_public_exit_error, - .request_shutdown = corosync_request_shutdown + .request_shutdown = corosync_request_shutdown, + .state_dump = corosync_state_dump }; void apidef_init (struct objdb_iface_ver0 *objdb) { diff --git a/exec/main.c b/exec/main.c index 65116b6a..cfdf8129 100644 --- a/exec/main.c +++ b/exec/main.c @@ -124,7 +124,7 @@ hdb_handle_t corosync_poll_handle; struct sched_param global_sched_param; -static void sigusr2_handler (int num) +void corosync_state_dump (void) { int i; @@ -135,6 +135,15 @@ static void sigusr2_handler (int num) } } +static void sigusr2_handler (int num) +{ + /* + * TODO remove this from sigusr2 handler and access via cfg service + * engine api - corosync-cfgtool + */ + corosync_state_dump (); +} + /* * TODO this function needs some love */ diff --git a/exec/main.h b/exec/main.h index bc76dc87..a26c064f 100644 --- a/exec/main.h +++ b/exec/main.h @@ -66,4 +66,6 @@ extern int message_source_is_local (const mar_message_source_t *source); extern void corosync_request_shutdown (void); +extern void corosync_state_dump (void); + #endif /* MAIN_H_DEFINED */ diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index bee174a0..f3a1c983 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -576,6 +576,8 @@ struct corosync_api_v1 { void (*fatal_error) (cs_fatal_error_t err, const char *file, unsigned int line); void (*request_shutdown) (void); + + void (*state_dump) (void); }; #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )