MCPcopy Create free account
hub / github.com/acl-dev/acl / WSAPoll

Function WSAPoll

lib_acl/src/stdlib/sys/acl_sys_socket.c:272–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270#endif
271
272int WSAAPI WSAPoll(LPWSAPOLLFD fds, ULONG nfds, INT timeout) {
273 int ret;
274 unsigned long i;
275 struct timeval tv, *ptv;
276
277 FD_SET rset;
278 FD_SET wset;
279 FD_SET eset;
280
281 FD_ZERO(&rset);
282 FD_ZERO(&wset);
283 FD_ZERO(&eset);
284
285 for (i = 0; i < nfds; i++) {
286 if (fds[i].events & POLLRDNORM) {
287 FD_SET(fds[i].fd, &rset);
288 }
289 if (fds[i].events & POLLWRNORM) {
290 FD_SET(fds[i].fd, &wset);
291 }
292 FD_SET(fds[i].fd, &eset);
293 }
294
295 if (timeout >= 0) {
296 tv.tv_sec = timeout / 1000;
297 tv.tv_usec = (timeout % 1000) * 1000;
298 ptv = &tv;
299 } else {
300 ptv = NULL;
301 }
302
303 ret = select((int) fds, &rset, &wset, &eset, ptv);
304 if (ret == SOCKET_ERROR) {
305 return SOCKET_ERROR;
306 }
307
308 for(i = 0; i < nfds; i++) {
309 if ((fds[i].events & POLLRDNORM) && FD_ISSET(fds[i].fd, &rset)) {
310 fds[i].revents |= POLLRDNORM;
311 }
312 if ((fds[i].events & POLLWRNORM) && FD_ISSET(fds[i].fd, &wset)) {
313 fds[i].revents |= POLLWRNORM;
314 }
315 if (FD_ISSET(fds[i].fd, &eset)) {
316 fds[i].revents |= POLLERR;
317 }
318 }
319
320 return ret;
321}
322
323int inet_pton(int af, const char *src, void *dst)
324{

Callers 3

checkFunction · 0.85
checkFunction · 0.85
events_poll.cFile · 0.85

Calls 1

selectFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…