diff options
author | Martin Willi <martin@strongswan.org> | 2008-07-08 14:58:20 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-07-08 14:58:20 +0000 |
commit | bf44108019e4a9c04057871184db5eb54af352a9 (patch) | |
tree | c6fab24e56bb9a04351e63948e660a94cf81de6c /src/dumm/guest.c | |
parent | 02a608363393df08a3153ac779e08ab903ce27c4 (diff) | |
download | strongswan-bf44108019e4a9c04057871184db5eb54af352a9.tar.bz2 strongswan-bf44108019e4a9c04057871184db5eb54af352a9.tar.xz |
uml "exec" writes stdout/stderr back to mconsole
guest->exec() accepts a callback for output
sligtly refactored mconsole.c
Diffstat (limited to 'src/dumm/guest.c')
-rw-r--r-- | src/dumm/guest.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dumm/guest.c b/src/dumm/guest.c index 6aad15058..c4cc7f1fe 100644 --- a/src/dumm/guest.c +++ b/src/dumm/guest.c @@ -328,9 +328,10 @@ static bool load_template(private_guest_t *this, char *path) /** * Implementation of gues_t.exec */ -static int exec(private_guest_t *this, char *cmd, ...) +static int exec(private_guest_t *this, void(*cb)(void*,char*), void *data, + char *cmd, ...) { - char buf[512]; + char buf[1024]; size_t len; va_list args; @@ -342,10 +343,10 @@ static int exec(private_guest_t *this, char *cmd, ...) if (len > 0 && len < sizeof(buf)) { - return this->mconsole->exec(this->mconsole, buf); + return this->mconsole->exec(this->mconsole, cb, data, buf); } } - return FALSE; + return -1; } /** @@ -472,7 +473,7 @@ static private_guest_t *guest_create_generic(char *parent, char *name, this->public.start = (void*)start; this->public.stop = (void*)stop; this->public.load_template = (bool(*)(guest_t*, char *path))load_template; - this->public.exec = (bool(*)(guest_t*, char *cmd, ...))exec; + this->public.exec = (int(*)(guest_t*, void(*cb)(void*,char*,size_t), void *data, char *cmd, ...))exec; this->public.sigchild = (void(*)(guest_t*))sigchild; this->public.destroy = (void*)destroy; |