From 96272aea960da9d6c6a48b5cb3a37ba26fa0b3a2 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Tue, 3 Oct 2017 14:28:53 +0300 Subject: [PATCH] [platform lib][posix][windows] base i/o support, w/o networking --- klib/src/platform/windows/posix.def | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/klib/src/platform/windows/posix.def b/klib/src/platform/windows/posix.def index aad70b460a5..f6a44bcbe64 100644 --- a/klib/src/platform/windows/posix.def +++ b/klib/src/platform/windows/posix.def @@ -1,3 +1,31 @@ package = platform.posix -headers = stdio.h +headers = stdio.h Windef.h Winsock2.h Ws2tcpip.h Ws2def.h io.h compilerOpts = -DUNICODE -Wno-incompatible-pointer-types -Wno-deprecated-declarations +linkerOpts = -lWs2_32 + +--- +// Wrapper to access errno variable. +static int posix_errno() { + return errno; +} + +// Wrapper to access h_errno variable. +static int posix_h_errno() { + return h_errno; +} + +static short posix_htons(short x) { + return htons(x); +} + +static void posix_FD_ZERO(fd_set *set) { + FD_ZERO(set); +} + +static void posix_FD_SET(int bit, fd_set *set) { + FD_SET(bit, set); +} + +static int posix_FD_ISSET(int bit, fd_set *set) { + return FD_ISSET(bit, set); +} \ No newline at end of file