diff options
author | Robert Griebl <rgriebl@trolltech.com> | 2009-07-14 12:56:27 (GMT) |
---|---|---|
committer | Robert Griebl <rgriebl@trolltech.com> | 2009-07-14 13:16:16 (GMT) |
commit | 93db2c44b7b01eb08ef6f447d4a84198b2dcd1e3 (patch) | |
tree | 2e27c4a17b82d05630ddaa10b2ab09bf97c27c58 /src/network/socket/qnet_unix_p.h | |
parent | 67e52d5b57e604ba82351b8edb038a5adbaf8c5a (diff) | |
download | Qt-93db2c44b7b01eb08ef6f447d4a84198b2dcd1e3.zip Qt-93db2c44b7b01eb08ef6f447d4a84198b2dcd1e3.tar.gz Qt-93db2c44b7b01eb08ef6f447d4a84198b2dcd1e3.tar.bz2 |
Socket function cleanup: replacing direct POSIX calls with qt_safe_().
Reviewed-By: Thiago
Diffstat (limited to 'src/network/socket/qnet_unix_p.h')
-rw-r--r-- | src/network/socket/qnet_unix_p.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 392c1e2..b33d225 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -59,6 +59,12 @@ #include <sys/socket.h> #include <netinet/in.h> +// for inet_addr +#include <netdb.h> +#include <arpa/inet.h> +#include <resolv.h> + + QT_BEGIN_NAMESPACE // Almost always the same. If not, specify in qplatformdefs.h. @@ -148,6 +154,28 @@ static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SO # undef listen #endif +template <typename T> +static inline int qt_safe_ioctl(int sockfd, int request, T arg) +{ + return ::ioctl(sockfd, request, arg); +} + +static inline in_addr_t qt_safe_inet_addr(const char *cp) +{ + return ::inet_addr(cp); +} + +static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *to, QT_SOCKLEN_T tolen) +{ +#ifdef MSG_NOSIGNAL + flags |= MSG_NOSIGNAL; +#endif + + register int ret; + EINTR_LOOP(ret, ::sendto(sockfd, buf, len, flags, to, tolen)); + return ret; +} + QT_END_NAMESPACE #endif // QNET_UNIX_P_H |