aboutsummaryrefslogtreecommitdiff
path: root/include/compat
diff options
context:
space:
mode:
Diffstat (limited to 'include/compat')
-rw-r--r--include/compat/endian.h8
-rw-r--r--include/compat/stdio.h12
-rw-r--r--include/compat/sys/stat.h8
-rw-r--r--include/compat/sys/time.h9
4 files changed, 35 insertions, 2 deletions
diff --git a/include/compat/endian.h b/include/compat/endian.h
index 5376c1a..af3664d 100644
--- a/include/compat/endian.h
+++ b/include/compat/endian.h
@@ -62,7 +62,7 @@
62#endif 62#endif
63#endif 63#endif
64 64
65#if defined(__APPLE__) && !defined(HAVE_ENDIAN_H) 65#if defined(__APPLE__)
66#include <libkern/OSByteOrder.h> 66#include <libkern/OSByteOrder.h>
67#define be16toh(x) OSSwapBigToHostInt16((x)) 67#define be16toh(x) OSSwapBigToHostInt16((x))
68#define htobe16(x) OSSwapHostToBigInt16((x)) 68#define htobe16(x) OSSwapHostToBigInt16((x))
@@ -74,7 +74,7 @@
74#define htobe64(x) OSSwapHostToBigInt64(x) 74#define htobe64(x) OSSwapHostToBigInt64(x)
75#define le64toh(x) OSSwapLittleToHostInt64(x) 75#define le64toh(x) OSSwapLittleToHostInt64(x)
76#define be64toh(x) OSSwapBigToHostInt64(x) 76#define be64toh(x) OSSwapBigToHostInt64(x)
77#endif /* __APPLE__ && !HAVE_ENDIAN_H */ 77#endif /* __APPLE__ */
78 78
79#if defined(_WIN32) && !defined(HAVE_ENDIAN_H) 79#if defined(_WIN32) && !defined(HAVE_ENDIAN_H)
80#include <winsock2.h> 80#include <winsock2.h>
@@ -101,6 +101,8 @@
101#endif 101#endif
102 102
103#define htobe64(x) ntohll((x)) 103#define htobe64(x) ntohll((x))
104#define htole64(x) (x)
105#define le64toh(x) (x)
104#endif /* _WIN32 && !HAVE_ENDIAN_H */ 106#endif /* _WIN32 && !HAVE_ENDIAN_H */
105 107
106#ifdef __linux__ 108#ifdef __linux__
@@ -151,6 +153,8 @@
151#define htole32(x) LE_32(x) 153#define htole32(x) LE_32(x)
152#define htobe32(x) BE_32(x) 154#define htobe32(x) BE_32(x)
153#define be64toh(x) BE_64(x) 155#define be64toh(x) BE_64(x)
156#define le64toh(x) LE_64(x)
157#define htole64(x) LE_64(x)
154#define htobe64(x) BE_64(x) 158#define htobe64(x) BE_64(x)
155#endif 159#endif
156 160
diff --git a/include/compat/stdio.h b/include/compat/stdio.h
index 2af8f3e..2ccdeeb 100644
--- a/include/compat/stdio.h
+++ b/include/compat/stdio.h
@@ -18,6 +18,18 @@
18#include_next <stdio.h> 18#include_next <stdio.h>
19#endif 19#endif
20 20
21#ifndef HAVE_GETDELIM
22#include <sys/types.h>
23#define getdelim libressl_getdelim
24ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp);
25#endif
26
27#ifndef HAVE_GETLINE
28#include <sys/types.h>
29#define getline libressl_getline
30ssize_t getline(char **buf, size_t *bufsiz, FILE *fp);
31#endif
32
21#ifndef HAVE_ASPRINTF 33#ifndef HAVE_ASPRINTF
22#include <stdarg.h> 34#include <stdarg.h>
23#define vasprintf libressl_vasprintf 35#define vasprintf libressl_vasprintf
diff --git a/include/compat/sys/stat.h b/include/compat/sys/stat.h
index b88da1d..57aa521 100644
--- a/include/compat/sys/stat.h
+++ b/include/compat/sys/stat.h
@@ -118,4 +118,12 @@
118 118
119#endif 119#endif
120 120
121#ifdef _WIN32
122int libressl_fstat(int fd, struct stat *statbuf);
123
124#ifndef NO_REDEF_POSIX_FUNCTIONS
125#define fstat(fd, statbuf) libressl_fstat(fd, statbuf)
126#endif
127#endif
128
121#endif 129#endif
diff --git a/include/compat/sys/time.h b/include/compat/sys/time.h
index 76428c1..2448969 100644
--- a/include/compat/sys/time.h
+++ b/include/compat/sys/time.h
@@ -8,6 +8,15 @@
8 8
9#ifdef _MSC_VER 9#ifdef _MSC_VER
10#include <winsock2.h> 10#include <winsock2.h>
11
12#define timeval libressl_timeval
13#define gettimeofday libressl_gettimeofday
14
15struct timeval {
16 long long tv_sec;
17 long tv_usec;
18};
19
11int gettimeofday(struct timeval *tp, void *tzp); 20int gettimeofday(struct timeval *tp, void *tzp);
12#else 21#else
13#include_next <sys/time.h> 22#include_next <sys/time.h>