summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnet_unix_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-10 15:09:29 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-08-22 22:26:30 +0000
commitef05ad0ac500c10b1a3ae254d8a07968d6cf0c9e (patch)
treef2545760293240883c22bffe71d4fab48484dfc5 /src/network/socket/qnet_unix_p.h
parent5b38454714fdbf8d4acffe482aaa32b91a4b5d98 (diff)
QNativeSocketEngine: use sendmsg/recvmsg instead of sendto/recvfrom
We'll need to use these functions instead of the ones we're currently using in order to access the ancillary data. Note that on Windows the two functions aren't globals, but must be obtained via ioctl, which means they can fail. If they do, we fall back to using WSARecvFrom/WSASendTo Change-Id: Iee8cbc07c4434ce9b560ffff13ca4284acd24132 Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/socket/qnet_unix_p.h')
-rw-r--r--src/network/socket/qnet_unix_p.h27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index a5a87fc7c1..9626c53711 100644
--- a/src/network/socket/qnet_unix_p.h
+++ b/src/network/socket/qnet_unix_p.h
@@ -173,8 +173,7 @@ static inline in_addr_t qt_safe_inet_addr(const char *cp)
#endif
}
-// VxWorks' headers do not specify any const modifiers
-static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *to, QT_SOCKLEN_T tolen)
+static inline int qt_safe_sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
#ifdef MSG_NOSIGNAL
flags |= MSG_NOSIGNAL;
@@ -183,11 +182,7 @@ static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int fl
#endif
int ret;
-#ifdef Q_OS_VXWORKS
- EINTR_LOOP(ret, ::sendto(sockfd, (char *) buf, len, flags, (struct sockaddr *) to, tolen));
-#else
- EINTR_LOOP(ret, ::sendto(sockfd, buf, len, flags, to, tolen));
-#endif
+ EINTR_LOOP(ret, ::sendmsg(sockfd, msg, flags));
return ret;
}
@@ -199,24 +194,6 @@ static inline int qt_safe_recvmsg(int sockfd, struct msghdr *msg, int flags)
return ret;
}
-// VxWorks' headers do not specify any const modifiers
-static inline int qt_safe_sendmsg(int sockfd, const struct msghdr *msg, int flags)
-{
-#ifdef MSG_NOSIGNAL
- flags |= MSG_NOSIGNAL;
-#else
- qt_ignore_sigpipe();
-#endif
-
- int ret;
-#ifdef Q_OS_VXWORKS
- EINTR_LOOP(ret, ::sendmsg(sockfd, (struct msghdr *) msg, flags);
-#else
- EINTR_LOOP(ret, ::sendmsg(sockfd, msg, flags));
-#endif
- return ret;
-}
-
QT_END_NAMESPACE
#endif // QNET_UNIX_P_H