From f4db77d7668104c1237636781cfbd59ef30f79b0 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 15 Mar 2013 10:34:25 +1100 Subject: - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] Add a usleep replacement for platforms that lack it; ok dtucker --- openbsd-compat/bsd-misc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 8dc7d02d1..d75854e83 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -165,6 +165,17 @@ int nanosleep(const struct timespec *req, struct timespec *rem) } #endif +#if !defined(HAVE_USLEEP) +int usleep(unsigned int useconds) +{ + struct timespec ts; + + ts.tv_sec = useconds / 1000000; + ts.tv_nsec = (useconds % 1000000) * 1000; + return nanosleep(&ts, NULL); +} +#endif + #ifndef HAVE_TCGETPGRP pid_t tcgetpgrp(int fd) -- cgit v1.2.3