Displaying 5 results from an estimated 5 matches for "guestfs___cmd_wait".
2015 Jan 26
6
[PATCH 1/6] cmd: add a way to run (and wait) asynchronously commands
...if (stderr_fd)
+ *stderr_fd = cmd->errorfd;
+
+ return 0;
+}
+
+/* Wait for the command to finish.
+ *
+ * The command MUST have been started with guestfs___cmd_run_async.
+ *
+ * Returns the exit status. Test it using WIF* macros.
+ *
+ * On error: Calls error(g) and returns -1.
+ */
+int
+guestfs___cmd_wait (struct command *cmd)
+{
+ return wait_command (cmd);
+}
+
void
guestfs___cmd_close (struct command *cmd)
{
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 573c3da..bd5f675 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -20,6 +20,7 @@
#define GUESTFS_INT...
2015 Feb 02
1
Re: [PATCH 5/6] New APIs: copy-in and copy-out
...1)
> + return -1;
> +
> + snprintf (fdbuf, sizeof fdbuf, "/dev/fd/%d", fd);
> +
> + r = guestfs_tar_in (g, fdbuf, remotedir);
> +
> + if (close (fd) == -1) {
> + perror ("close (tar subprocess)");
> + return -1;
> + }
> +
> + r = guestfs___cmd_wait (cmd);
> + if (r == -1)
> + return -1;
> + if (!(WIFEXITED (r) && WEXITSTATUS (r) == 0))
> + return -1;
> +
> + return 0;
> +}
> +
> +struct copy_out_child_data {
> + const char *localdir;
> + const char *basename;
> +};
> +
> +static int...
2015 Feb 02
8
[PATCH 0/7 v2] Make copy_in & copy_out APIs, and use copy_in in customize
Hi,
attached there is the second version of the patch series adding
copy_in and copy_out in the library, mostly moving them from guestfish.
It also adds the copy_in usage in virt-customize, as aid in a new image
building.
Thanks,
Pino Toscano (7):
cmd: add a way to run (and wait) asynchronously commands
cmd: add a child-setup callback
cmd: add the possibility to get a fd to the process
2015 Jan 26
0
[PATCH 5/6] New APIs: copy-in and copy-out
...md_run_async (cmd, NULL, NULL, &fd, NULL);
+ if (r == -1)
+ return -1;
+
+ snprintf (fdbuf, sizeof fdbuf, "/dev/fd/%d", fd);
+
+ r = guestfs_tar_in (g, fdbuf, remotedir);
+
+ if (close (fd) == -1) {
+ perror ("close (tar subprocess)");
+ return -1;
+ }
+
+ r = guestfs___cmd_wait (cmd);
+ if (r == -1)
+ return -1;
+ if (!(WIFEXITED (r) && WEXITSTATUS (r) == 0))
+ return -1;
+
+ return 0;
+}
+
+struct copy_out_child_data {
+ const char *localdir;
+ const char *basename;
+};
+
+static int
+child_setup (guestfs_h *g, void *data)
+{
+ struct copy_out_child_d...
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.
(http://stackoverflow.com/a/228797)
These large but completely mechanical patches change the illegal
identifiers to legal ones.
Rich.