]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
djgpp: Use usleep() for ossl_sleep()
authorJ.W. Jagersma <jwjagersma@gmail.com>
Sun, 25 Sep 2022 17:04:31 +0000 (19:04 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 29 Sep 2022 10:00:30 +0000 (12:00 +0200)
This part failed to compile due to a circular dependency between
internal/e_os.h and internal/time.h, when ossl_sleep() falls back to a
busy wait.  However, djgpp has a usleep function, so it can use the
regular Unix version of ossl_sleep().

It's not great though.  The resolution is only ~55ms, and it may break
when a user program hooks the timer interrupt without periodically
updating BIOS time.  A high-resolution alternative is uclock(), but
that is generally less desirable since it reprograms the system timer.

The circular dependency is still there and may still cause trouble for
other platforms.

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19274)

include/internal/e_os.h

index 8b0c3a933c65c0ab5006648ef8953800f80ebbd2..059fae40404f0713c24a4e2f657439d09f3f697b 100644 (file)
@@ -287,7 +287,7 @@ struct servent *getservbyname(const char *name, const char *proto);
 /* end vxworks */
 
 /* system-specific variants defining ossl_sleep() */
-#ifdef OPENSSL_SYS_UNIX
+#if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__)
 # include <unistd.h>
 static ossl_inline void ossl_sleep(unsigned long millis)
 {