From c79050aa44b8836d836c5dd22a383a073c28b74b Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 12 Feb 2020 13:42:22 +0100 Subject: Import upstream release 1.3.0 Closes: #951184 --- openbsd-compat/posix_win.h | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 openbsd-compat/posix_win.h (limited to 'openbsd-compat/posix_win.h') diff --git a/openbsd-compat/posix_win.h b/openbsd-compat/posix_win.h new file mode 100644 index 0000000..a1e0888 --- /dev/null +++ b/openbsd-compat/posix_win.h @@ -0,0 +1,47 @@ +/* + * Public domain + * + * BSD socket emulation code for Winsock2 + * Brent Cook + */ + +#ifndef _COMPAT_POSIX_WIN_H +#define _COMPAT_POSIX_WIN_H + +#ifdef _WIN32 + +#include + +#include +#include +#include +#include +#include +#include + +#if _MSC_VER >= 1900 +#include <../ucrt/fcntl.h> +#else +#include <../include/fcntl.h> +#endif + +#include "types.h" + +int posix_open(const char *path, ...); + +int posix_close(int fd); + +ssize_t posix_read(int fd, void *buf, size_t count); + +ssize_t posix_write(int fd, const void *buf, size_t count); + +#ifndef NO_REDEF_POSIX_FUNCTIONS +#define open(path, ...) posix_open(path, __VA_ARGS__) +#define close(fd) posix_close(fd) +#define read(fd, buf, count) posix_read(fd, buf, count) +#define write(fd, buf, count) posix_write(fd, buf, count) +#endif + +#endif /* _WIN32 */ + +#endif /* !_COMPAT_POSIX_WIN_H */ -- cgit v1.2.3