static int send_sig(int sig) { pid_t pid = sol_platform_linux_fork_run_get_pid(fork_run); if (pid > 0) { if (kill(pid, sig) == 0) return 0; } return -errno; }
static int fork_run_do(void) { if (fork_run) return 0; fork_run = sol_platform_linux_fork_run(on_fork, on_fork_exit, NULL); if (!fork_run) { sol_platform_linux_micro_inform_service_state (name, SOL_PLATFORM_SERVICE_STATE_FAILED); return -errno; } SOL_DBG("bluetooth-daemon started as pid=%" PRIu64, (uint64_t)sol_platform_linux_fork_run_get_pid(fork_run)); sol_platform_linux_micro_inform_service_state (name, SOL_PLATFORM_SERVICE_STATE_ACTIVE); return 0; }
static int dbus_start(const struct sol_platform_linux_micro_module *mod, const char *service) { if (fork_run) return 0; name = service; fork_run = sol_platform_linux_fork_run(on_fork, on_fork_exit, NULL); if (!fork_run) { sol_platform_linux_micro_inform_service_state(service, SOL_PLATFORM_SERVICE_STATE_FAILED); return -errno; } SOL_DBG("dbus-daemon started as pid=%" PRIu64, (uint64_t)sol_platform_linux_fork_run_get_pid(fork_run)); /* TODO: change to use inotify */ check_timeout = sol_timeout_add(200, on_timeout, NULL); return 0; }