summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnet_unix_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket/qnet_unix_p.h')
-rw-r--r--src/network/socket/qnet_unix_p.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index 392c1e2..03ed3b4 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.
@@ -132,7 +138,8 @@ static inline int qt_safe_listen(int s, int backlog)
static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SOCKLEN_T addrlen)
{
register int ret;
- EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, addr, addrlen));
+ // Solaris e.g. expects a non-const 2nd parameter
+ EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, const_cast<struct sockaddr *>(addr), addrlen));
return ret;
}
#undef QT_SOCKET_CONNECT
@@ -148,6 +155,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