mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
build: fix vircommand build on mingw
CC libvirt_util_la-vircommand.lo ../../src/util/vircommand.c:2358:1: error: 'virCommandHandshakeChild' defined but not used [-Werror=unused-function] The function is only implemented inside #ifndef WIN32. * src/util/vircommand.c (virCommandHandshakeChild): Hoist earlier, so that win32 build doesn't hit an unused forward declaration.
This commit is contained in:
parent
ec8a2d0327
commit
ec2cc0f860
@ -118,8 +118,6 @@ struct _virCommand {
|
||||
#endif
|
||||
};
|
||||
|
||||
static int virCommandHandshakeChild(virCommandPtr cmd);
|
||||
|
||||
/*
|
||||
* virCommandFDIsSet:
|
||||
* @fd: FD to test
|
||||
@ -332,6 +330,54 @@ prepareStdFd(int fd, int std)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* virCommandHandshakeChild:
|
||||
*
|
||||
* child side of handshake - called by child process in virExec() to
|
||||
* indicate to parent that the child process has successfully
|
||||
* completed its pre-exec initialization.
|
||||
*/
|
||||
static int
|
||||
virCommandHandshakeChild(virCommandPtr cmd)
|
||||
{
|
||||
char c = '1';
|
||||
int rv;
|
||||
|
||||
if (!cmd->handshake)
|
||||
return true;
|
||||
|
||||
VIR_DEBUG("Notifying parent for handshake start on %d",
|
||||
cmd->handshakeWait[1]);
|
||||
if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Unable to notify parent process"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Waiting on parent for handshake complete on %d",
|
||||
cmd->handshakeNotify[0]);
|
||||
if ((rv = saferead(cmd->handshakeNotify[0], &c,
|
||||
sizeof(c))) != sizeof(c)) {
|
||||
if (rv < 0)
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Unable to wait on parent process"));
|
||||
else
|
||||
virReportSystemError(EIO, "%s",
|
||||
_("libvirtd quit during handshake"));
|
||||
return -1;
|
||||
}
|
||||
if (c != '1') {
|
||||
virReportSystemError(EINVAL,
|
||||
_("Unexpected confirm code '%c' from parent"),
|
||||
c);
|
||||
return -1;
|
||||
}
|
||||
VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
|
||||
VIR_FORCE_CLOSE(cmd->handshakeNotify[0]);
|
||||
|
||||
VIR_DEBUG("Handshake with parent is done");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* virExec:
|
||||
* @cmd virCommandPtr containing all information about the program to
|
||||
@ -2348,54 +2394,6 @@ void virCommandRequireHandshake(virCommandPtr cmd)
|
||||
cmd->handshake = true;
|
||||
}
|
||||
|
||||
/* virCommandHandshakeChild:
|
||||
*
|
||||
* child side of handshake - called by child process in virExec() to
|
||||
* indicate to parent that the child process has successfully
|
||||
* completed its pre-exec initialization.
|
||||
*/
|
||||
static int
|
||||
virCommandHandshakeChild(virCommandPtr cmd)
|
||||
{
|
||||
char c = '1';
|
||||
int rv;
|
||||
|
||||
if (!cmd->handshake)
|
||||
return true;
|
||||
|
||||
VIR_DEBUG("Notifying parent for handshake start on %d",
|
||||
cmd->handshakeWait[1]);
|
||||
if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Unable to notify parent process"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Waiting on parent for handshake complete on %d",
|
||||
cmd->handshakeNotify[0]);
|
||||
if ((rv = saferead(cmd->handshakeNotify[0], &c,
|
||||
sizeof(c))) != sizeof(c)) {
|
||||
if (rv < 0)
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Unable to wait on parent process"));
|
||||
else
|
||||
virReportSystemError(EIO, "%s",
|
||||
_("libvirtd quit during handshake"));
|
||||
return -1;
|
||||
}
|
||||
if (c != '1') {
|
||||
virReportSystemError(EINVAL,
|
||||
_("Unexpected confirm code '%c' from parent"),
|
||||
c);
|
||||
return -1;
|
||||
}
|
||||
VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
|
||||
VIR_FORCE_CLOSE(cmd->handshakeNotify[0]);
|
||||
|
||||
VIR_DEBUG("Handshake with parent is done");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* virCommandHandshakeWait:
|
||||
* @cmd: command to wait on
|
||||
|
Loading…
Reference in New Issue
Block a user