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

Function acl_readable

lib_acl/src/stdlib/iostuff/acl_readable.c:40–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38# endif
39
40int acl_readable(ACL_SOCKET fd)
41{
42 struct pollfd fds;
43 int delay = 0;
44
45 fds.fd = fd;
46#ifdef ACL_WINDOWS
47 fds.events = POLLIN /* | POLLHUP | POLLERR */;
48#else
49 fds.events = POLLIN | POLLHUP | POLLERR | POLLPRI;
50#endif
51 fds.revents = 0;
52
53 acl_set_error(0);
54
55 for (;;) {
56 switch (__sys_poll(&fds, 1, delay)) {
57#ifdef ACL_WINDOWS
58 case SOCKET_ERROR:
59#else
60 case -1:
61#endif
62 if (acl_last_error() == ACL_EINTR) {
63 continue;
64 }
65
66 acl_msg_error("%s(%d), %s: poll error(%s), fd: %d",
67 __FILE__, __LINE__, __FUNCTION__,
68 acl_last_serror(), (int) fd);
69 return -1;
70 case 0:
71 return 0;
72 default:
73 if ((fds.revents & POLLIN)) {
74 return 1;
75 } else if (fds.revents & (POLLHUP | POLLERR)) {
76 return 1;
77 } else {
78 return 0;
79 }
80 }
81 }
82}
83
84#else
85

Callers 10

do_echoFunction · 0.85
client_echoFunction · 0.85
service_testFunction · 0.85
acl_vstream_readableFunction · 0.85
acl_socket_aliveFunction · 0.85
acl_socket_alive2Function · 0.85
acl_fifo_listen.cFile · 0.85
sock_readMethod · 0.85
sock_readMethod · 0.85
attr_clnt_requestFunction · 0.85

Calls 6

acl_set_errorFunction · 0.85
acl_last_errorFunction · 0.85
acl_msg_errorFunction · 0.85
acl_last_serrorFunction · 0.85
acl_msg_fatalFunction · 0.85
selectFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…