1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
#if !defined(GLOBUS_GFORK_H)
#define GLOBUS_GFORK_H 1
#include "globus_common.h"
#include "globus_xio.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
#define GlobusGForkFuncName(func) static const char * _gfork_func_name __attribute__((__unused__)) = #func
#else
#define GlobusGForkFuncName(func) static const char * _gfork_func_name = #func
#endif
#define GFORK_CHILD_READ_ENV "GFORK_CHILD_READ_ENV"
#define GFORK_CHILD_WRITE_ENV "GFORK_CHILD_WRITE_ENV"
#define GFORK_CHILD_CS_ENV "GFORK_CHILD_CS_ENV"
#define GFORK_CHILD_INSTANCE_ENV "GFORK_CHILD_INSTANCE_ENV"
typedef void * gfork_child_handle_t;
typedef enum
{
GLOBUS_GFORK_DEBUG_ERROR = 1,
GLOBUS_GFORK_DEBUG_WARNING = 2,
GLOBUS_GFORK_DEBUG_TRACE = 4,
GLOBUS_GFORK_DEBUG_INTERNAL_TRACE = 8,
GLOBUS_GFORK_DEBUG_INFO = 16,
GLOBUS_GFORK_DEBUG_STATE = 32,
GLOBUS_GFORK_DEBUG_INFO_VERBOSE = 64
} globus_gfork_debug_levels_t;
/*
* server plug in functions
*/
/* when a connection is accepted */
typedef void
(*globus_gfork_open_func_t)(
gfork_child_handle_t handle,
void * user_arg,
pid_t from_pid);
/* connection cloesd */
typedef void
(*globus_gfork_closed_func_t)(
gfork_child_handle_t handle,
void * user_arg,
pid_t from_pid);
typedef void
(*globus_gfork_error_func_t)(
gfork_child_handle_t handle,
void * user_arg,
globus_result_t result);
typedef void
(*globus_gfork_incoming_cb_t)(
gfork_child_handle_t handle,
void * user_arg,
pid_t from_pid,
globus_byte_t * buffer,
globus_size_t len);
/*
* client functions
*/
globus_result_t
globus_gfork_child_worker_start(
gfork_child_handle_t * out_handle,
const char * in_env_suffix,
globus_gfork_closed_func_t close_cb,
globus_gfork_incoming_cb_t incoming_cb,
globus_gfork_error_func_t error_cb,
void * user_arg);
globus_result_t
globus_gfork_child_master_start(
gfork_child_handle_t * out_handle,
const char * in_env_suffix,
globus_gfork_open_func_t open_cb,
globus_gfork_closed_func_t close_cb,
globus_gfork_incoming_cb_t incoming_cb,
globus_gfork_error_func_t error_cb,
void * user_arg);
globus_result_t
globus_gfork_broadcast(
gfork_child_handle_t handle,
globus_xio_iovec_t * iov,
int iovc,
globus_xio_iovec_callback_t cb,
void * user_arg);
globus_result_t
globus_gfork_send(
gfork_child_handle_t handle,
uid_t pid,
globus_xio_iovec_t * iov,
int iovc,
globus_xio_iovec_callback_t cb,
void * user_arg);
globus_result_t
globus_gfork_child_stop(
gfork_child_handle_t in_handle);
extern globus_module_descriptor_t globus_i_gfork_parent_module;
#define GLOBUS_GFORK_PARENT_MODULE (&globus_i_gfork_parent_module)
extern globus_module_descriptor_t globus_i_gfork_child_module;
#define GLOBUS_GFORK_CHILD_MODULE (&globus_i_gfork_child_module)
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_GFORK_H */
|