diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-07-06 12:30:59 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-07-06 12:30:59 +0100 |
commit | 7cbb86e4c8b6b8bca8606d219c5571549ceabba6 (patch) | |
tree | cff790d21b21606d27a9d37a93f1f08219ba6bfb /src | |
parent | cab0443e2508209fab67bfe0f723ee79cc5e2929 (diff) | |
download | libguestfs-7cbb86e4c8b6b8bca8606d219c5571549ceabba6.tar.gz libguestfs-7cbb86e4c8b6b8bca8606d219c5571549ceabba6.tar.xz libguestfs-7cbb86e4c8b6b8bca8606d219c5571549ceabba6.zip |
Add 'get-pid' command.
This is used to get the PID of the qemu subprocess, mainly for
debugging and testing purposes.
Diffstat (limited to 'src')
-rwxr-xr-x | src/generator.ml | 9 | ||||
-rw-r--r-- | src/guestfs.c | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml index e86fce17..d44b7a74 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -632,6 +632,15 @@ then this returns the compiled-in default value for memsize. For more information on the architecture of libguestfs, see L<guestfs(3)>."); + ("get_pid", (RInt "pid", []), -1, [FishAlias "pid"], + [], + "get PID of qemu subprocess", + "\ +Return the process ID of the qemu subprocess. If there is no +qemu subprocess, then this will return an error. + +This is an internal call used for debugging and testing."); + ] (* daemon_functions are any functions which cause some action diff --git a/src/guestfs.c b/src/guestfs.c index 350d8481..bbbd4ea5 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -667,6 +667,17 @@ guestfs_get_memsize (guestfs_h *g) return g->memsize; } +int +guestfs_get_pid (guestfs_h *g) +{ + if (g->pid > 0) + return g->pid; + else { + error (g, "get_pid: no qemu subprocess"); + return -1; + } +} + /* Add a string to the current command line. */ static void incr_cmdline_size (guestfs_h *g) |