1 #ifndef NIXIO_MINGW_COMPAT_H_
2 #define NIXIO_MINGW_COMPAT_H_
12 typedef unsigned int uint
;
13 typedef unsigned long ulong
;
18 #define EWOULDBLOCK WSAEWOULDBLOCK
19 #define EAFNOSUPPORT WSAEAFNOSUPPORT
20 #define ENOPROTOOPT WSAENOPROTOOPT
22 #define SHUT_RD SD_RECEIVE
23 #define SHUT_WR SD_SEND
24 #define SHUT_RDWR SD_BOTH
26 #define pipe(fds) _pipe(fds, 65536, 0)
30 #define lstat _stati64
31 #define fstat _fstati64
38 int nixio__mgw_lockf(int fd
, int cmd
, off_t len
);
39 #define lockf nixio__mgw_lockf
41 const char* nixio__mgw_inet_ntop
42 (int af
, const void *src
, char *dst
, socklen_t size
);
43 #define inet_ntop nixio__mgw_inet_ntop
45 int nixio__mgw_inet_pton (int af
, const char *src
, void *dst
);
46 #define inet_pton nixio__mgw_inet_pton
61 int nixio__mgw_poll(struct pollfd
*fds
, nfds_t nfds
, int timeout
);
62 #define poll nixio__mgw_poll
70 int nixio__mgw_nanosleep(const struct timespec
*req
, struct timespec
*rem
);
71 #define nanosleep nixio__mgw_nanosleep
74 char* nixio__mgw_realpath(const char *path
, char *resolved
);
75 #define realpath nixio__mgw_realpath
78 int nixio__mgw_link(const char *oldpath
, const char *newpath
);
79 #define link nixio__mgw_link
82 int nixio__mgw_utimes(const char *filename
, const struct timeval times
[2]);
83 #define utimes nixio__mgw_utimes
86 #define setenv(k, v, o) !SetEnvironmentVariable(k, v)
87 #define unsetenv(k) !SetEnvironmentVariable(k, NULL)
89 #define execv(p, a) execv(p, (const char* const*)a)
90 #define execvp(p, a) execvp(p, (const char* const*)a)
91 #define execve(p, a, e) execve(p, (const char* const*)a, (const char* const*)e)
93 #define mkdir(p, m) mkdir(p)
96 #define nixio__perror_s(L) \
97 errno = WSAGetLastError(); \
98 return nixio__perror(L);
100 #define nixio__pstatus_s(L, c) \
101 errno = WSAGetLastError(); \
102 return nixio__pstatus(L, c);
106 #define NIXIO_WSA_CONSTANT(x) \
107 lua_pushinteger(L, x); \
108 lua_setfield(L, -2, #x+3);
110 void nixio_open__mingw(lua_State
*L
);
112 #endif /* NIXIO_MINGW_COMPAT_H_ */