avoid exporting a sleep() symbol from libcrypto

Since it seems only MSVC lacks sleep(), and it's only used by apps, lets
special-case that and make it available as a static inline function
instead.
This commit is contained in:
Brent Cook 2020-04-14 22:29:37 -05:00
parent ceeb3bb4f4
commit 79f2a52a39
3 changed files with 7 additions and 8 deletions

View File

@ -808,7 +808,6 @@ if(WIN32)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write) set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt) set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt) set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} sleep)
endif() endif()
if(NOT HAVE_ASPRINTF) if(NOT HAVE_ASPRINTF)

View File

@ -242,10 +242,4 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
return 0; return 0;
} }
unsigned int sleep(unsigned int seconds)
{
Sleep(seconds * 1000);
return seconds;
}
#endif #endif

View File

@ -37,7 +37,13 @@ ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
#define access _access #define access _access
unsigned int sleep(unsigned int seconds); #ifdef _MSC_VER
static inline unsigned int sleep(unsigned int seconds)
{
Sleep(seconds * 1000);
return seconds;
}
#endif
int ftruncate(int fd, off_t length); int ftruncate(int fd, off_t length);
uid_t getuid(void); uid_t getuid(void);