The usleep function was missing on older mingw versions, but we can rely
on it existing everywhere these days. It may only support times upto 1
second in duration though, so we'll prefer to use g_usleep instead.
The commandhelper program is not changed since that can't link to glib.
Fortunately it doesn't need to build on Windows platforms either.
Signed-off-by: Daniel P. Berrangé
---
bootstrap.conf | 1 -
src/hyperv/hyperv_driver.c | 2 +-
src/hyperv/hyperv_wmi.c | 4 ++--
src/locking/lock_daemon.c | 2 +-
src/locking/lock_driver_sanlock.c | 2 +-
src/lxc/lxc_controller.c| 2 +-
src/lxc/lxc_driver.c| 2 +-
src/lxc/lxc_process.c | 2 +-
src/network/bridge_driver.c | 2 +-
src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++--
src/nwfilter/nwfilter_learnipaddr.c | 2 +-
src/qemu/qemu_monitor_json.c| 2 +-
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_tpm.c | 2 +-
src/rpc/virnetsocket.c | 2 +-
src/security/security_manager.c | 2 +-
src/storage/storage_util.c | 4 ++--
src/util/vircgroup.c| 2 +-
src/util/virfile.c | 2 +-
src/util/virnetdev.c| 2 +-
src/util/virnetdevip.c | 2 +-
src/util/virnetdevmacvlan.c | 2 +-
src/util/virnetdevvportprofile.c| 2 +-
src/util/virpci.c | 8
src/util/virprocess.c | 4 ++--
src/util/virtime.c | 2 +-
src/vbox/vbox_common.c | 2 +-
tests/commandtest.c | 6 +++---
tests/eventtest.c | 4 ++--
tests/fdstreamtest.c| 4 ++--
tools/virsh-domain.c| 2 +-
31 files changed, 41 insertions(+), 42 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 241dce50c2..1b5a68b873 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -90,7 +90,6 @@ timegm
ttyname_r
uname
unsetenv
-usleep
verify
vsnprintf
waitpid
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 0e2c6c55ef..ceaf528dd3 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1415,7 +1415,7 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int
codeset,
/* simulate holdtime by sleeping */
if (holdtime > 0)
-usleep(holdtime * 1000);
+g_usleep(holdtime * 1000);
/* release the keys */
for (i = 0; i < nkeycodes; i++) {
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 0f39bd4431..c2c1f082e1 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -909,7 +909,7 @@ hypervInvokeMethod(hypervPrivate *priv,
hypervInvokeParamsListPtr params,
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:
@@ -1418,7 +1418,7 @@
hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
hypervFreeObject(priv, (hypervObject *)concreteJob);
concreteJob = NULL;
-usleep(100 * 1000);
+g_usleep(100 * 1000);
continue;
case MSVM_CONCRETEJOB_JOBSTATE_COMPLETED:
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index a5a3a97e99..c12cb4ea0f 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -657,7 +657,7 @@ virLockDaemonClientFree(void *opaque)
VIR_WARN("Failed to kill off pid %lld",
(unsigned long long)priv->clientPid);
}
-usleep(200 * 1000);
+g_usleep(200 * 1000);
}
}
}
diff --git a/src/locking/lock_driver_sanlock.c
b/src/locking/lock_driver_sanlock.c
index 85a23c7642..7ebd63913e 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -376,7 +376,7 @@
virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver)
#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;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 37851bf284..9097655b4d 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -574,7 +574,7 @@ static int
virLXCControllerAppendNBDPids(virLXCControllerPtr ctrl,
while (!virFileExists(pidpath)) {
/* wait for 100ms before checking again, but don't do it for ever */
if (e