QNativeSocketEngine: add sendmsg(), recvmsg() wrappers on unix

These functions are useful to pass ancillary data such as extended
errors, IP options, protocol control information.

Change-Id: I27574f73a60909c7199027160ca4689511e56b72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alex Trotsenko 2015-04-27 09:00:38 +03:00
parent 05f8c8c719
commit 737eccf1ef

View File

@ -193,6 +193,32 @@ static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int fl
return ret;
}
static inline int qt_safe_recvmsg(int sockfd, struct msghdr *msg, int flags)
{
int ret;
EINTR_LOOP(ret, ::recvmsg(sockfd, msg, 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