* The data flow of tunnel3 migration in the dest side:
* stream -> pipe -> recvfd of libxlDomainStartRestore
*/
- if (pipe(dataFD) < 0)
+ if (virPipe(dataFD) < 0)
goto endjob;
/* Stream data will be written to pipeIn */
tc->dataFD[0] = -1;
tc->dataFD[1] = -1;
- if (pipe(tc->dataFD) < 0) {
- virReportError(errno, "%s", _("Unable to make pipes"));
+ if (virPipe(tc->dataFD) < 0)
goto out;
- }
arg = &tc->tmThread;
/* Read from pipe */
virLockDaemonForkIntoBackground(const char *argv0)
{
int statuspipe[2];
- if (pipe(statuspipe) < 0)
+ if (virPipeQuiet(statuspipe) < 0)
return -1;
pid_t pid = fork();
virLogDaemonForkIntoBackground(const char *argv0)
{
int statuspipe[2];
- if (pipe(statuspipe) < 0)
+ if (virPipeQuiet(statuspipe) < 0)
return -1;
pid_t pid = fork();
}
}
- if (pipe(pipefd) < 0) {
- virReportSystemError(errno, "%s",
- _("Cannot open fifo pipe"));
+ if (virPipe(pipefd) < 0)
goto error;
- }
+
if (VIR_ALLOC(file) < 0)
goto error;
goto cleanup;
}
- if (pipe(handshakefds) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to create pipe"));
+ if (virPipe(handshakefds) < 0)
goto cleanup;
- }
if (!(cmd = virLXCProcessBuildControllerCmd(driver,
vm,
goto done;
if (tunnel &&
- (pipe(dataFD) < 0 || virSetCloseExec(dataFD[1]) < 0)) {
- virReportSystemError(errno, "%s",
- _("cannot create pipe for tunnelled migration"));
+ virPipe(dataFD) < 0)
goto stopjob;
- }
startFlags = VIR_QEMU_PROCESS_START_AUTODESTROY;
qemuMigrationIOThreadPtr io = NULL;
int wakeupFD[2] = { -1, -1 };
- if (pipe2(wakeupFD, O_CLOEXEC) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to make pipe"));
+ if (virPipe(wakeupFD) < 0)
goto error;
- }
if (VIR_ALLOC(io) < 0)
goto error;
spec.dest.fd.qemu = -1;
spec.dest.fd.local = -1;
- if (pipe2(fds, O_CLOEXEC) == 0) {
- spec.dest.fd.qemu = fds[1];
- spec.dest.fd.local = fds[0];
- }
+ if (virPipe(fds) < 0)
+ goto cleanup;
+
+ spec.dest.fd.qemu = fds[1];
+ spec.dest.fd.local = fds[0];
+
if (spec.dest.fd.qemu == -1 ||
qemuSecuritySetImageFDLabel(driver->securityManager, vm->def,
spec.dest.fd.qemu) < 0) {
return -1;
}
- if (compressor && pipe(pipeFD) < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to create pipe for migration"));
+ if (compressor && virPipe(pipeFD) < 0)
return -1;
- }
/* All right! We can use fd migration, which means that qemu
* doesn't have to open() the file, so while we still have to
&secret, &secret_len) < 0)
goto error;
- if (pipe(pipefd) == -1) {
- virReportSystemError(errno, "%s",
- _("Unable to create pipe"));
+ if (virPipe(pipefd) < 0)
goto error;
- }
if (virCommandSetSendBuffer(cmd, pipefd[1], secret, secret_len) < 0)
goto error;
static int daemonForkIntoBackground(const char *argv0)
{
int statuspipe[2];
- if (pipe(statuspipe) < 0)
+ if (virPipeQuiet(statuspipe) < 0)
return -1;
pid_t pid = fork();
if (dmn->sigwrite != -1)
return 0;
- if (pipe2(fds, O_CLOEXEC|O_NONBLOCK) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to create signal pipe"));
+ if (virPipeNonBlock(fds) < 0)
return -1;
- }
if ((dmn->sigwatch = virEventAddHandle(fds[0],
VIR_EVENT_HANDLE_READABLE,
goto error;
}
- if (pipe(errfd) < 0) {
- virReportSystemError(errno, "%s",
- _("unable to create socket pair"));
+ if (virPipe(errfd) < 0)
goto error;
- }
virCommandSetInputFD(cmd, sv[1]);
virCommandSetOutputFD(cmd, &sv[1]);
if (cmd->outfdptr != NULL) {
if (*cmd->outfdptr == -1) {
- if (pipe2(pipeout, O_CLOEXEC) < 0) {
- virReportSystemError(errno,
- "%s", _("cannot create pipe"));
+ if (virPipe(pipeout) < 0)
goto cleanup;
- }
if ((cmd->flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeout[0]) == -1) {
if (cmd->errfdptr == cmd->outfdptr) {
childerr = childout;
} else if (*cmd->errfdptr == -1) {
- if (pipe2(pipeerr, O_CLOEXEC) < 0) {
- virReportSystemError(errno,
- "%s", _("Failed to create pipe"));
+ if (virPipe(pipeerr) < 0)
goto cleanup;
- }
if ((cmd->flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeerr[0]) == -1) {
* virCommandDoAsyncIO. */
if (cmd->inbuf && cmd->infd == -1 &&
(synchronous || cmd->flags & VIR_EXEC_ASYNC_IO)) {
- if (pipe2(infd, O_CLOEXEC) < 0) {
- virReportSystemError(errno, "%s",
- _("unable to open pipe"));
+ if (virPipe(infd) < 0) {
cmd->has_error = -1;
return -1;
}
return;
}
- if (pipe2(cmd->handshakeWait, O_CLOEXEC) < 0) {
+ if (virPipeQuiet(cmd->handshakeWait) < 0) {
cmd->has_error = errno;
return;
}
- if (pipe2(cmd->handshakeNotify, O_CLOEXEC) < 0) {
+ if (virPipeQuiet(cmd->handshakeNotify) < 0) {
VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
cmd->has_error = errno;
goto error;
}
- if (pipe(pipefds) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to create pipe"));
+ if (virPipe(pipefds) < 0)
goto error;
- }
if (VIR_ALLOC(threadData) < 0)
goto error;
goto error;
}
- if (pipe2(pipefd, O_CLOEXEC) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unable to create pipe for %s"), name);
+ if (virPipe(pipefd) < 0)
goto error;
- }
if (!(iohelper_path = virFileFindResource("libvirt_iohelper",
abs_top_builddir "/src",
if (!isatty(STDIN_FILENO))
goto error;
- if (pipe2(pipe_fd, 0) < 0)
+ if (virPipe(pipe_fd) < 0)
goto error;
if (VIR_ALLOC(agent) < 0)
pid_t parent = getpid();
int errfd[2] = { -1, -1 };
- if (pipe2(errfd, O_CLOEXEC) < 0) {
- virReportSystemError(errno, "%s",
- _("Cannot create pipe for child"));
+ if (virPipe(errfd) < 0)
return -1;
- }
if ((child = virFork()) < 0)
goto cleanup;
int ngroups;
virCommandPtr cmd = virCommandNew("some/nonexistent/binary");
- if (pipe(pipeFD) < 0) {
+ if (virPipeQuiet(pipeFD) < 0) {
fprintf(stderr, "Unable to create pipe\n");
goto cleanup;
}
errexpect = g_strdup_printf(TEST27_ERREXPECT_TEMP,
buffer0, buffer1, buffer2);
- if (pipe(pipe1) < 0 || pipe(pipe2) < 0) {
+ if (virPipeQuiet(pipe1) < 0 || virPipeQuiet(pipe2) < 0) {
printf("Could not create pipe: %s\n", g_strerror(errno));
goto cleanup;
}
char one = '1';
for (i = 0; i < NUM_FDS; i++) {
- if (pipe(handles[i].pipeFD) < 0) {
+ if (virPipeQuiet(handles[i].pipeFD) < 0) {
fprintf(stderr, "Cannot create pipe: %d", errno);
return EXIT_FAILURE;
}
int pipefd[2];
int len;
- if (pipe(pipefd) < 0)
+ if (virPipeQuiet(pipefd) < 0)
return -1;
pid_t pid = fork();
if (vshCommandOptBool(cmd, "verbose"))
verbose = true;
- if (pipe(p) < 0)
+ if (virPipeQuiet(p) < 0)
goto cleanup;
data.ctl = ctl;
if (vshCommandOptBool(cmd, "verbose"))
verbose = true;
- if (pipe(p) < 0)
+ if (virPipeQuiet(p) < 0)
goto cleanup;
data.ctl = ctl;
if (vshCommandOptBool(cmd, "verbose"))
verbose = true;
- if (pipe(p) < 0)
+ if (virPipeQuiet(p) < 0)
goto cleanup;
data.ctl = ctl;
goto cleanup;
}
- if (pipe(p) < 0)
+ if (virPipeQuiet(p) < 0)
goto cleanup;
data.ctl = ctl;
assert(ctl->eventPipe[0] == -1 && ctl->eventPipe[1] == -1 &&
ctl->eventTimerId >= 0);
- if (pipe2(ctl->eventPipe, O_CLOEXEC) < 0) {
- char ebuf[1024];
-
- vshError(ctl, _("failed to create pipe: %s"),
- virStrerror(errno, ebuf, sizeof(ebuf)));
+ if (virPipe(ctl->eventPipe) < 0) {
+ vshSaveLibvirtError();
+ vshReportError(ctl);
return -1;
}