2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
27 #include "slave_life.h"
28 #include "client_life.h"
30 #include "fault_manager.h"
36 static int evt_cb(int handle, void *data)
38 struct slave_node *slave;
39 struct client_node *client;
40 struct liveinfo *liveinfo;
42 slave = slave_find_by_rpc_handle(handle);
44 if (slave_pid(slave) != (pid_t)-1) {
45 if (slave_state(slave) == SLAVE_REQUEST_TO_TERMINATE)
46 slave = slave_deactivated(slave);
47 else if (slave_state(slave) != SLAVE_TERMINATED)
48 slave = slave_deactivated_by_fault(slave);
51 DbgPrint("Slave pointer: %p (0 means deleted)\n", slave);
55 client = client_find_by_rpc_handle(handle);
57 if (client_pid(client) != (pid_t)-1)
58 client = client_deactivated_by_fault(client);
60 DbgPrint("Client pointer: %p (0 means deleted)\n", client);
64 liveinfo = liveinfo_find_by_handle(handle);
66 liveinfo_destroy(liveinfo);
73 HAPI int dead_init(void)
75 com_core_add_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
79 HAPI int dead_fini(void)
81 com_core_del_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);