mirror of https://gitee.com/openkylin/libvirt.git
Rename virCommandTranslateStatus to virProcessTranslateStatus
The virCommand prefix was inappropriate because the API does not use any virCommandPtr object instance. This API closely related to waitpid/exit, so use virProcess as the prefix Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
0fb58ef5cd
commit
49ecf8b41f
|
@ -2832,7 +2832,7 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||
|
||||
authdismissed = (pkout && strstr(pkout, "dismissed=true"));
|
||||
if (status != 0) {
|
||||
char *tmp = virCommandTranslateStatus(status);
|
||||
char *tmp = virProcessTranslateStatus(status);
|
||||
VIR_ERROR(_("Policy kit denied action %s from pid %lld, uid %d: %s"),
|
||||
action, (long long) callerPid, callerUid, NULLSTR(tmp));
|
||||
VIR_FREE(tmp);
|
||||
|
|
|
@ -162,7 +162,7 @@ virCommandSetPreExecHook;
|
|||
virCommandSetWorkingDirectory;
|
||||
virCommandToString;
|
||||
virCommandTransferFD;
|
||||
virCommandTranslateStatus;
|
||||
virProcessTranslateStatus;
|
||||
virCommandWait;
|
||||
virCommandWriteArgLog;
|
||||
virFork;
|
||||
|
|
|
@ -1687,7 +1687,7 @@ virCommandToString(virCommandPtr cmd)
|
|||
|
||||
|
||||
/**
|
||||
* virCommandTranslateStatus:
|
||||
* virProcessTranslateStatus:
|
||||
* @status: child exit status to translate
|
||||
*
|
||||
* Translate an exit status into a malloc'd string. Generic helper
|
||||
|
@ -1695,7 +1695,7 @@ virCommandToString(virCommandPtr cmd)
|
|||
* status argument, as well as raw waitpid().
|
||||
*/
|
||||
char *
|
||||
virCommandTranslateStatus(int status)
|
||||
virProcessTranslateStatus(int status)
|
||||
{
|
||||
char *buf;
|
||||
if (WIFEXITED(status)) {
|
||||
|
@ -2032,7 +2032,7 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
|
|||
if (virCommandWait(cmd, exitstatus) < 0)
|
||||
ret = -1;
|
||||
|
||||
str = (exitstatus ? virCommandTranslateStatus(*exitstatus)
|
||||
str = (exitstatus ? virProcessTranslateStatus(*exitstatus)
|
||||
: (char *) "status 0");
|
||||
VIR_DEBUG("Result %s, stdout: '%s' stderr: '%s'",
|
||||
NULLSTR(str),
|
||||
|
@ -2291,7 +2291,7 @@ virProcessWait(pid_t pid, int *exitstatus)
|
|||
|
||||
if (exitstatus == NULL) {
|
||||
if (status != 0) {
|
||||
char *st = virCommandTranslateStatus(status);
|
||||
char *st = virProcessTranslateStatus(status);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Child process (%lld) unexpected %s"),
|
||||
(long long) pid, NULLSTR(st));
|
||||
|
@ -2350,7 +2350,7 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
|
|||
cmd->reap = false;
|
||||
if (status) {
|
||||
char *str = virCommandToString(cmd);
|
||||
char *st = virCommandTranslateStatus(status);
|
||||
char *st = virProcessTranslateStatus(status);
|
||||
bool haveErrMsg = cmd->errbuf && *cmd->errbuf && (*cmd->errbuf)[0];
|
||||
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -2398,7 +2398,7 @@ virProcessAbort(pid_t pid)
|
|||
while ((ret = waitpid(pid, &status, WNOHANG)) == -1 &&
|
||||
errno == EINTR);
|
||||
if (ret == pid) {
|
||||
tmp = virCommandTranslateStatus(status);
|
||||
tmp = virProcessTranslateStatus(status);
|
||||
VIR_DEBUG("process has ended: %s", tmp);
|
||||
goto cleanup;
|
||||
} else if (ret == 0) {
|
||||
|
@ -2408,7 +2408,7 @@ virProcessAbort(pid_t pid)
|
|||
while ((ret = waitpid(pid, &status, WNOHANG)) == -1 &&
|
||||
errno == EINTR);
|
||||
if (ret == pid) {
|
||||
tmp = virCommandTranslateStatus(status);
|
||||
tmp = virProcessTranslateStatus(status);
|
||||
VIR_DEBUG("process has ended: %s", tmp);
|
||||
goto cleanup;
|
||||
} else if (ret == 0) {
|
||||
|
@ -2417,7 +2417,7 @@ virProcessAbort(pid_t pid)
|
|||
while ((ret = waitpid(pid, &status, 0)) == -1 &&
|
||||
errno == EINTR);
|
||||
if (ret == pid) {
|
||||
tmp = virCommandTranslateStatus(status);
|
||||
tmp = virProcessTranslateStatus(status);
|
||||
VIR_DEBUG("process has ended: %s", tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ void virCommandWriteArgLog(virCommandPtr cmd,
|
|||
char *virCommandToString(virCommandPtr cmd) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
|
||||
char *virCommandTranslateStatus(int exitstatus) ATTRIBUTE_RETURN_CHECK;
|
||||
char *virProcessTranslateStatus(int exitstatus) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
int virCommandExec(virCommandPtr cmd) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
|
|
Loading…
Reference in New Issue