Lines Matching defs:rd

65 del_run_data(run_data *rd)
67 if (rd == NULL)
70 del_run_request(rd->r);
71 if (rd->msg)
72 dbus_message_unref(rd->msg);
74 g_spawn_close_pid(rd->pid);
76 if (rd->stderr_v >= 0)
77 close(rd->stderr_v);
79 if (rd->timeout != 0)
80 g_source_remove(rd->timeout);
82 g_free(rd);
131 remove_from_hash_table(run_data *rd)
136 list = (GList *)g_hash_table_lookup(udi_hash, rd->r->udi);
137 list = g_list_remove(list, rd);
139 g_hash_table_insert(udi_hash, g_strdup(rd->r->udi), list);
145 run_data *rd = (run_data *)data;
148 printf("%s exited\n", rd->r->argv[0]);
149 rd->watch = 0;
150 if (rd->sent_kill == TRUE) {
152 del_run_data(rd);
158 send_reply(rd->con, rd->msg, HALD_RUN_FAILED, 0, NULL);
162 if (rd->stderr_v >= 0) {
164 error = get_string_array_from_fd(rd->stderr_v);
165 close(rd->stderr_v);
166 rd->stderr_v = -1;
168 if (rd->msg != NULL)
169 send_reply(rd->con, rd->msg, HALD_RUN_SUCCESS, WEXITSTATUS(status), error);
173 remove_from_hash_table(rd);
176 if(rd->con != NULL && rd->emit_pid_exited) {
182 pid64 = rd->pid;
186 dbus_connection_send(rd->con, signal, NULL);
189 del_run_data(rd);
194 run_data *rd = (run_data *)data;
198 kill(rd->pid, SIGTERM);
200 rd->timeout = 0;
202 rd->sent_kill = TRUE;
204 send_reply(rd->con, rd->msg, HALD_RUN_TIMEOUT, 0, NULL);
205 remove_from_hash_table(rd);
244 run_data *rd = NULL;
284 rd = g_new0(run_data,1);
285 g_assert(rd != NULL);
286 rd->r = r;
287 rd->msg = msg;
291 rd->con = con;
292 rd->pid = pid;
293 rd->stderr_v = stderr_v;
294 rd->sent_kill = FALSE;
297 rd->watch = g_child_watch_add(pid, run_exited, rd);
301 rd->timeout = g_timeout_add(r->timeout, run_timedout, rd);
303 rd->timeout = 0;
307 list = g_list_prepend(list, rd);
315 rd->emit_pid_exited = TRUE;
323 run_data *rd = (run_data *)data;
325 kill(rd->pid, SIGTERM);
326 printf("Sent kill to %d\n", rd->pid);
327 if (rd->timeout != 0) {
329 g_source_remove(rd->timeout);
330 rd->timeout = 0;
334 rd->sent_kill = TRUE;
336 if (rd->msg != NULL)
337 send_reply(rd->con, rd->msg, HALD_RUN_KILLED, 0, NULL);