diff options
author | Damien Miller <djm@mindrot.org> | 2013-03-15 10:34:25 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-03-15 10:34:25 +1100 |
commit | f4db77d7668104c1237636781cfbd59ef30f79b0 (patch) | |
tree | 253b719c65b4ca1f94ea2da9e9ea1f249ce7fd66 /openbsd-compat/bsd-misc.c | |
parent | a2438bbd28eb35a8968d193ac89b30a90e96f719 (diff) |
- (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
Add a usleep replacement for platforms that lack it; ok dtucker
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 8dc7d02d..d75854e8 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) |