diff --git a/include/corosync/quorum.h b/include/corosync/quorum.h index 291a69c6..2ca07ce5 100644 --- a/include/corosync/quorum.h +++ b/include/corosync/quorum.h @@ -70,6 +70,14 @@ cs_error_t quorum_finalize ( quorum_handle_t handle); +/* + * Get a file descriptor on which to poll. quorum_handle_t is NOT a + * file descriptor and may not be used directly. + */ +cs_error_t quorum_fd_get ( + quorum_handle_t handle, + int *fd); + /* * Dispatch messages and configuration changes */ diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h index 7c758ccc..b6807ae8 100644 --- a/include/corosync/votequorum.h +++ b/include/corosync/votequorum.h @@ -110,6 +110,13 @@ cs_error_t votequorum_dispatch ( votequorum_handle_t handle, cs_dispatch_flags_t dispatch_types); +/* + * Get a file descriptor on which to poll. votequorum_handle_t is NOT a + * file descriptor and may not be used directly. + */ +cs_error_t votequorum_fd_get ( + votequorum_handle_t handle, + int *fd); /* * Get quorum information. diff --git a/lib/votequorum.c b/lib/votequorum.c index c4408cec..a4ad461e 100644 --- a/lib/votequorum.c +++ b/lib/votequorum.c @@ -670,6 +670,26 @@ cs_error_t votequorum_context_set ( } +cs_error_t votequorum_fd_get ( + votequorum_handle_t handle, + int *fd) +{ + cs_error_t error; + struct votequorum_inst *votequorum_inst; + + error = saHandleInstanceGet (&votequorum_handle_t_db, handle, (void *)&votequorum_inst); + if (error != CS_OK) { + return (error); + } + + *fd = votequorum_inst->dispatch_fd; + + (void)saHandleInstancePut (&votequorum_handle_t_db, handle); + + return (CS_OK); +} + + struct res_overlay { mar_res_header_t header __attribute__((aligned(8))); char data[512000];