3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

t-runner: Remove the IWD service watchers

This commit is contained in:
Tim Kourt 2016-05-04 16:14:38 -07:00 committed by Denis Kenzior
parent 1365da5fdb
commit 962653c0d6

View File

@ -941,62 +941,19 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings,
return true; return true;
} }
static void iwd_appeared(struct l_dbus *dbus, void *user_data)
{
l_info("IWD service has appeared\n");
l_main_quit();
}
static void iwd_disappeared(struct l_dbus *dbus, void *user_data)
{
l_info("IWD service has disappeared\n");
l_main_quit();
}
static pid_t start_iwd(void) static pid_t start_iwd(void)
{ {
char *argv[2]; char *argv[2];
pid_t pid;
uint32_t watch_id;
argv[0] = "/usr/bin/iwd"; argv[0] = "/usr/bin/iwd";
argv[1] = NULL; argv[1] = NULL;
pid = fork(); return execute_program(argv, false);
if (pid < 0) {
perror("Failed to fork new process");
return -1;
}
if (pid == 0) {
set_output_visibility();
execv(argv[0], argv);
exit(EXIT_FAILURE);
}
watch_id = l_dbus_add_service_watch(g_dbus, "net.connman.iwd",
iwd_appeared, NULL,
NULL, NULL);
l_main_run();
l_dbus_remove_watch(g_dbus, watch_id);
return pid;
} }
static void terminate_iwd(pid_t iwd_pid) static void terminate_iwd(pid_t iwd_pid)
{ {
uint32_t watch_id;
watch_id = l_dbus_add_service_watch(g_dbus, "net.connman.iwd", NULL,
iwd_disappeared, NULL, NULL);
kill_process(iwd_pid); kill_process(iwd_pid);
l_main_run();
l_dbus_remove_watch(g_dbus, watch_id);
} }
#define CONSOLE_LN_DEFAULT "\x1B[0m" #define CONSOLE_LN_DEFAULT "\x1B[0m"