summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-08-13 13:03:53 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-08-19 13:27:59 +0800
commit51c6aaf7864eb65779d548ee2549caa357f71e2c (patch)
treec68d7b272c40a152c6ec65b2a1af70d6bbad2b13 /ui
parent823958fbbd17ab2c1b2a1779eb10351ca0a668c6 (diff)
downloadtalos-petitboot-51c6aaf7864eb65779d548ee2549caa357f71e2c.tar.gz
talos-petitboot-51c6aaf7864eb65779d548ee2549caa357f71e2c.zip
lib/process: replace pb_run_cmd
This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/common/ui-system.c26
-rw-r--r--ui/common/ui-system.h2
-rw-r--r--ui/ncurses/nc-cui.c6
-rw-r--r--ui/twin/pbt-client.c2
4 files changed, 21 insertions, 15 deletions
diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
index ad3bfba..9ab8dec 100644
--- a/ui/common/ui-system.c
+++ b/ui/common/ui-system.c
@@ -28,6 +28,7 @@
#include "log/log.h"
#include <system/system.h>
+#include <process/process.h>
#include "talloc/talloc.h"
#include "ui-system.h"
@@ -35,22 +36,27 @@
* pb_start_daemon - start the pb-discover daemon.
*/
-int pb_start_daemon(void)
+int pb_start_daemon(void *ctx)
{
+ struct process *process;
+ const char **argv;
int result;
- const char *argv[2];
- char *name = talloc_asprintf(NULL, "%s/sbin/pb-discover",
- pb_system_apps.prefix);
+ char *name;
- argv[0] = name;
- argv[1] = NULL;
+ process = process_create(ctx);
+
+ argv = talloc_array(process, const char *, 2);
+ name = talloc_asprintf(process, "%s/sbin/pb-discover",
+ pb_system_apps.prefix);
- result = pb_run_cmd(argv, 0, 0);
+ argv[0] = name;
+ argv[1] = NULL;
- talloc_free(name);
+ process->path = name;
+ process->argv = argv;
- if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
+ result = process_run_async(process);
+ process_release(process);
return result;
}
diff --git a/ui/common/ui-system.h b/ui/common/ui-system.h
index 5ce501a..3b7d341 100644
--- a/ui/common/ui-system.h
+++ b/ui/common/ui-system.h
@@ -28,7 +28,7 @@
#include <signal.h>
-int pb_start_daemon(void);
+int pb_start_daemon(void *ctx);
unsigned int pb_elf_hash(const char *str);
unsigned int pb_cat_hash(const char *a, const char *b);
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 0dc8d4b..b09f030 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -81,13 +81,13 @@ int cui_run_cmd(struct pmenu_item *item)
{
int result;
struct cui *cui = cui_from_item(item);
- const char *const *cmd_argv = item->data;
+ const char **cmd_argv = item->data;
nc_scr_status_printf(cui->current, "Running %s...", cmd_argv[0]);
def_prog_mode();
- result = pb_run_cmd(cmd_argv, 1, 0);
+ result = process_run_simple_argv(item, cmd_argv);
reset_prog_mode();
redrawwin(cui->current->main_ncw);
@@ -529,7 +529,7 @@ retry_start:
start_deamon = 0;
- result = pb_start_daemon();
+ result = pb_start_daemon(cui);
if (!result)
goto retry_start;
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index 1de532d..20ce31a 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -298,7 +298,7 @@ retry_start:
start_deamon = 0;
- result = pb_start_daemon();
+ result = pb_start_daemon(pbt_client);
if (!result)
goto retry_start;
OpenPOWER on IntegriCloud