2 #include "globus_xio.h"
5 #include "globus_gfork.h"
7 #define GFORK_CROWDED_MESSAGE "421 Too busy!\r\n"
10 #if !defined(GFORK_I_H)
14 #define GForkFuncName(func) static const char * _gfork_func_name __attribute__((__unused__)) = #func
16 #define GForkFuncName(func) static const char * _gfork_func_name = #func
19 #define GForkErrorErrno(_msg, _errno) \
20 globus_error_put(GForkErrorObjErrno(_msg, _errno))
22 #define GForkErrorObjErrno(_msg, _errno) \
23 globus_error_wrap_errno_error( \
24 GLOBUS_GFORK_CHILD_MODULE, \
26 GLOBUS_GFORK_ERROR_ERRNO, \
30 "System error in %s", \
33 #define GForkErrorStr(_msg) \
34 globus_error_put(GForkErrorObjStr(_msg))
36 #define GForkErrorObjStr(str) \
37 globus_error_construct_error( \
38 GLOBUS_GFORK_CHILD_MODULE, \
40 GLOBUS_GFORK_ERROR_STR, \
47 GlobusDebugDeclare(GLOBUS_GFORK);
49 #define GlobusGForkDebugPrintf(level, message) \
50 GlobusDebugPrintf(GLOBUS_GFORK, level, message)
52 #define GlobusGForkDebugEnter() \
53 GlobusGForkDebugPrintf( \
54 GLOBUS_GFORK_DEBUG_TRACE, \
55 ("[%s] Entering\n", _xio_name))
57 #define GlobusGForkDebugExit() \
58 GlobusGForkDebugPrintf( \
59 GLOBUS_GFORK_DEBUG_TRACE, \
60 ("[%s] Exiting\n", _xio_name))
62 #define GlobusGForkDebugExitWithError() \
63 GlobusGForkDebugPrintf( \
64 GLOBUS_GFORK_DEBUG_TRACE, \
65 ("[%s] Exiting with error\n", _xio_name))
67 #define GlobusGForkDebugState(_old, _new, _event) \
68 GlobusGForkDebugPrintf( \
69 GLOBUS_GFORK_DEBUG_STATE, \
70 ("State Change from %s to %s when %s\n", _old, _new, _event))
74 GLOBUS_GFORK_ERROR_ERRNO = 1,
75 GLOBUS_GFORK_ERROR_STR
78 typedef enum gfork_i_msg_type_e
80 GLOBUS_GFORK_MSG_OPEN =
'O',
81 GLOBUS_GFORK_MSG_CLOSE =
'C',
82 GLOBUS_GFORK_MSG_DATA =
'D'
85 typedef struct gfork_i_msg_header_s
90 gfork_i_msg_type_t type;
91 } gfork_i_msg_header_t;
93 typedef struct gfork_i_msg_data_s
99 typedef struct gfork_i_msg_s
101 gfork_i_msg_header_t header;
102 struct gfork_i_child_handle_s * to_kid;
103 struct gfork_i_child_handle_s * from_kid;
105 globus_xio_iovec_t * iov;
108 globus_xio_iovec_t write_iov[2];
111 gfork_i_msg_data_t * data;
113 struct gfork_i_lib_handle_s * lib_handle;
116 typedef enum gfork_i_state_e
118 GFORK_STATE_NONE = 0,
121 GFORK_STATE_OPENING_AND_CLOSING,
127 typedef enum gfork_i_events_s
129 GFORK_EVENT_NONE = 0,
130 GFORK_EVENT_ACCEPT_CB,
131 GFORK_EVENT_OPEN_RETURNS,
132 GFORK_EVENT_SIGCHILD,
133 GFORK_EVENT_CLOSE_RETURNS,
137 typedef struct gfork_i_options_s
164 typedef struct gfork_i_handle_s
166 globus_xio_stack_t stack;
170 globus_xio_driver_t tcp_driver;
171 globus_xio_server_t server_xio;
172 gfork_i_options_t * opts;
177 typedef struct gfork_i_child_handle_s
182 globus_xio_handle_t write_xio_handle;
183 globus_xio_handle_t read_xio_handle;
184 gfork_i_handle_t * whos_my_daddy;
186 gfork_i_state_t state;
191 } gfork_i_child_handle_t;
193 typedef struct gfork_i_lib_handle_s
195 globus_xio_handle_t read_xio;
196 globus_xio_handle_t write_xio;
197 gfork_i_msg_header_t header;
199 globus_gfork_incoming_cb_t incoming_cb;
200 globus_gfork_open_func_t open_cb;
201 globus_gfork_closed_func_t close_cb;
202 globus_gfork_error_func_t error_cb;
206 gfork_i_state_t state;
209 globus_object_t * error_obj;
210 } gfork_i_lib_handle_t;
212 typedef struct gfork_i_master_program_ent_s
219 } gfork_i_master_program_ent_t;
222 gfork_i_make_xio_handle(
223 globus_xio_handle_t * xio_handle,
227 gfork_i_state_init();
231 gfork_i_state_t current_state,
232 gfork_i_events_t event);
235 globus_i_opts_to_handle(
236 gfork_i_options_t * opts,
237 gfork_i_handle_t * handle);
239 extern globus_xio_stack_t gfork_i_file_stack;
240 extern globus_xio_attr_t gfork_i_file_attr;
241 extern globus_xio_driver_t gfork_i_file_driver;
243 extern globus_options_entry_t gfork_l_opts_table[];
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
struct globus_fifo_s * globus_fifo_t
Definition: globus_fifo.h:48
List data type.
Definition: globus_list.h:44
Header file for XIO TCP Driver.
Mutex.
Definition: globus_thread.h:107
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
void(* globus_xio_iovec_callback_t)(globus_xio_handle_t handle, globus_result_t result, globus_xio_iovec_t *iovec, int count, globus_size_t nbytes, globus_xio_data_descriptor_t data_desc, void *user_arg)
Definition: globus_xio.h:619