Lines Matching refs:state

216 static void _destroy_service(struct tipc_srv_state* state) {  in _destroy_service()  argument
217 if (!state) { in _destroy_service()
223 if (state->priv) { in _destroy_service()
224 free(state->priv); in _destroy_service()
225 state->priv = NULL; in _destroy_service()
229 if (state->port != INVALID_IPC_HANDLE) { in _destroy_service()
230 int rc = close(state->port); in _destroy_service()
232 TLOGI("Failed (%d) to close port %d\n", rc, state->port); in _destroy_service()
234 state->port = INVALID_IPC_HANDLE; in _destroy_service()
238 state->service = NULL; in _destroy_service()
239 state->handler.proc = NULL; in _destroy_service()
240 state->handler.priv = NULL; in _destroy_service()
247 struct tipc_srv_state* state) { in _create_service() argument
248 if (!srv || !state) { in _create_service()
262 state->port = (handle_t)rc; in _create_service()
263 state->handler.proc = srv->port_handler; in _create_service()
264 state->handler.priv = state; in _create_service()
265 state->service = srv; in _create_service()
266 state->priv = NULL; in _create_service()
270 state->priv = calloc(1, srv->port_state_size); in _create_service()
271 if (!state->priv) { in _create_service()
278 rc = set_cookie(state->port, &state->handler); in _create_service()
280 TLOGI("Failed (%d) to set cookie on port %d\n", rc, state->port); in _create_service()
288 _destroy_service(state); in _create_service()
295 static int restart_service(struct tipc_srv_state* state) { in restart_service() argument
296 if (!state) { in restart_service()
301 const struct tipc_srv* srv = state->service; in restart_service()
302 _destroy_service(state); in restart_service()
303 return _create_service(srv, state); in restart_service()