Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *port, QHostAddress *addr) | - |
5 | { | - |
6 | if (s->a.sa_family == 10) { evaluated: s->a.sa_family == 10 yes Evaluation Count:12296 | yes Evaluation Count:3240 |
| 3240-12296 |
7 | Q_IPV6ADDR tmp; | - |
8 | memcpy(&tmp, &s->a6.sin6_addr, sizeof(tmp)); | - |
9 | if (addr) { partially evaluated: addr yes Evaluation Count:12296 | no Evaluation Count:0 |
| 0-12296 |
10 | QHostAddress tmpAddress; | - |
11 | tmpAddress.setAddress(tmp); | - |
12 | *addr = tmpAddress; | - |
13 | | - |
14 | char scopeid[16]; | - |
15 | if (::if_indextoname(s->a6.sin6_scope_id, scopeid)) { evaluated: ::if_indextoname(s->a6.sin6_scope_id, scopeid) yes Evaluation Count:39 | yes Evaluation Count:12257 |
| 39-12257 |
16 | addr->setScopeId(QLatin1String(scopeid)); | - |
17 | } else executed: } Execution Count:39 | 39 |
18 | | - |
19 | addr->setScopeId(QString::number(s->a6.sin6_scope_id)); executed: addr->setScopeId(QString::number(s->a6.sin6_scope_id)); Execution Count:12257 | 12257 |
20 | } | - |
21 | if (port) partially evaluated: port yes Evaluation Count:12296 | no Evaluation Count:0 |
| 0-12296 |
22 | *port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (s->a6.sin6_port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); executed: *port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (s->a6.sin6_port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); Execution Count:12296 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:12296 |
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:12296 | 0-12296 |
23 | return; executed: return; Execution Count:12296 | 12296 |
24 | } | - |
25 | | - |
26 | if (port) partially evaluated: port yes Evaluation Count:3240 | no Evaluation Count:0 |
| 0-3240 |
27 | *port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (s->a4.sin_port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:3240 |
executed: *port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (s->a4.sin_port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); Execution Count:3240 never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:3240 | 0-3240 |
28 | if (addr) { partially evaluated: addr yes Evaluation Count:3240 | no Evaluation Count:0 |
| 0-3240 |
29 | QHostAddress tmpAddress; | - |
30 | tmpAddress.setAddress((__extension__ ({ register unsigned int __v, __x = (s->a4.sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; }))); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:3240 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:3240 |
never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); | 0-3240 |
31 | *addr = tmpAddress; | - |
32 | } executed: } Execution Count:3240 | 3240 |
33 | } executed: } Execution Count:3240 | 3240 |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, | - |
41 | QAbstractSocket::NetworkLayerProtocol &socketProtocol) | - |
42 | { | - |
43 | int protocol = (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) ? 10 : 2; evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:95 | yes Evaluation Count:2666 |
evaluated: socketProtocol == QAbstractSocket::AnyIPProtocol yes Evaluation Count:378 | yes Evaluation Count:2288 |
| 95-2666 |
44 | int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM; evaluated: (socketType == QAbstractSocket::UdpSocket) yes Evaluation Count:235 | yes Evaluation Count:2526 |
| 235-2526 |
45 | | - |
46 | int socket = qt_safe_socket(protocol, type, 0); | - |
47 | if (socket <= 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && (*__errno_location ()) == 97) { partially evaluated: socket <= 0 no Evaluation Count:0 | yes Evaluation Count:2761 |
never evaluated: socketProtocol == QAbstractSocket::AnyIPProtocol never evaluated: (*__errno_location ()) == 97 | 0-2761 |
48 | protocol = 2; | - |
49 | socket = qt_safe_socket(protocol, type, 0); | - |
50 | socketProtocol = QAbstractSocket::IPv4Protocol; | - |
51 | } | 0 |
52 | | - |
53 | if (socket <= 0) { partially evaluated: socket <= 0 no Evaluation Count:0 | yes Evaluation Count:2761 |
| 0-2761 |
54 | switch ((*__errno_location ())) { | - |
55 | case 93: | - |
56 | case 97: | - |
57 | case 22: | - |
58 | setError(QAbstractSocket::UnsupportedSocketOperationError, ProtocolUnsupportedErrorString); | - |
59 | break; | 0 |
60 | case 23: | - |
61 | case 24: | - |
62 | case 105: | - |
63 | case 12: | - |
64 | setError(QAbstractSocket::SocketResourceError, ResourceErrorString); | - |
65 | break; | 0 |
66 | case 13: | - |
67 | setError(QAbstractSocket::SocketAccessError, AccessErrorString); | - |
68 | break; | 0 |
69 | default: | - |
70 | break; | 0 |
71 | } | - |
72 | | - |
73 | return false; never executed: return false; | 0 |
74 | } | - |
75 | | - |
76 | socketDescriptor = socket; | - |
77 | return true; executed: return true; Execution Count:2761 | 2761 |
78 | } | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) const | - |
84 | { | - |
85 | const QNativeSocketEngine * const q = q_func(); | - |
86 | if (!q->isValid()) partially evaluated: !q->isValid() no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
87 | return -1; never executed: return -1; | 0 |
88 | | - |
89 | int n = -1; | - |
90 | int level = 1; | - |
91 | | - |
92 | switch (opt) { | - |
93 | case QNativeSocketEngine::ReceiveBufferSocketOption: | - |
94 | n = 8; | - |
95 | break; | 0 |
96 | case QNativeSocketEngine::SendBufferSocketOption: | - |
97 | n = 7; | - |
98 | break; | 0 |
99 | case QNativeSocketEngine::NonBlockingSocketOption: | - |
100 | break; | 0 |
101 | case QNativeSocketEngine::BroadcastSocketOption: | - |
102 | break; | 0 |
103 | case QNativeSocketEngine::AddressReusable: | - |
104 | n = 2; | - |
105 | break; | 0 |
106 | case QNativeSocketEngine::BindExclusively: | - |
107 | return true; never executed: return true; | 0 |
108 | case QNativeSocketEngine::ReceiveOutOfBandData: | - |
109 | n = 10; | - |
110 | break; | 0 |
111 | case QNativeSocketEngine::LowDelayOption: | - |
112 | level = IPPROTO_TCP; | - |
113 | n = 1; | - |
114 | break; | 0 |
115 | case QNativeSocketEngine::KeepAliveOption: | - |
116 | n = 9; | - |
117 | break; | 0 |
118 | case QNativeSocketEngine::MulticastTtlOption: | - |
119 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
120 | level = IPPROTO_IPV6; | - |
121 | n = 18; | - |
122 | } else executed: } Execution Count:6 | 6 |
123 | { | - |
124 | level = IPPROTO_IP; | - |
125 | n = 33; | - |
126 | } executed: } Execution Count:6 | 6 |
127 | break; executed: break; Execution Count:12 | 12 |
128 | case QNativeSocketEngine::MulticastLoopbackOption: | - |
129 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:7 | yes Evaluation Count:7 |
| 7 |
130 | level = IPPROTO_IPV6; | - |
131 | n = 19; | - |
132 | } else executed: } Execution Count:7 | 7 |
133 | { | - |
134 | level = IPPROTO_IP; | - |
135 | n = 34; | - |
136 | } executed: } Execution Count:7 | 7 |
137 | break; executed: break; Execution Count:14 | 14 |
138 | case QNativeSocketEngine::TypeOfServiceOption: | - |
139 | if (socketProtocol == QAbstractSocket::IPv4Protocol) { never evaluated: socketProtocol == QAbstractSocket::IPv4Protocol | 0 |
140 | level = IPPROTO_IP; | - |
141 | n = 1; | - |
142 | } | 0 |
143 | break; | 0 |
144 | } | - |
145 | | - |
146 | int v = -1; | - |
147 | socklen_t len = sizeof(v); | - |
148 | if (::getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1) partially evaluated: ::getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1 yes Evaluation Count:26 | no Evaluation Count:0 |
| 0-26 |
149 | return v; executed: return v; Execution Count:26 | 26 |
150 | | - |
151 | return -1; never executed: return -1; | 0 |
152 | } | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt, int v) | - |
159 | { | - |
160 | QNativeSocketEngine * const q = q_func(); | - |
161 | if (!q->isValid()) partially evaluated: !q->isValid() no Evaluation Count:0 | yes Evaluation Count:7277 |
| 0-7277 |
162 | return false; never executed: return false; | 0 |
163 | | - |
164 | int n = 0; | - |
165 | int level = 1; | - |
166 | | - |
167 | switch (opt) { | - |
168 | case QNativeSocketEngine::ReceiveBufferSocketOption: | - |
169 | n = 8; | - |
170 | break; | 0 |
171 | case QNativeSocketEngine::SendBufferSocketOption: | - |
172 | n = 7; | - |
173 | break; | 0 |
174 | case QNativeSocketEngine::BroadcastSocketOption: | - |
175 | n = 6; | - |
176 | break; executed: break; Execution Count:235 | 235 |
177 | case QNativeSocketEngine::NonBlockingSocketOption: { | - |
178 | | - |
179 | | - |
180 | int flags = ::fcntl(socketDescriptor, 3, 0); | - |
181 | if (flags == -1) { partially evaluated: flags == -1 no Evaluation Count:0 | yes Evaluation Count:3373 |
| 0-3373 |
182 | | - |
183 | | - |
184 | | - |
185 | return false; never executed: return false; | 0 |
186 | } | - |
187 | if (::fcntl(socketDescriptor, 4, flags | 04000) == -1) { partially evaluated: ::fcntl(socketDescriptor, 4, flags | 04000) == -1 no Evaluation Count:0 | yes Evaluation Count:3373 |
| 0-3373 |
188 | | - |
189 | | - |
190 | | - |
191 | return false; never executed: return false; | 0 |
192 | } | - |
193 | return true; executed: return true; Execution Count:3373 | 3373 |
194 | } | - |
195 | case QNativeSocketEngine::AddressReusable: | - |
196 | n = 2; | - |
197 | | - |
198 | break; executed: break; Execution Count:437 | 437 |
199 | case QNativeSocketEngine::BindExclusively: | - |
200 | return true; never executed: return true; | 0 |
201 | case QNativeSocketEngine::ReceiveOutOfBandData: | - |
202 | n = 10; | - |
203 | break; executed: break; Execution Count:2526 | 2526 |
204 | case QNativeSocketEngine::LowDelayOption: | - |
205 | level = IPPROTO_TCP; | - |
206 | n = 1; | - |
207 | break; executed: break; Execution Count:36 | 36 |
208 | case QNativeSocketEngine::KeepAliveOption: | - |
209 | n = 9; | - |
210 | break; executed: break; Execution Count:644 | 644 |
211 | case QNativeSocketEngine::MulticastTtlOption: | - |
212 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
213 | level = IPPROTO_IPV6; | - |
214 | n = 18; | - |
215 | } else executed: } Execution Count:6 | 6 |
216 | { | - |
217 | level = IPPROTO_IP; | - |
218 | n = 33; | - |
219 | } executed: } Execution Count:6 | 6 |
220 | break; executed: break; Execution Count:12 | 12 |
221 | case QNativeSocketEngine::MulticastLoopbackOption: | - |
222 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:7 | yes Evaluation Count:7 |
| 7 |
223 | level = IPPROTO_IPV6; | - |
224 | n = 19; | - |
225 | } else executed: } Execution Count:7 | 7 |
226 | { | - |
227 | level = IPPROTO_IP; | - |
228 | n = 34; | - |
229 | } executed: } Execution Count:7 | 7 |
230 | break; executed: break; Execution Count:14 | 14 |
231 | case QNativeSocketEngine::TypeOfServiceOption: | - |
232 | if (socketProtocol == QAbstractSocket::IPv4Protocol) { never evaluated: socketProtocol == QAbstractSocket::IPv4Protocol | 0 |
233 | level = IPPROTO_IP; | - |
234 | n = 1; | - |
235 | } | 0 |
236 | break; | 0 |
237 | } | - |
238 | | - |
239 | return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0; executed: return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0; Execution Count:3904 | 3904 |
240 | } | - |
241 | | - |
242 | bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port) | - |
243 | { | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | struct sockaddr_in sockAddrIPv4; | - |
249 | struct sockaddr *sockAddrPtr = 0; | - |
250 | socklen_t sockAddrSize = 0; | - |
251 | | - |
252 | struct sockaddr_in6 sockAddrIPv6; | - |
253 | | - |
254 | if (addr.protocol() == QAbstractSocket::IPv6Protocol) { evaluated: addr.protocol() == QAbstractSocket::IPv6Protocol yes Evaluation Count:29 | yes Evaluation Count:3259 |
| 29-3259 |
255 | memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); | - |
256 | sockAddrIPv6.sin6_family = 10; | - |
257 | sockAddrIPv6.sin6_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:29 |
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:29 | 0-29 |
258 | | - |
259 | QString scopeid = addr.scopeId(); | - |
260 | bool ok; | - |
261 | sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok); | - |
262 | | - |
263 | if (!ok) partially evaluated: !ok yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
264 | sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); executed: sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); Execution Count:29 | 29 |
265 | | - |
266 | Q_IPV6ADDR ip6 = addr.toIPv6Address(); | - |
267 | memcpy(&sockAddrIPv6.sin6_addr.__in6_u.__u6_addr8, &ip6, sizeof(ip6)); | - |
268 | | - |
269 | sockAddrSize = sizeof(sockAddrIPv6); | - |
270 | sockAddrPtr = (struct sockaddr *) &sockAddrIPv6; | - |
271 | } else executed: } Execution Count:29 | 29 |
272 | if (addr.protocol() == QAbstractSocket::IPv4Protocol) { partially evaluated: addr.protocol() == QAbstractSocket::IPv4Protocol yes Evaluation Count:3259 | no Evaluation Count:0 |
| 0-3259 |
273 | memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); | - |
274 | sockAddrIPv4.sin_family = 2; | - |
275 | sockAddrIPv4.sin_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:3259 |
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:3259 | 0-3259 |
276 | sockAddrIPv4.sin_addr.s_addr = (__extension__ ({ register unsigned int __v, __x = (addr.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:3259 |
never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:3259 | 0-3259 |
277 | | - |
278 | sockAddrSize = sizeof(sockAddrIPv4); | - |
279 | sockAddrPtr = (struct sockaddr *) &sockAddrIPv4; | - |
280 | } else { executed: } Execution Count:3259 | 3259 |
281 | | - |
282 | } | 0 |
283 | | - |
284 | int connectResult = qt_safe_connect(socketDescriptor, sockAddrPtr, sockAddrSize); | - |
285 | if (connectResult == -1) { evaluated: connectResult == -1 yes Evaluation Count:2097 | yes Evaluation Count:1191 |
| 1191-2097 |
286 | switch ((*__errno_location ())) { | - |
287 | case 106: | - |
288 | socketState = QAbstractSocket::ConnectedState; | - |
289 | break; | 0 |
290 | case 111: | - |
291 | case 22: | - |
292 | setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString); | - |
293 | socketState = QAbstractSocket::UnconnectedState; | - |
294 | break; executed: break; Execution Count:8 | 8 |
295 | case 110: | - |
296 | setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString); | - |
297 | break; | 0 |
298 | case 113: | - |
299 | setError(QAbstractSocket::NetworkError, HostUnreachableErrorString); | - |
300 | socketState = QAbstractSocket::UnconnectedState; | - |
301 | break; | 0 |
302 | case 101: | - |
303 | setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString); | - |
304 | socketState = QAbstractSocket::UnconnectedState; | - |
305 | break; executed: break; Execution Count:2 | 2 |
306 | case 98: | - |
307 | setError(QAbstractSocket::NetworkError, AddressInuseErrorString); | - |
308 | break; | 0 |
309 | case 115: | - |
310 | case 114: | - |
311 | setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString); | - |
312 | socketState = QAbstractSocket::ConnectingState; | - |
313 | break; executed: break; Execution Count:2087 | 2087 |
314 | case 11: | - |
315 | setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString); | - |
316 | break; | 0 |
317 | case 13: | - |
318 | case 1: | - |
319 | setError(QAbstractSocket::SocketAccessError, AccessErrorString); | - |
320 | socketState = QAbstractSocket::UnconnectedState; | - |
321 | break; | 0 |
322 | case 97: | - |
323 | case 9: | - |
324 | case 14: | - |
325 | case 88: | - |
326 | socketState = QAbstractSocket::UnconnectedState; | - |
327 | default: | - |
328 | break; | 0 |
329 | } | - |
330 | | - |
331 | if (socketState != QAbstractSocket::ConnectedState) { partially evaluated: socketState != QAbstractSocket::ConnectedState yes Evaluation Count:2097 | no Evaluation Count:0 |
| 0-2097 |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | return false; executed: return false; Execution Count:2097 | 2097 |
339 | } | - |
340 | } | 0 |
341 | | - |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | socketState = QAbstractSocket::ConnectedState; | - |
348 | return true; executed: return true; Execution Count:1191 | 1191 |
349 | } | - |
350 | | - |
351 | bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 port) | - |
352 | { | - |
353 | struct sockaddr_in sockAddrIPv4; | - |
354 | struct sockaddr *sockAddrPtr = 0; | - |
355 | socklen_t sockAddrSize = 0; | - |
356 | | - |
357 | | - |
358 | struct sockaddr_in6 sockAddrIPv6; | - |
359 | | - |
360 | if (address.protocol() == QAbstractSocket::IPv6Protocol || address.protocol() == QAbstractSocket::AnyIPProtocol) { evaluated: address.protocol() == QAbstractSocket::IPv6Protocol yes Evaluation Count:79 | yes Evaluation Count:590 |
evaluated: address.protocol() == QAbstractSocket::AnyIPProtocol yes Evaluation Count:379 | yes Evaluation Count:211 |
| 79-590 |
361 | | - |
362 | int ipv6only = 0; | - |
363 | if (address.protocol() == QAbstractSocket::IPv6Protocol) evaluated: address.protocol() == QAbstractSocket::IPv6Protocol yes Evaluation Count:79 | yes Evaluation Count:379 |
| 79-379 |
364 | ipv6only = 1; executed: ipv6only = 1; Execution Count:79 | 79 |
365 | | - |
366 | ::setsockopt(socketDescriptor, IPPROTO_IPV6, 26, (char*)&ipv6only, sizeof(ipv6only) ); | - |
367 | | - |
368 | memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); | - |
369 | sockAddrIPv6.sin6_family = 10; | - |
370 | sockAddrIPv6.sin6_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:458 |
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:458 | 0-458 |
371 | | - |
372 | sockAddrIPv6.sin6_scope_id = ::if_nametoindex(address.scopeId().toLatin1().data()); | - |
373 | | - |
374 | | - |
375 | | - |
376 | Q_IPV6ADDR tmp = address.toIPv6Address(); | - |
377 | memcpy(&sockAddrIPv6.sin6_addr.__in6_u.__u6_addr8, &tmp, sizeof(tmp)); | - |
378 | sockAddrSize = sizeof(sockAddrIPv6); | - |
379 | sockAddrPtr = (struct sockaddr *) &sockAddrIPv6; | - |
380 | } else executed: } Execution Count:458 | 458 |
381 | if (address.protocol() == QAbstractSocket::IPv4Protocol) { partially evaluated: address.protocol() == QAbstractSocket::IPv4Protocol yes Evaluation Count:211 | no Evaluation Count:0 |
| 0-211 |
382 | memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); | - |
383 | sockAddrIPv4.sin_family = 2; | - |
384 | sockAddrIPv4.sin_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:211 |
never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:211 | 0-211 |
385 | sockAddrIPv4.sin_addr.s_addr = (__extension__ ({ register unsigned int __v, __x = (address.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:211 |
never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:211 | 0-211 |
386 | sockAddrSize = sizeof(sockAddrIPv4); | - |
387 | sockAddrPtr = (struct sockaddr *) &sockAddrIPv4; | - |
388 | } else { executed: } Execution Count:211 | 211 |
389 | | - |
390 | } | 0 |
391 | | - |
392 | int bindResult = ::bind(socketDescriptor, sockAddrPtr, sockAddrSize); | - |
393 | if (bindResult < 0 && (*__errno_location ()) == 97 && address.protocol() == QAbstractSocket::AnyIPProtocol) { evaluated: bindResult < 0 yes Evaluation Count:11 | yes Evaluation Count:658 |
partially evaluated: (*__errno_location ()) == 97 no Evaluation Count:0 | yes Evaluation Count:11 |
never evaluated: address.protocol() == QAbstractSocket::AnyIPProtocol | 0-658 |
394 | memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); | - |
395 | sockAddrIPv4.sin_family = 2; | - |
396 | sockAddrIPv4.sin_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); never evaluated: __builtin_constant_p (__x) never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); never executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); | 0 |
397 | sockAddrIPv4.sin_addr.s_addr = (__extension__ ({ register unsigned int __v, __x = (address.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); never evaluated: __builtin_constant_p (__x) never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); never executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); | 0 |
398 | sockAddrSize = sizeof(sockAddrIPv4); | - |
399 | sockAddrPtr = (struct sockaddr *) &sockAddrIPv4; | - |
400 | bindResult = ::bind(socketDescriptor, sockAddrPtr, sockAddrSize); | - |
401 | } | 0 |
402 | | - |
403 | if (bindResult < 0) { evaluated: bindResult < 0 yes Evaluation Count:11 | yes Evaluation Count:658 |
| 11-658 |
404 | switch((*__errno_location ())) { | - |
405 | case 98: | - |
406 | setError(QAbstractSocket::AddressInUseError, AddressInuseErrorString); | - |
407 | break; executed: break; Execution Count:10 | 10 |
408 | case 13: | - |
409 | setError(QAbstractSocket::SocketAccessError, AddressProtectedErrorString); | - |
410 | break; | 0 |
411 | case 22: | - |
412 | setError(QAbstractSocket::UnsupportedSocketOperationError, OperationUnsupportedErrorString); | - |
413 | break; | 0 |
414 | case 99: | - |
415 | setError(QAbstractSocket::SocketAddressNotAvailableError, AddressNotAvailableErrorString); | - |
416 | break; executed: break; Execution Count:1 | 1 |
417 | default: | - |
418 | break; | 0 |
419 | } | - |
420 | | - |
421 | | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | return false; executed: return false; Execution Count:11 | 11 |
427 | } | - |
428 | | - |
429 | localPort = port; | - |
430 | localAddress = address; | - |
431 | | - |
432 | | - |
433 | | - |
434 | | - |
435 | | - |
436 | socketState = QAbstractSocket::BoundState; | - |
437 | return true; executed: return true; Execution Count:658 | 658 |
438 | } | - |
439 | | - |
440 | bool QNativeSocketEnginePrivate::nativeListen(int backlog) | - |
441 | { | - |
442 | if (qt_safe_listen(socketDescriptor, backlog) < 0) { partially evaluated: qt_safe_listen(socketDescriptor, backlog) < 0 no Evaluation Count:0 | yes Evaluation Count:425 |
| 0-425 |
443 | switch ((*__errno_location ())) { | - |
444 | case 98: | - |
445 | setError(QAbstractSocket::AddressInUseError, | - |
446 | PortInuseErrorString); | - |
447 | break; | 0 |
448 | default: | - |
449 | break; | 0 |
450 | } | - |
451 | | - |
452 | | - |
453 | | - |
454 | | - |
455 | | - |
456 | return false; never executed: return false; | 0 |
457 | } | - |
458 | | - |
459 | | - |
460 | | - |
461 | | - |
462 | | - |
463 | socketState = QAbstractSocket::ListeningState; | - |
464 | return true; executed: return true; Execution Count:425 | 425 |
465 | } | - |
466 | | - |
467 | int QNativeSocketEnginePrivate::nativeAccept() | - |
468 | { | - |
469 | int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0); | - |
470 | if (acceptedDescriptor == -1) { evaluated: acceptedDescriptor == -1 yes Evaluation Count:455 | yes Evaluation Count:465 |
| 455-465 |
471 | switch ((*__errno_location ())) { | - |
472 | case 9: | - |
473 | case 95: | - |
474 | setError(QAbstractSocket::UnsupportedSocketOperationError, InvalidSocketErrorString); | - |
475 | break; | 0 |
476 | case 103: | - |
477 | setError(QAbstractSocket::NetworkError, RemoteHostClosedErrorString); | - |
478 | break; | 0 |
479 | case 14: | - |
480 | case 88: | - |
481 | setError(QAbstractSocket::SocketResourceError, NotSocketErrorString); | - |
482 | break; | 0 |
483 | case 93: | - |
484 | case 71: | - |
485 | case 97: | - |
486 | case 22: | - |
487 | setError(QAbstractSocket::UnsupportedSocketOperationError, ProtocolUnsupportedErrorString); | - |
488 | break; | 0 |
489 | case 23: | - |
490 | case 24: | - |
491 | case 105: | - |
492 | case 12: | - |
493 | setError(QAbstractSocket::SocketResourceError, ResourceErrorString); | - |
494 | break; | 0 |
495 | case 13: | - |
496 | case 1: | - |
497 | setError(QAbstractSocket::SocketAccessError, AccessErrorString); | - |
498 | break; | 0 |
499 | | - |
500 | | - |
501 | | - |
502 | case 11: | - |
503 | setError(QAbstractSocket::TemporaryError, TemporaryErrorString); | - |
504 | break; executed: break; Execution Count:455 | 455 |
505 | default: | - |
506 | setError(QAbstractSocket::UnknownSocketError, UnknownSocketErrorString); | - |
507 | break; | 0 |
508 | } | - |
509 | } executed: } Execution Count:455 | 455 |
510 | | - |
511 | return acceptedDescriptor; executed: return acceptedDescriptor; Execution Count:920 | 920 |
512 | } | - |
513 | | - |
514 | | - |
515 | | - |
516 | static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d, | - |
517 | int how6, | - |
518 | int how4, | - |
519 | const QHostAddress &groupAddress, | - |
520 | const QNetworkInterface &interface) | - |
521 | { | - |
522 | int level = 0; | - |
523 | int sockOpt = 0; | - |
524 | void *sockArg; | - |
525 | int sockArgSize; | - |
526 | | - |
527 | ip_mreq mreq4; | - |
528 | ipv6_mreq mreq6; | - |
529 | | - |
530 | if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) { evaluated: groupAddress.protocol() == QAbstractSocket::IPv6Protocol yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
531 | level = IPPROTO_IPV6; | - |
532 | sockOpt = how6; | - |
533 | sockArg = &mreq6; | - |
534 | sockArgSize = sizeof(mreq6); | - |
535 | memset(&mreq6, 0, sizeof(mreq6)); | - |
536 | Q_IPV6ADDR ip6 = groupAddress.toIPv6Address(); | - |
537 | memcpy(&mreq6.ipv6mr_multiaddr, &ip6, sizeof(ip6)); | - |
538 | mreq6.ipv6mr_interface = interface.index(); | - |
539 | } else executed: } Execution Count:1 | 1 |
540 | if (groupAddress.protocol() == QAbstractSocket::IPv4Protocol) { partially evaluated: groupAddress.protocol() == QAbstractSocket::IPv4Protocol yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
541 | level = IPPROTO_IP; | - |
542 | sockOpt = how4; | - |
543 | sockArg = &mreq4; | - |
544 | sockArgSize = sizeof(mreq4); | - |
545 | memset(&mreq4, 0, sizeof(mreq4)); | - |
546 | mreq4.imr_multiaddr.s_addr = (__extension__ ({ register unsigned int __v, __x = (groupAddress.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:6 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
547 | | - |
548 | if (interface.isValid()) { partially evaluated: interface.isValid() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
549 | QList<QNetworkAddressEntry> addressEntries = interface.addressEntries(); | - |
550 | if (!addressEntries.isEmpty()) { never evaluated: !addressEntries.isEmpty() | 0 |
551 | QHostAddress firstIP = addressEntries.first().ip(); | - |
552 | mreq4.imr_interface.s_addr = (__extension__ ({ register unsigned int __v, __x = (firstIP.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); never executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); never evaluated: __builtin_constant_p (__x) | 0 |
553 | } else { | 0 |
554 | d->setError(QAbstractSocket::NetworkError, | - |
555 | QNativeSocketEnginePrivate::NetworkUnreachableErrorString); | - |
556 | return false; never executed: return false; | 0 |
557 | } | - |
558 | } else { | - |
559 | mreq4.imr_interface.s_addr = ((in_addr_t) 0x00000000); | - |
560 | } executed: } Execution Count:6 | 6 |
561 | } else { | - |
562 | | - |
563 | d->setError(QAbstractSocket::UnsupportedSocketOperationError, | - |
564 | QNativeSocketEnginePrivate::ProtocolUnsupportedErrorString); | - |
565 | return false; never executed: return false; | 0 |
566 | } | - |
567 | | - |
568 | int res = setsockopt(d->socketDescriptor, level, sockOpt, sockArg, sockArgSize); | - |
569 | if (res == -1) { evaluated: res == -1 yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
570 | switch ((*__errno_location ())) { | - |
571 | case 92: | - |
572 | d->setError(QAbstractSocket::UnsupportedSocketOperationError, | - |
573 | QNativeSocketEnginePrivate::OperationUnsupportedErrorString); | - |
574 | break; | 0 |
575 | case 99: | - |
576 | d->setError(QAbstractSocket::SocketAddressNotAvailableError, | - |
577 | QNativeSocketEnginePrivate::AddressNotAvailableErrorString); | - |
578 | break; | 0 |
579 | default: | - |
580 | d->setError(QAbstractSocket::UnknownSocketError, | - |
581 | QNativeSocketEnginePrivate::UnknownSocketErrorString); | - |
582 | break; executed: break; Execution Count:1 | 1 |
583 | } | - |
584 | return false; executed: return false; Execution Count:1 | 1 |
585 | } | - |
586 | return true; executed: return true; Execution Count:6 | 6 |
587 | } | - |
588 | | - |
589 | bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress, | - |
590 | const QNetworkInterface &interface) | - |
591 | { | - |
592 | return multicastMembershipHelper(this, | 5 |
593 | 20, | 5 |
594 | 35, | 5 |
595 | groupAddress, | 5 |
596 | interface); executed: return multicastMembershipHelper(this, 20, 35, groupAddress, interface); Execution Count:5 | 5 |
597 | } | - |
598 | | - |
599 | bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress, | - |
600 | const QNetworkInterface &interface) | - |
601 | { | - |
602 | return multicastMembershipHelper(this, | 2 |
603 | 21, | 2 |
604 | 36, | 2 |
605 | groupAddress, | 2 |
606 | interface); executed: return multicastMembershipHelper(this, 21, 36, groupAddress, interface); Execution Count:2 | 2 |
607 | } | - |
608 | | - |
609 | QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const | - |
610 | { | - |
611 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
612 | uint v; | - |
613 | socklen_t sizeofv = sizeof(v); | - |
614 | if (::getsockopt(socketDescriptor, IPPROTO_IPV6, 17, &v, &sizeofv) == -1) partially evaluated: ::getsockopt(socketDescriptor, IPPROTO_IPV6, 17, &v, &sizeofv) == -1 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
615 | return QNetworkInterface(); never executed: return QNetworkInterface(); | 0 |
616 | return QNetworkInterface::interfaceFromIndex(v); executed: return QNetworkInterface::interfaceFromIndex(v); Execution Count:4 | 4 |
617 | } | - |
618 | | - |
619 | struct in_addr v = { 0 }; | - |
620 | socklen_t sizeofv = sizeof(v); | - |
621 | if (::getsockopt(socketDescriptor, IPPROTO_IP, 32, &v, &sizeofv) == -1) partially evaluated: ::getsockopt(socketDescriptor, IPPROTO_IP, 32, &v, &sizeofv) == -1 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
622 | return QNetworkInterface(); never executed: return QNetworkInterface(); | 0 |
623 | if (v.s_addr != 0 && sizeofv >= sizeof(v)) { partially evaluated: v.s_addr != 0 yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: sizeofv >= sizeof(v) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
624 | QHostAddress ipv4((__extension__ ({ register unsigned int __v, __x = (v.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; }))); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:4 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
625 | QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces(); | - |
626 | for (int i = 0; i < ifaces.count(); ++i) { partially evaluated: i < ifaces.count() yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
627 | const QNetworkInterface &iface = ifaces.at(i); | - |
628 | QList<QNetworkAddressEntry> entries = iface.addressEntries(); | - |
629 | for (int j = 0; j < entries.count(); ++j) { evaluated: j < entries.count() yes Evaluation Count:16 | yes Evaluation Count:8 |
| 8-16 |
630 | const QNetworkAddressEntry &entry = entries.at(j); | - |
631 | if (entry.ip() == ipv4) evaluated: entry.ip() == ipv4 yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
632 | return iface; executed: return iface; Execution Count:4 | 4 |
633 | } executed: } Execution Count:12 | 12 |
634 | } executed: } Execution Count:8 | 8 |
635 | } | 0 |
636 | return QNetworkInterface(); never executed: return QNetworkInterface(); | 0 |
637 | } | - |
638 | | - |
639 | bool QNativeSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInterface &iface) | - |
640 | { | - |
641 | if (socketProtocol == QAbstractSocket::IPv6Protocol) { evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
642 | uint v = iface.index(); | - |
643 | return (::setsockopt(socketDescriptor, IPPROTO_IPV6, 17, &v, sizeof(v)) != -1); executed: return (::setsockopt(socketDescriptor, IPPROTO_IPV6, 17, &v, sizeof(v)) != -1); Execution Count:4 | 4 |
644 | } | - |
645 | | - |
646 | struct in_addr v; | - |
647 | if (iface.isValid()) { partially evaluated: iface.isValid() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
648 | QList<QNetworkAddressEntry> entries = iface.addressEntries(); | - |
649 | for (int i = 0; i < entries.count(); ++i) { partially evaluated: i < entries.count() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
650 | const QNetworkAddressEntry &entry = entries.at(i); | - |
651 | const QHostAddress &ip = entry.ip(); | - |
652 | if (ip.protocol() == QAbstractSocket::IPv4Protocol) { partially evaluated: ip.protocol() == QAbstractSocket::IPv4Protocol yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
653 | v.s_addr = (__extension__ ({ register unsigned int __v, __x = (ip.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:4 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
654 | int r = ::setsockopt(socketDescriptor, IPPROTO_IP, 32, &v, sizeof(v)); | - |
655 | if (r != -1) partially evaluated: r != -1 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
656 | return true; executed: return true; Execution Count:4 | 4 |
657 | } | 0 |
658 | } | 0 |
659 | return false; never executed: return false; | 0 |
660 | } | - |
661 | | - |
662 | v.s_addr = ((in_addr_t) 0x00000000); | - |
663 | return (::setsockopt(socketDescriptor, IPPROTO_IP, 32, &v, sizeof(v)) != -1); never executed: return (::setsockopt(socketDescriptor, IPPROTO_IP, 32, &v, sizeof(v)) != -1); | 0 |
664 | } | - |
665 | | - |
666 | | - |
667 | | - |
668 | qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const | - |
669 | { | - |
670 | int nbytes = 0; | - |
671 | | - |
672 | qint64 available = 0; | - |
673 | if (qt_safe_ioctl(socketDescriptor, 0x541B, (char *) &nbytes) >= 0) partially evaluated: qt_safe_ioctl(socketDescriptor, 0x541B, (char *) &nbytes) >= 0 yes Evaluation Count:33407 | no Evaluation Count:0 |
| 0-33407 |
674 | available = (qint64) nbytes; executed: available = (qint64) nbytes; Execution Count:33408 | 33408 |
675 | | - |
676 | | - |
677 | | - |
678 | | - |
679 | return available; executed: return available; Execution Count:33408 | 33408 |
680 | } | - |
681 | | - |
682 | bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const | - |
683 | { | - |
684 | | - |
685 | qt_sockaddr storage; | - |
686 | socklen_t storageSize = sizeof(storage); | - |
687 | memset(&storage, 0, storageSize); | - |
688 | | - |
689 | | - |
690 | | - |
691 | ssize_t readBytes; | - |
692 | do { | - |
693 | char c; | - |
694 | readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize); | - |
695 | } while (readBytes == -1 && (*__errno_location ()) == 4); executed: } Execution Count:1662511 evaluated: readBytes == -1 yes Evaluation Count:1605060 | yes Evaluation Count:57451 |
partially evaluated: (*__errno_location ()) == 4 no Evaluation Count:0 | yes Evaluation Count:1605060 |
| 0-1662511 |
696 | | - |
697 | | - |
698 | | - |
699 | bool result = (readBytes != -1) || (*__errno_location ()) == 90; evaluated: (readBytes != -1) yes Evaluation Count:57451 | yes Evaluation Count:1605060 |
partially evaluated: (*__errno_location ()) == 90 no Evaluation Count:0 | yes Evaluation Count:1605060 |
| 0-1605060 |
700 | | - |
701 | | - |
702 | | - |
703 | | - |
704 | | - |
705 | return result; executed: return result; Execution Count:1662511 | 1662511 |
706 | } | - |
707 | | - |
708 | qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const | - |
709 | { | - |
710 | QVarLengthArray<char, 8192> udpMessagePeekBuffer(8192); | - |
711 | ssize_t recvResult = -1; | - |
712 | | - |
713 | for (;;) { | - |
714 | | - |
715 | | - |
716 | | - |
717 | recvResult = ::recv(socketDescriptor, udpMessagePeekBuffer.data(), | - |
718 | udpMessagePeekBuffer.size(), MSG_PEEK); | - |
719 | if (recvResult == -1 && (*__errno_location ()) == 4) partially evaluated: recvResult == -1 no Evaluation Count:0 | yes Evaluation Count:52648 |
never evaluated: (*__errno_location ()) == 4 | 0-52648 |
720 | continue; never executed: continue; | 0 |
721 | | - |
722 | if (recvResult != (ssize_t) udpMessagePeekBuffer.size()) evaluated: recvResult != (ssize_t) udpMessagePeekBuffer.size() yes Evaluation Count:31926 | yes Evaluation Count:20722 |
| 20722-31926 |
723 | break; executed: break; Execution Count:31926 | 31926 |
724 | | - |
725 | udpMessagePeekBuffer.resize(udpMessagePeekBuffer.size() * 2); | - |
726 | } executed: } Execution Count:20722 | 20722 |
727 | | - |
728 | | - |
729 | | - |
730 | | - |
731 | | - |
732 | return qint64(recvResult); executed: return qint64(recvResult); Execution Count:31926 | 31926 |
733 | } | - |
734 | | - |
735 | qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxSize, | - |
736 | QHostAddress *address, quint16 *port) | - |
737 | { | - |
738 | qt_sockaddr aa; | - |
739 | memset(&aa, 0, sizeof(aa)); | - |
740 | socklen_t sz; | - |
741 | sz = sizeof(aa); | - |
742 | | - |
743 | ssize_t recvFromResult = 0; | - |
744 | do { | - |
745 | char c; | - |
746 | recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1, | - |
747 | 0, &aa.a, &sz); | - |
748 | } while (recvFromResult == -1 && (*__errno_location ()) == 4); executed: } Execution Count:990809 partially evaluated: recvFromResult == -1 no Evaluation Count:0 | yes Evaluation Count:990809 |
never evaluated: (*__errno_location ()) == 4 | 0-990809 |
749 | | - |
750 | if (recvFromResult == -1) { partially evaluated: recvFromResult == -1 no Evaluation Count:0 | yes Evaluation Count:990809 |
| 0-990809 |
751 | setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); | - |
752 | } else if (port || address) { evaluated: port yes Evaluation Count:11274 | yes Evaluation Count:979535 |
partially evaluated: address no Evaluation Count:0 | yes Evaluation Count:979535 |
| 0-979535 |
753 | qt_socket_getPortAndAddress(&aa, port, address); | - |
754 | } executed: } Execution Count:11274 | 11274 |
755 | return qint64(maxSize ? recvFromResult : recvFromResult == -1 ? -1 : 0); executed: return qint64(maxSize ? recvFromResult : recvFromResult == -1 ? -1 : 0); Execution Count:990809 | 990809 |
756 | } | - |
757 | | - |
758 | qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 len, | - |
759 | const QHostAddress &host, quint16 port) | - |
760 | { | - |
761 | struct sockaddr_in sockAddrIPv4; | - |
762 | struct sockaddr *sockAddrPtr = 0; | - |
763 | socklen_t sockAddrSize = 0; | - |
764 | | - |
765 | struct sockaddr_in6 sockAddrIPv6; | - |
766 | if (host.protocol() == QAbstractSocket::IPv6Protocol evaluated: host.protocol() == QAbstractSocket::IPv6Protocol yes Evaluation Count:24 | yes Evaluation Count:324622 |
| 24-324622 |
767 | || socketProtocol == QAbstractSocket::IPv6Protocol partially evaluated: socketProtocol == QAbstractSocket::IPv6Protocol no Evaluation Count:0 | yes Evaluation Count:324622 |
| 0-324622 |
768 | || socketProtocol == QAbstractSocket::AnyIPProtocol) { evaluated: socketProtocol == QAbstractSocket::AnyIPProtocol yes Evaluation Count:11312 | yes Evaluation Count:313310 |
| 11312-313310 |
769 | memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); | - |
770 | sockAddrIPv6.sin6_family = 10; | - |
771 | sockAddrIPv6.sin6_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:11336 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:11336 |
| 0-11336 |
772 | | - |
773 | Q_IPV6ADDR tmp = host.toIPv6Address(); | - |
774 | memcpy(&sockAddrIPv6.sin6_addr.__in6_u.__u6_addr8, &tmp, sizeof(tmp)); | - |
775 | QString scopeid = host.scopeId(); | - |
776 | bool ok; | - |
777 | sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok); | - |
778 | | - |
779 | if (!ok) partially evaluated: !ok yes Evaluation Count:11336 | no Evaluation Count:0 |
| 0-11336 |
780 | sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); executed: sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); Execution Count:11336 | 11336 |
781 | | - |
782 | sockAddrSize = sizeof(sockAddrIPv6); | - |
783 | sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; | - |
784 | } else if (host.protocol() == QAbstractSocket::IPv4Protocol) { executed: } Execution Count:11336 partially evaluated: host.protocol() == QAbstractSocket::IPv4Protocol yes Evaluation Count:313310 | no Evaluation Count:0 |
| 0-313310 |
785 | memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); | - |
786 | sockAddrIPv4.sin_family = 2; | - |
787 | sockAddrIPv4.sin_port = (__extension__ ({ register unsigned short int __v, __x = (unsigned short int) (port); if (__builtin_constant_p (__x)) __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; })); never executed: __v = ((unsigned short int) ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8))); executed: __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); Execution Count:313310 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:313310 |
| 0-313310 |
788 | sockAddrIPv4.sin_addr.s_addr = (__extension__ ({ register unsigned int __v, __x = (host.toIPv4Address()); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })); never executed: __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); executed: __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); Execution Count:313310 partially evaluated: __builtin_constant_p (__x) no Evaluation Count:0 | yes Evaluation Count:313310 |
| 0-313310 |
789 | sockAddrSize = sizeof(sockAddrIPv4); | - |
790 | sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; | - |
791 | } executed: } Execution Count:313310 | 313310 |
792 | | - |
793 | ssize_t sentBytes = qt_safe_sendto(socketDescriptor, data, len, | - |
794 | 0, sockAddrPtr, sockAddrSize); | - |
795 | | - |
796 | if (sentBytes < 0) { evaluated: sentBytes < 0 yes Evaluation Count:1 | yes Evaluation Count:324645 |
| 1-324645 |
797 | switch ((*__errno_location ())) { | - |
798 | case 90: | - |
799 | setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString); | - |
800 | break; executed: break; Execution Count:1 | 1 |
801 | default: | - |
802 | setError(QAbstractSocket::NetworkError, SendDatagramErrorString); | - |
803 | } | 0 |
804 | } executed: } Execution Count:1 | 1 |
805 | | - |
806 | | - |
807 | | - |
808 | | - |
809 | | - |
810 | | - |
811 | | - |
812 | return qint64(sentBytes); executed: return qint64(sentBytes); Execution Count:324646 | 324646 |
813 | } | - |
814 | | - |
815 | bool QNativeSocketEnginePrivate::fetchConnectionParameters() | - |
816 | { | - |
817 | localPort = 0; | - |
818 | localAddress.clear(); | - |
819 | peerPort = 0; | - |
820 | peerAddress.clear(); | - |
821 | | - |
822 | if (socketDescriptor == -1) evaluated: socketDescriptor == -1 yes Evaluation Count:1 | yes Evaluation Count:2463 |
| 1-2463 |
823 | return false; executed: return false; Execution Count:1 | 1 |
824 | | - |
825 | qt_sockaddr sa; | - |
826 | socklen_t sockAddrSize = sizeof(sa); | - |
827 | | - |
828 | | - |
829 | memset(&sa, 0, sizeof(sa)); | - |
830 | if (::getsockname(socketDescriptor, &sa.a, &sockAddrSize) == 0) { evaluated: ::getsockname(socketDescriptor, &sa.a, &sockAddrSize) == 0 yes Evaluation Count:2461 | yes Evaluation Count:2 |
| 2-2461 |
831 | qt_socket_getPortAndAddress(&sa, &localPort, &localAddress); | - |
832 | | - |
833 | | - |
834 | switch (sa.a.sa_family) { | - |
835 | case 2: | - |
836 | socketProtocol = QAbstractSocket::IPv4Protocol; | - |
837 | break; executed: break; Execution Count:1576 | 1576 |
838 | case 10: | - |
839 | socketProtocol = QAbstractSocket::IPv6Protocol; | - |
840 | break; executed: break; Execution Count:739 | 739 |
841 | default: | - |
842 | socketProtocol = QAbstractSocket::UnknownNetworkLayerProtocol; | - |
843 | break; executed: break; Execution Count:146 | 146 |
844 | } | - |
845 | | - |
846 | } else if ((*__errno_location ()) == 9) { executed: } Execution Count:2461 partially evaluated: (*__errno_location ()) == 9 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2461 |
847 | setError(QAbstractSocket::UnsupportedSocketOperationError, InvalidSocketErrorString); | - |
848 | return false; executed: return false; Execution Count:2 | 2 |
849 | } | - |
850 | | - |
851 | | - |
852 | | - |
853 | | - |
854 | | - |
855 | | - |
856 | int ipv6only = 0; | - |
857 | socklen_t optlen = sizeof(ipv6only); | - |
858 | if (socketProtocol == QAbstractSocket::IPv6Protocol evaluated: socketProtocol == QAbstractSocket::IPv6Protocol yes Evaluation Count:739 | yes Evaluation Count:1722 |
| 739-1722 |
859 | && (localAddress == QHostAddress::AnyIPv4 || localAddress == QHostAddress::AnyIPv6) partially evaluated: localAddress == QHostAddress::AnyIPv4 no Evaluation Count:0 | yes Evaluation Count:739 |
evaluated: localAddress == QHostAddress::AnyIPv6 yes Evaluation Count:418 | yes Evaluation Count:321 |
| 0-739 |
860 | && !getsockopt(socketDescriptor, IPPROTO_IPV6, 26, (char*)&ipv6only, &optlen )) { partially evaluated: !getsockopt(socketDescriptor, IPPROTO_IPV6, 26, (char*)&ipv6only, &optlen ) yes Evaluation Count:418 | no Evaluation Count:0 |
| 0-418 |
861 | if (optlen != sizeof(ipv6only)) partially evaluated: optlen != sizeof(ipv6only) no Evaluation Count:0 | yes Evaluation Count:418 |
| 0-418 |
862 | QMessageLogger("socket/qnativesocketengine_unix.cpp", 991, __PRETTY_FUNCTION__).warning("unexpected size of IPV6_V6ONLY socket option"); never executed: QMessageLogger("socket/qnativesocketengine_unix.cpp", 991, __PRETTY_FUNCTION__).warning("unexpected size of IPV6_V6ONLY socket option"); | 0 |
863 | if (!ipv6only) { evaluated: !ipv6only yes Evaluation Count:376 | yes Evaluation Count:42 |
| 42-376 |
864 | socketProtocol = QAbstractSocket::AnyIPProtocol; | - |
865 | localAddress = QHostAddress::Any; | - |
866 | } executed: } Execution Count:376 | 376 |
867 | } executed: } Execution Count:418 | 418 |
868 | | - |
869 | | - |
870 | | - |
871 | if (!::getpeername(socketDescriptor, &sa.a, &sockAddrSize)) evaluated: !::getpeername(socketDescriptor, &sa.a, &sockAddrSize) yes Evaluation Count:1801 | yes Evaluation Count:660 |
| 660-1801 |
872 | qt_socket_getPortAndAddress(&sa, &peerPort, &peerAddress); executed: qt_socket_getPortAndAddress(&sa, &peerPort, &peerAddress); Execution Count:1801 | 1801 |
873 | | - |
874 | | - |
875 | int value = 0; | - |
876 | socklen_t valueSize = sizeof(int); | - |
877 | if (::getsockopt(socketDescriptor, 1, 3, &value, &valueSize) == 0) { partially evaluated: ::getsockopt(socketDescriptor, 1, 3, &value, &valueSize) == 0 yes Evaluation Count:2461 | no Evaluation Count:0 |
| 0-2461 |
878 | if (value == SOCK_STREAM) evaluated: value == SOCK_STREAM yes Evaluation Count:2227 | yes Evaluation Count:234 |
| 234-2227 |
879 | socketType = QAbstractSocket::TcpSocket; executed: socketType = QAbstractSocket::TcpSocket; Execution Count:2227 | 2227 |
880 | else if (value == SOCK_DGRAM) partially evaluated: value == SOCK_DGRAM yes Evaluation Count:234 | no Evaluation Count:0 |
| 0-234 |
881 | socketType = QAbstractSocket::UdpSocket; executed: socketType = QAbstractSocket::UdpSocket; Execution Count:234 | 234 |
882 | else | - |
883 | socketType = QAbstractSocket::UnknownSocketType; never executed: socketType = QAbstractSocket::UnknownSocketType; | 0 |
884 | } | - |
885 | return true; executed: return true; Execution Count:2461 | 2461 |
886 | } | - |
887 | | - |
888 | void QNativeSocketEnginePrivate::nativeClose() | - |
889 | { | - |
890 | | - |
891 | | - |
892 | | - |
893 | | - |
894 | qt_safe_close(socketDescriptor); | - |
895 | } executed: } Execution Count:3371 | 3371 |
896 | | - |
897 | qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) | - |
898 | { | - |
899 | QNativeSocketEngine * const q = q_func(); | - |
900 | | - |
901 | ssize_t writtenBytes; | - |
902 | writtenBytes = qt_safe_write_nosignal(socketDescriptor, data, len); | - |
903 | | - |
904 | if (writtenBytes < 0) { evaluated: writtenBytes < 0 yes Evaluation Count:11 | yes Evaluation Count:983472 |
| 11-983472 |
905 | switch ((*__errno_location ())) { | - |
906 | case 32: | - |
907 | case 104: | - |
908 | writtenBytes = -1; | - |
909 | setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString); | - |
910 | q->close(); | - |
911 | break; | 0 |
912 | case 11: | - |
913 | writtenBytes = 0; | - |
914 | break; executed: break; Execution Count:11 | 11 |
915 | case 90: | - |
916 | setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString); | - |
917 | break; | 0 |
918 | default: | - |
919 | break; | 0 |
920 | } | - |
921 | } executed: } Execution Count:11 | 11 |
922 | | - |
923 | | - |
924 | | - |
925 | | - |
926 | | - |
927 | | - |
928 | | - |
929 | return qint64(writtenBytes); executed: return qint64(writtenBytes); Execution Count:983483 | 983483 |
930 | } | - |
931 | | - |
932 | | - |
933 | qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) | - |
934 | { | - |
935 | QNativeSocketEngine * const q = q_func(); | - |
936 | if (!q->isValid()) { partially evaluated: !q->isValid() no Evaluation Count:0 | yes Evaluation Count:154611 |
| 0-154611 |
937 | QMessageLogger("socket/qnativesocketengine_unix.cpp", 1081, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::nativeRead: Invalid socket"); | - |
938 | return -1; never executed: return -1; | 0 |
939 | } | - |
940 | | - |
941 | ssize_t r = 0; | - |
942 | r = qt_safe_read(socketDescriptor, data, maxSize); | - |
943 | | - |
944 | if (r < 0) { evaluated: r < 0 yes Evaluation Count:5280 | yes Evaluation Count:149331 |
| 5280-149331 |
945 | r = -1; | - |
946 | switch ((*__errno_location ())) { | - |
947 | | - |
948 | | - |
949 | | - |
950 | case 11: | - |
951 | | - |
952 | r = -2; | - |
953 | break; executed: break; Execution Count:5263 | 5263 |
954 | case 9: | - |
955 | case 22: | - |
956 | case 5: | - |
957 | | - |
958 | break; | 0 |
959 | case 104: | - |
960 | | - |
961 | | - |
962 | | - |
963 | r = 0; | - |
964 | break; executed: break; Execution Count:17 | 17 |
965 | default: | - |
966 | break; | 0 |
967 | } | - |
968 | } executed: } Execution Count:5280 | 5280 |
969 | | - |
970 | | - |
971 | | - |
972 | | - |
973 | | - |
974 | | - |
975 | | - |
976 | return qint64(r); executed: return qint64(r); Execution Count:154611 | 154611 |
977 | } | - |
978 | | - |
979 | int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const | - |
980 | { | - |
981 | fd_set fds; | - |
982 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&fds)->fds_bits)[0]) : "memory"); } while (0); executed: } Execution Count:703 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:703 |
| 0-703 |
983 | (((&fds)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))); | - |
984 | | - |
985 | struct timeval tv; | - |
986 | tv.tv_sec = timeout / 1000; | - |
987 | tv.tv_usec = (timeout % 1000) * 1000; | - |
988 | | - |
989 | int retval; | - |
990 | if (selectForRead) evaluated: selectForRead yes Evaluation Count:282 | yes Evaluation Count:421 |
| 282-421 |
991 | retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); executed: retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); Execution Count:282 | 282 |
992 | else | - |
993 | retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); executed: retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); Execution Count:421 | 421 |
994 | | - |
995 | return retval; executed: return retval; Execution Count:703 | 703 |
996 | } | - |
997 | | - |
998 | int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, | - |
999 | bool *selectForRead, bool *selectForWrite) const | - |
1000 | { | - |
1001 | fd_set fdread; | - |
1002 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&fdread)->fds_bits)[0]) : "memory"); } while (0); executed: } Execution Count:18314 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:18314 |
| 0-18314 |
1003 | if (checkRead) partially evaluated: checkRead yes Evaluation Count:18314 | no Evaluation Count:0 |
| 0-18314 |
1004 | (((&fdread)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))); executed: (((&fdread)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))); Execution Count:18314 | 18314 |
1005 | | - |
1006 | fd_set fdwrite; | - |
1007 | do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((&fdwrite)->fds_bits)[0]) : "memory"); } while (0); executed: } Execution Count:18314 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:18314 |
| 0-18314 |
1008 | if (checkWrite) evaluated: checkWrite yes Evaluation Count:5141 | yes Evaluation Count:13173 |
| 5141-13173 |
1009 | (((&fdwrite)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))); executed: (((&fdwrite)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))); Execution Count:5141 | 5141 |
1010 | | - |
1011 | struct timeval tv; | - |
1012 | tv.tv_sec = timeout / 1000; | - |
1013 | tv.tv_usec = (timeout % 1000) * 1000; | - |
1014 | | - |
1015 | int ret; | - |
1016 | ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); | - |
1017 | | - |
1018 | if (ret <= 0) evaluated: ret <= 0 yes Evaluation Count:31 | yes Evaluation Count:18284 |
| 31-18284 |
1019 | return ret; executed: return ret; Execution Count:31 | 31 |
1020 | *selectForRead = ((((&fdread)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))) != 0); | - |
1021 | *selectForWrite = ((((&fdwrite)->fds_bits)[((socketDescriptor) / (8 * (int) sizeof (__fd_mask)))] & ((__fd_mask) 1 << ((socketDescriptor) % (8 * (int) sizeof (__fd_mask))))) != 0); | - |
1022 | | - |
1023 | return ret; executed: return ret; Execution Count:18284 | 18284 |
1024 | } | - |
1025 | | - |
1026 | | - |
1027 | | - |
| | |