diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-04-27 09:00:38 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2015-04-28 19:35:58 +0000 |
commit | 737eccf1ef3c0d8811aecdbccf8eead210e76335 (patch) | |
tree | 5ba68d92805a9ed60ca10155216f6548897929bc /src/network | |
parent | 05f8c8c71949878c7c1c698347f8f1e510c16b95 (diff) |
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>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/socket/qnet_unix_p.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 979afb82ba..cd118afd63 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -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 |