ttyname_r
uname
unsetenv
-usleep
verify
vsnprintf
waitpid
/* simulate holdtime by sleeping */
if (holdtime > 0)
- usleep(holdtime * 1000);
+ g_usleep(holdtime * 1000);
/* release the keys */
for (i = 0; i < nkeycodes; i++) {
case MSVM_CONCRETEJOB_JOBSTATE_SHUTTING_DOWN:
hypervFreeObject(priv, (hypervObject *)job);
job = NULL;
- usleep(100 * 1000); /* sleep 100 ms */
+ g_usleep(100 * 1000); /* sleep 100 ms */
timeout -= 100;
continue;
case MSVM_CONCRETEJOB_JOBSTATE_COMPLETED:
hypervFreeObject(priv, (hypervObject *)concreteJob);
concreteJob = NULL;
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
continue;
case MSVM_CONCRETEJOB_JOBSTATE_COMPLETED:
VIR_WARN("Failed to kill off pid %lld",
(unsigned long long)priv->clientPid);
}
- usleep(200 * 1000);
+ g_usleep(200 * 1000);
}
}
}
#else
/* fall back to polling */
VIR_DEBUG("Sleeping for %dms", LOCKSPACE_SLEEP);
- usleep(LOCKSPACE_SLEEP * 1000);
+ g_usleep(LOCKSPACE_SLEEP * 1000);
#endif
VIR_DEBUG("Retrying to add lockspace (left %d)", retries);
goto retry;
while (!virFileExists(pidpath)) {
/* wait for 100ms before checking again, but don't do it for ever */
if (errno == ENOENT && loops < 10) {
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
loops++;
} else {
virReportSystemError(errno,
* decide that the freezing has been complete only with
* the state actually transit to "FROZEN".
*/
- usleep(check_interval * 1000);
+ g_usleep(check_interval * 1000);
r = virCgroupGetFreezerState(priv->cgroup, &state);
goto cleanup;
}
- usleep(100*1000);
+ g_usleep(100*1000);
retries--;
}
* than modifications to domains, this seems a reasonable
* tradeoff in exchange for less code disruption.
*/
- usleep(20 * 1000);
+ g_usleep(20 * 1000);
}
VIR_WARN("Timed out waiting after SIG%s to %s process %d "
"(network '%s')",
unsigned long long now;
if (virTimeMillisNowRaw(&now) < 0) {
- usleep(PCAP_FLOOD_TIMEOUT_MS); /* 1 ms */
+ g_usleep(PCAP_FLOOD_TIMEOUT_MS); /* 1 ms */
pc->penaltyTimeoutAbs = 0;
} else {
/* don't listen to the fd for 1 ms */
while (virAtomicIntGet(&virNWFilterSnoopState.nThreads) != 0) {
VIR_WARN("Waiting for snooping threads to terminate: %u",
virAtomicIntGet(&virNWFilterSnoopState.nThreads));
- usleep(1000 * 1000);
+ g_usleep(1000 * 1000);
}
}
threadsTerminate = true;
while (virHashSize(pendingLearnReq) != 0)
- usleep((PKT_TIMEOUT_MS * 1000) / 3);
+ g_usleep((PKT_TIMEOUT_MS * 1000) / 3);
if (allowNewThreads)
threadsTerminate = false;
virJSONValueFree(reply);
reply = NULL;
- usleep(250000);
+ g_usleep(250000);
} while (++i <= timeout);
virJSONValueFree(cmd);
retry:
if ((ret = qemuRemoveCgroup(vm)) < 0) {
if (ret == -EBUSY && (retries++ < 5)) {
- usleep(200*1000);
+ g_usleep(200*1000);
goto retry;
}
VIR_WARN("Failed to remove cgroup for %s",
rc = qemuTPMEmulatorGetPid(cfg->swtpmStateDir, shortName, &pid);
if (rc < 0) {
timeout -= 50;
- usleep(50 * 1000);
+ g_usleep(50 * 1000);
continue;
}
if (rc == 0 && pid == (pid_t)-1)
daemonLaunched = true;
}
- usleep(10000);
+ g_usleep(10000);
}
localAddr.len = sizeof(localAddr.data);
if (retries && (errno == EACCES || errno == EAGAIN)) {
/* File is locked. Try again. */
retries--;
- usleep(1000);
+ g_usleep(1000);
continue;
} else {
virReportSystemError(errno,
if (virDirOpenQuiet(&dh, def->target.path) < 0) {
opentries++;
if (loop && errno == ENOENT && opentries < 50) {
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
goto reopen;
}
virReportSystemError(errno,
}
if (!direrr && loop && ++retry < 100) {
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
goto retry;
}
if (ret <= 0)
break;
- usleep(200 * 1000);
+ g_usleep(200 * 1000);
}
VIR_DEBUG("Complete %d", ret);
return ret;
if (tries == 0 || errno != ENOENT)
return -1;
- usleep(ms * 1000);
+ g_usleep(ms * 1000);
}
return 0;
* wait, then upcoming operations on the VF may fail.
*/
while (retries-- > 0 && !virNetDevExists(linkdev))
- usleep(1000);
+ g_usleep(1000);
}
if (pfDevOrig && setMACrc == 0) {
/* Parse response. */
dad = virNetDevIPParseDadStatus(resp, recvbuflen, addrs, count);
if (dad)
- usleep(1000 * 10);
+ g_usleep(1000 * 10);
}
/* Check timeout. */
if (dad) {
tapfd[i] = fd;
} else if (retries-- > 0) {
/* may need to wait for udev to be done */
- usleep(20000);
+ g_usleep(20000);
} else {
/* However, if haven't succeeded, quit. */
virReportSystemError(errno,
break;
}
- usleep(STATUS_POLL_INTERVL_USEC);
+ g_usleep(STATUS_POLL_INTERVL_USEC);
}
if (status == PORT_PROFILE_RESPONSE_INPROGRESS) {
virPCIDeviceWrite16(parent, parentfd, PCI_BRIDGE_CONTROL,
ctl | PCI_BRIDGE_CTL_RESET);
- usleep(200 * 1000); /* sleep 200ms */
+ g_usleep(200 * 1000); /* sleep 200ms */
virPCIDeviceWrite16(parent, parentfd, PCI_BRIDGE_CONTROL, ctl);
- usleep(200 * 1000); /* sleep 200ms */
+ g_usleep(200 * 1000); /* sleep 200ms */
if (virPCIDeviceWrite(dev, cfgfd, 0, config_space, PCI_CONF_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
virPCIDeviceWrite32(dev, cfgfd, dev->pci_pm_cap_pos + PCI_PM_CTRL,
ctl | PCI_PM_CTRL_STATE_D3hot);
- usleep(10 * 1000); /* sleep 10ms */
+ g_usleep(10 * 1000); /* sleep 10ms */
virPCIDeviceWrite32(dev, cfgfd, dev->pci_pm_cap_pos + PCI_PM_CTRL,
ctl | PCI_PM_CTRL_STATE_D0);
- usleep(10 * 1000); /* sleep 10ms */
+ g_usleep(10 * 1000); /* sleep 10ms */
if (virPCIDeviceWrite(dev, cfgfd, 0, &config_space[0], PCI_CONF_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
} else if (ret == 0) {
VIR_DEBUG("trying SIGTERM to child process %d", pid);
kill(pid, SIGTERM);
- usleep(10 * 1000);
+ g_usleep(10 * 1000);
while ((ret = waitpid(pid, &status, WNOHANG)) == -1 &&
errno == EINTR);
if (ret == pid) {
goto cleanup; /* process is dead */
}
- usleep(200 * 1000);
+ g_usleep(200 * 1000);
}
virReportSystemError(EBUSY,
VIR_DEBUG("sleeping for %llu ms", next);
- usleep(next * 1000);
+ g_usleep(next * 1000);
return 1;
}
/* since VBOX does not support holdtime, simulate it by sleeping and
then sending the release key scancodes */
if (holdtime > 0)
- usleep(holdtime * 1000);
+ g_usleep(holdtime * 1000);
rc = gVBoxAPI.UIKeyboard.PutScancodes(keyboard, nkeycodes, keyUpCodes,
&codesStored);
goto cleanup;
}
while (kill(pid, 0) != -1)
- usleep(100*1000);
+ g_usleep(100*1000);
ret = checkoutput("test4", NULL);
}
while (kill(pid, SIGINT) != -1)
- usleep(100*1000);
+ g_usleep(100*1000);
ret = 0;
goto cleanup;
}
- usleep(10 * 1000);
+ g_usleep(10 * 1000);
} else {
break;
}
startJob();
pthread_mutex_unlock(&eventThreadMutex);
sched_yield();
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
pthread_mutex_lock(&eventThreadMutex);
virEventPollRemoveHandle(handles[1].watch);
if (finishJob("Interrupted during poll", -1, -1) != EXIT_SUCCESS)
startJob();
pthread_mutex_unlock(&eventThreadMutex);
sched_yield();
- usleep(100 * 1000);
+ g_usleep(100 * 1000);
pthread_mutex_lock(&eventThreadMutex);
virEventPollRemoveTimeout(timers[1].timer);
if (finishJob("Interrupted during poll", -1, -1) != EXIT_SUCCESS)
got = st->driver->streamRecv(st, buf + offset, want);
if (got < 0) {
if (got == -2 && !blocking) {
- usleep(20 * 1000);
+ g_usleep(20 * 1000);
goto reread;
}
virFilePrintf(stderr, "Failed to read stream: %s\n",
got = st->driver->streamSend(st, pattern + offset, want);
if (got < 0) {
if (got == -2 && !blocking) {
- usleep(20 * 1000);
+ g_usleep(20 * 1000);
goto rewrite;
}
if (i == 9 &&
break;
}
- usleep(500 * 1000);
+ g_usleep(500 * 1000);
}
/* print 100% completed */