update autoconf for latest compat functions

This commit is contained in:
Brent Cook
2019-01-31 09:45:56 -06:00
parent 495a1b6316
commit a6d7ea9562
10 changed files with 107 additions and 19 deletions

View File

@@ -87,6 +87,7 @@ if HOST_WIN
-echo posix_write >> crypto_portable.sym
-echo posix_getsockopt >> crypto_portable.sym
-echo posix_setsockopt >> crypto_portable.sym
-echo getuid >> crypto_portable.sym
-grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp
-mv crypto_portable.sym.tmp crypto_portable.sym
endif
@@ -162,6 +163,15 @@ if !HAVE_GETPAGESIZE
libcompat_la_SOURCES += compat/getpagesize.c
endif
if !HAVE_GETPROGNAME
if HOST_LINUX
libcompat_la_SOURCES += compat/getprogname_linux.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/getprogname_windows.c
endif
endif
if !HAVE_TIMEGM
libcompat_la_SOURCES += compat/timegm.c
endif
@@ -174,6 +184,10 @@ if !HAVE_RECALLOCARRAY
libcompat_la_SOURCES += compat/recallocarray.c
endif
if !HAVE_SYSLOG_R
libcompat_la_SOURCES += compat/syslog_r.c
endif
if !HAVE_TIMINGSAFE_MEMCMP
libcompat_la_SOURCES += compat/timingsafe_memcmp.c
endif

View File

@@ -0,0 +1,9 @@
#include <stdlib.h>
#include <errno.h>
const char *
getprogname(void)
{
return program_invocation_short_name;
}

View File

@@ -0,0 +1,13 @@
#include <stdlib.h>
#include <windows.h>
const char *
getprogname(void)
{
static char progname[MAX_PATH + 1];
DWORD length = GetModuleFileName(NULL, progname, sizeof (progname) - 1);
if (length < 0)
return "?";
return progname;
}

View File

@@ -4,6 +4,7 @@
* BSD socket emulation code for Winsock2
* File IO compatibility shims
* Brent Cook <bcook@openbsd.org>
* Kinichiro Inoguchi <inoguchi@openbsd.org>
*/
#define NO_REDEF_POSIX_FUNCTIONS
@@ -208,6 +209,12 @@ posix_setsockopt(int sockfd, int level, int optname,
return rc == 0 ? 0 : wsa_errno(WSAGetLastError());
}
uid_t getuid(void)
{
/* Windows fstat sets 0 as st_uid */
return 0;
}
#ifdef _MSC_VER
struct timezone;
int gettimeofday(struct timeval * tp, struct timezone * tzp)

19
crypto/compat/syslog_r.c Normal file
View File

@@ -0,0 +1,19 @@
#include <syslog.h>
void
syslog_r(int pri, struct syslog_data *data, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsyslog_r(pri, data, fmt, ap);
va_end(ap);
}
void
vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap)
{
#ifdef HAVE_SYSLOG
vsyslog(pri, fmt, ap);
#endif
}