mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 16:45:26 +00:00
Rename virPid{Abort,Wait} to virProcess{Abort,Wait}
Change "Pid" to "Process" to align with the virProcessKill
API naming prefix
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 0fb58ef5cd
)
This commit is contained in:
parent
035d998f01
commit
88589de79c
@ -196,7 +196,7 @@ static int daemonForkIntoBackground(const char *argv0)
|
|||||||
VIR_FORCE_CLOSE(statuspipe[1]);
|
VIR_FORCE_CLOSE(statuspipe[1]);
|
||||||
|
|
||||||
/* We wait to make sure the first child forked successfully */
|
/* We wait to make sure the first child forked successfully */
|
||||||
if (virPidWait(pid, NULL) < 0)
|
if (virProcessWait(pid, NULL) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* If we get here, then the grandchild was spawned, so we
|
/* If we get here, then the grandchild was spawned, so we
|
||||||
|
@ -166,8 +166,8 @@ virCommandTranslateStatus;
|
|||||||
virCommandWait;
|
virCommandWait;
|
||||||
virCommandWriteArgLog;
|
virCommandWriteArgLog;
|
||||||
virFork;
|
virFork;
|
||||||
virPidAbort;
|
virProcessAbort;
|
||||||
virPidWait;
|
virProcessWait;
|
||||||
virRun;
|
virRun;
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ int lxcContainerHasReboot(void)
|
|||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
_("Unable to clone to check reboot support"));
|
_("Unable to clone to check reboot support"));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (virPidWait(cpid, &status) < 0) {
|
} else if (virProcessWait(cpid, &status) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2001,7 +2001,7 @@ int lxcContainerAvailable(int features)
|
|||||||
VIR_DEBUG("clone call returned %s, container support is not enabled",
|
VIR_DEBUG("clone call returned %s, container support is not enabled",
|
||||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (virPidWait(cpid, NULL) < 0) {
|
} else if (virProcessWait(cpid, NULL) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ static void virLXCControllerStopInit(virLXCControllerPtr ctrl)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
virLXCControllerCloseLoopDevices(ctrl, true);
|
virLXCControllerCloseLoopDevices(ctrl, true);
|
||||||
virPidAbort(ctrl->initpid);
|
virProcessAbort(ctrl->initpid);
|
||||||
ctrl->initpid = 0;
|
ctrl->initpid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ void virNetSocketDispose(void *obj)
|
|||||||
VIR_FORCE_CLOSE(sock->fd);
|
VIR_FORCE_CLOSE(sock->fd);
|
||||||
VIR_FORCE_CLOSE(sock->errfd);
|
VIR_FORCE_CLOSE(sock->errfd);
|
||||||
|
|
||||||
virPidAbort(sock->pid);
|
virProcessAbort(sock->pid);
|
||||||
|
|
||||||
VIR_FREE(sock->localAddrStr);
|
VIR_FREE(sock->localAddrStr);
|
||||||
VIR_FREE(sock->remoteAddrStr);
|
VIR_FREE(sock->remoteAddrStr);
|
||||||
|
@ -1691,7 +1691,7 @@ virCommandToString(virCommandPtr cmd)
|
|||||||
* @status: child exit status to translate
|
* @status: child exit status to translate
|
||||||
*
|
*
|
||||||
* Translate an exit status into a malloc'd string. Generic helper
|
* Translate an exit status into a malloc'd string. Generic helper
|
||||||
* for virCommandRun(), virCommandWait(), virRun(), and virPidWait()
|
* for virCommandRun(), virCommandWait(), virRun(), and virProcessWait()
|
||||||
* status argument, as well as raw waitpid().
|
* status argument, as well as raw waitpid().
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
@ -2164,7 +2164,7 @@ virCommandHook(void *data)
|
|||||||
* for pid. While cmd is still in scope, you may reap the child via
|
* for pid. While cmd is still in scope, you may reap the child via
|
||||||
* virCommandWait or virCommandAbort. But after virCommandFree, if
|
* virCommandWait or virCommandAbort. But after virCommandFree, if
|
||||||
* you have not yet reaped the child, then it continues to run until
|
* you have not yet reaped the child, then it continues to run until
|
||||||
* you call virPidWait or virPidAbort.
|
* you call virProcessWait or virProcessAbort.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
||||||
@ -2257,7 +2257,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virPidWait:
|
* virProcessWait:
|
||||||
* @pid: child to wait on
|
* @pid: child to wait on
|
||||||
* @exitstatus: optional status collection
|
* @exitstatus: optional status collection
|
||||||
*
|
*
|
||||||
@ -2268,7 +2268,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
|||||||
* child must exit with status 0 for this to succeed.
|
* child must exit with status 0 for this to succeed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virPidWait(pid_t pid, int *exitstatus)
|
virProcessWait(pid_t pid, int *exitstatus)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int status;
|
int status;
|
||||||
@ -2338,13 +2338,13 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If virPidWait reaps pid but then returns failure because
|
/* If virProcessWait reaps pid but then returns failure because
|
||||||
* exitstatus was NULL, then a second virCommandWait would risk
|
* exitstatus was NULL, then a second virCommandWait would risk
|
||||||
* calling waitpid on an unrelated process. Besides, that error
|
* calling waitpid on an unrelated process. Besides, that error
|
||||||
* message is not as detailed as what we can provide. So, we
|
* message is not as detailed as what we can provide. So, we
|
||||||
* guarantee that virPidWait only fails due to failure to wait,
|
* guarantee that virProcessWait only fails due to failure to wait,
|
||||||
* and repeat the exitstatus check code ourselves. */
|
* and repeat the exitstatus check code ourselves. */
|
||||||
ret = virPidWait(cmd->pid, exitstatus ? exitstatus : &status);
|
ret = virProcessWait(cmd->pid, exitstatus ? exitstatus : &status);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
cmd->pid = -1;
|
cmd->pid = -1;
|
||||||
cmd->reap = false;
|
cmd->reap = false;
|
||||||
@ -2370,7 +2370,7 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
|
|||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
/**
|
/**
|
||||||
* virPidAbort:
|
* virProcessAbort:
|
||||||
* @pid: child process to kill
|
* @pid: child process to kill
|
||||||
*
|
*
|
||||||
* Abort a child process if PID is positive and that child is still
|
* Abort a child process if PID is positive and that child is still
|
||||||
@ -2380,7 +2380,7 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
|
|||||||
* this does nothing.
|
* this does nothing.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
virPidAbort(pid_t pid)
|
virProcessAbort(pid_t pid)
|
||||||
{
|
{
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
int ret;
|
int ret;
|
||||||
@ -2444,13 +2444,13 @@ virCommandAbort(virCommandPtr cmd)
|
|||||||
{
|
{
|
||||||
if (!cmd || cmd->pid == -1)
|
if (!cmd || cmd->pid == -1)
|
||||||
return;
|
return;
|
||||||
virPidAbort(cmd->pid);
|
virProcessAbort(cmd->pid);
|
||||||
cmd->pid = -1;
|
cmd->pid = -1;
|
||||||
cmd->reap = false;
|
cmd->reap = false;
|
||||||
}
|
}
|
||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
void
|
void
|
||||||
virPidAbort(pid_t pid)
|
virProcessAbort(pid_t pid)
|
||||||
{
|
{
|
||||||
/* Not yet ported to mingw. Any volunteers? */
|
/* Not yet ported to mingw. Any volunteers? */
|
||||||
VIR_DEBUG("failed to reap child %lld, abandoning it", (long long)pid);
|
VIR_DEBUG("failed to reap child %lld, abandoning it", (long long)pid);
|
||||||
@ -2617,7 +2617,7 @@ int virCommandHandshakeNotify(virCommandPtr cmd)
|
|||||||
*
|
*
|
||||||
* Release all resources. The only exception is that if you called
|
* Release all resources. The only exception is that if you called
|
||||||
* virCommandRunAsync with a non-null pid, then the asynchronous child
|
* virCommandRunAsync with a non-null pid, then the asynchronous child
|
||||||
* is not reaped, and you must call virPidWait() or virPidAbort() yourself.
|
* is not reaped, and you must call virProcessWait() or virProcessAbort() yourself.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
virCommandFree(virCommandPtr cmd)
|
virCommandFree(virCommandPtr cmd)
|
||||||
|
@ -151,8 +151,8 @@ int virCommandRun(virCommandPtr cmd,
|
|||||||
int virCommandRunAsync(virCommandPtr cmd,
|
int virCommandRunAsync(virCommandPtr cmd,
|
||||||
pid_t *pid) ATTRIBUTE_RETURN_CHECK;
|
pid_t *pid) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
int virPidWait(pid_t pid,
|
int virProcessWait(pid_t pid,
|
||||||
int *exitstatus) ATTRIBUTE_RETURN_CHECK;
|
int *exitstatus) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
int virCommandWait(virCommandPtr cmd,
|
int virCommandWait(virCommandPtr cmd,
|
||||||
int *exitstatus) ATTRIBUTE_RETURN_CHECK;
|
int *exitstatus) ATTRIBUTE_RETURN_CHECK;
|
||||||
@ -165,7 +165,7 @@ int virCommandHandshakeWait(virCommandPtr cmd)
|
|||||||
int virCommandHandshakeNotify(virCommandPtr cmd)
|
int virCommandHandshakeNotify(virCommandPtr cmd)
|
||||||
ATTRIBUTE_RETURN_CHECK;
|
ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
void virPidAbort(pid_t pid);
|
void virProcessAbort(pid_t pid);
|
||||||
|
|
||||||
void virCommandAbort(virCommandPtr cmd);
|
void virCommandAbort(virCommandPtr cmd);
|
||||||
|
|
||||||
|
@ -729,10 +729,10 @@ virFileAccessibleAs(const char *path, int mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pid) { /* parent */
|
if (pid) { /* parent */
|
||||||
if (virPidWait(pid, &status) < 0) {
|
if (virProcessWait(pid, &status) < 0) {
|
||||||
/* virPidWait() already
|
/* virProcessWait() already
|
||||||
* reported error */
|
* reported error */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WIFEXITED(status)) {
|
if (!WIFEXITED(status)) {
|
||||||
|
@ -329,7 +329,7 @@ virtTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen)
|
|||||||
VIR_FORCE_CLOSE(pipefd[1]);
|
VIR_FORCE_CLOSE(pipefd[1]);
|
||||||
len = virFileReadLimFD(pipefd[0], maxlen, buf);
|
len = virFileReadLimFD(pipefd[0], maxlen, buf);
|
||||||
VIR_FORCE_CLOSE(pipefd[0]);
|
VIR_FORCE_CLOSE(pipefd[0]);
|
||||||
if (virPidWait(pid, NULL) < 0)
|
if (virProcessWait(pid, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@ -699,7 +699,7 @@ int virtTestMain(int argc,
|
|||||||
} else {
|
} else {
|
||||||
int i, status;
|
int i, status;
|
||||||
for (i = 0 ; i < mp ; i++) {
|
for (i = 0 ; i < mp ; i++) {
|
||||||
if (virPidWait(workers[i], NULL) < 0)
|
if (virProcessWait(workers[i], NULL) < 0)
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
VIR_FREE(workers);
|
VIR_FREE(workers);
|
||||||
|
Loading…
Reference in New Issue
Block a user