Path: blob/main/contrib/libfido2/openbsd-compat/posix_win.h
39536 views
/*1* Public domain2*3* BSD socket emulation code for Winsock24* Brent Cook <[email protected]>5*/67#ifndef _COMPAT_POSIX_WIN_H8#define _COMPAT_POSIX_WIN_H910#ifdef _WIN321112#include <windows.h>1314#include <errno.h>15#include <stdarg.h>16#include <stdint.h>17#include <stdio.h>18#include <stdlib.h>19#include <string.h>2021#if _MSC_VER >= 190022#include <../ucrt/fcntl.h>23#else24#include <../include/fcntl.h>25#endif2627#include "types.h"2829int posix_open(const char *path, ...);3031int posix_close(int fd);3233ssize_t posix_read(int fd, void *buf, size_t count);3435ssize_t posix_write(int fd, const void *buf, size_t count);3637#ifndef NO_REDEF_POSIX_FUNCTIONS38#define open(path, ...) posix_open(path, __VA_ARGS__)39#define close(fd) posix_close(fd)40#define read(fd, buf, count) posix_read(fd, buf, count)41#define write(fd, buf, count) posix_write(fd, buf, count)42#endif4344#endif /* _WIN32 */4546#endif /* !_COMPAT_POSIX_WIN_H */474849