]> git.meshlink.io Git - catta/blobdiff - src/compat/windows/wincompat.h
add an alias for poll and implement pipe in terms of sockets
[catta] / src / compat / windows / wincompat.h
index f76dbc4835a1012160d863060f2928dda145ce82..c736f75f938dc03868c75accbad1354239e21d37 100644 (file)
@@ -77,6 +77,20 @@ ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
 #endif
 
 
+// Windows doesn't have ioctl but offers ioctlsocket for some socket-related
+// functions. Unfortunately, argument types differ, so we implement a
+// (restricted) wrapper.
+int ioctl(int d, unsigned long request, int *p);
+
+
+// Windows lacks poll, but WSAPoll is good enough for us.
+#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout)
+
+// Windows lacks pipe. It has an equivalent CreatePipe but we really need
+// something to give to WSAPoll, so we fake it with a local TCP socket. (ugh)
+int pipe(int pipefd[2]);
+
+
 // Windows logically doesn't have uname, so we supply a replacement.
 
 struct utsname {