+ int ret;
+ struct exec_task exec_task = {.task = NULL};
+ struct status_task status_task = {.fd = -1};
+ struct input_task input_task = {.task = NULL};
+ struct signal_task *signal_task;
+ struct sched sched = {.default_timeout = {.tv_sec = 1}};
+
+ exec_task.task = task_register(&(struct task_info) {
+ .name = "exec",
+ .pre_select = exec_pre_select,
+ .post_select = exec_post_select,
+ .context = &exec_task,
+ }, &sched);
+
+ status_task.task = task_register(&(struct task_info) {
+ .name = "status",
+ .pre_select = status_pre_select,
+ .post_select = status_post_select,
+ .context = &status_task,
+ }, &sched);
+
+ input_task.task = task_register(&(struct task_info) {
+ .name = "input",
+ .pre_select = input_pre_select,
+ .post_select = input_post_select,
+ .context = &input_task,
+ }, &sched);
+
+ signal_task = signal_init_or_die();
+ para_install_sighandler(SIGINT);
+ para_install_sighandler(SIGTERM);
+ para_install_sighandler(SIGCHLD);
+ para_install_sighandler(SIGUSR1);
+ signal_task->task = task_register(&(struct task_info) {
+ .name = "signal",
+ .pre_select = signal_pre_select,
+ .post_select = signal_post_select,
+ .context = signal_task,
+ }, &sched);
+ ret = schedule(&sched);
+ sched_shutdown(&sched);
+ signal_shutdown(signal_task);
+ return ret;
+}
+
+static void handle_help_flags(void)
+{
+ char *help;
+
+ if (OPT_GIVEN(DETAILED_HELP))
+ help = lls_long_help(CMD_PTR);
+ else if (OPT_GIVEN(HELP))
+ help = lls_short_help(CMD_PTR);
+ else
+ return;
+ printf("%s\n", help);
+ free(help);
+ exit(EXIT_SUCCESS);