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 | |
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
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | openbsd-compat/bsd-misc.c | 11 | ||||
-rw-r--r-- | openbsd-compat/bsd-misc.h | 6 |
4 files changed, 21 insertions, 3 deletions
@@ -2,6 +2,8 @@ - (djm) [configure.ac] Disable utmp, wtmp and/or lastlog if the platform is unable to successfully compile them. Based on patch from des AT des.no + - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + Add a usleep replacement for platforms that lack it; ok dtucker 20120312 - (dtucker) [regress/Makefile regress/cipher-speed.sh regress/test-exec.sh] diff --git a/configure.ac b/configure.ac index bf161b25..907192d6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.515 2013/03/14 23:23:07 djm Exp $ +# $Id: configure.ac,v 1.516 2013/03/14 23:34:25 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) -AC_REVISION($Revision: 1.515 $) +AC_REVISION($Revision: 1.516 $) AC_CONFIG_SRCDIR([ssh.c]) AC_LANG([C]) @@ -1604,6 +1604,7 @@ AC_CHECK_FUNCS([ \ unsetenv \ updwtmpx \ user_from_uid \ + usleep \ vasprintf \ vhangup \ vsnprintf \ 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) diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index de836738..43006637 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -1,4 +1,4 @@ -/* $Id: bsd-misc.h,v 1.22 2013/02/15 00:41:36 dtucker Exp $ */ +/* $Id: bsd-misc.h,v 1.23 2013/03/14 23:34:27 djm Exp $ */ /* * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> @@ -80,6 +80,10 @@ struct timespec { int nanosleep(const struct timespec *, struct timespec *); #endif +#ifndef HAVE_USLEEP +int usleep(unsigned int useconds); +#endif + #ifndef HAVE_TCGETPGRP pid_t tcgetpgrp(int); #endif |