#endif
-#if !defined(HAVE_SOCKETPAIR) && !defined(CURL_DISABLE_SOCKETPAIR)
+#ifndef CURL_DISABLE_SOCKETPAIR
+#ifdef HAVE_SOCKETPAIR
+int Curl_socketpair(int domain, int type, int protocol,
+ curl_socket_t socks[2], bool nonblocking)
+{
+#ifdef SOCK_NONBLOCK
+ type = nonblocking ? type | SOCK_NONBLOCK : type;
+#endif
+ if(socketpair(domain, type, protocol, socks))
+ return -1;
+#ifndef SOCK_NONBLOCK
+ if(nonblocking) {
+ if(curlx_nonblock(socks[0], TRUE) < 0 ||
+ curlx_nonblock(socks[1], TRUE) < 0) {
+ close(socks[0]);
+ close(socks[1]);
+ return -1;
+ }
+ }
+#endif
+ return 0;
+}
+#else /* !HAVE_SOCKETPAIR */
#ifdef _WIN32
/*
* This is a socketpair() implementation for Windows.
sclose(socks[1]);
return -1;
}
-#else
-int Curl_socketpair(int domain, int type, int protocol,
- curl_socket_t socks[2], bool nonblocking)
-{
-#ifdef SOCK_NONBLOCK
- type = nonblocking ? type | SOCK_NONBLOCK : type;
-#endif
- if(socketpair(domain, type, protocol, socks))
- return -1;
-#ifndef SOCK_NONBLOCK
- if(nonblocking) {
- if(curlx_nonblock(socks[0], TRUE) < 0 ||
- curlx_nonblock(socks[1], TRUE) < 0) {
- close(socks[0]);
- close(socks[1]);
- return -1;
- }
- }
#endif
- return 0;
-}
-#endif /* ! HAVE_SOCKETPAIR */
+#endif /* !CURL_DISABLE_SOCKETPAIR */
#include <curl/curl.h>
int Curl_pipe(curl_socket_t socks[2], bool nonblocking);
-#else /* HAVE_PIPE */
+#else /* !USE_EVENTFD && !HAVE_PIPE */
#define wakeup_write swrite
#define wakeup_read sread
#define wakeup_create(p,nb)\
Curl_socketpair(SOCKETPAIR_FAMILY, SOCKETPAIR_TYPE, 0, p, nb)
-#endif /* HAVE_PIPE */
+#endif /* USE_EVENTFD */
+#ifndef CURL_DISABLE_SOCKETPAIR
#include <curl/curl.h>
int Curl_socketpair(int domain, int type, int protocol,
curl_socket_t socks[2], bool nonblocking);
+#endif
+
#endif /* HEADER_CURL_SOCKETPAIR_H */