• Home
  • Raw
  • Download

Lines Matching refs:eloop

47 	WPA_TRACE_REF(eloop);
58 WPA_TRACE_REF(eloop);
115 static struct eloop_data eloop; variable
132 wpa_trace_add_ref(&table->table[i], eloop, in eloop_trace_sock_add_ref()
146 wpa_trace_remove_ref(&table->table[i], eloop, in eloop_trace_sock_remove_ref()
163 os_memset(&eloop, 0, sizeof(eloop)); in eloop_init()
164 dl_list_init(&eloop.timeout); in eloop_init()
166 eloop.epollfd = epoll_create1(0); in eloop_init()
167 if (eloop.epollfd < 0) { in eloop_init()
174 eloop.kqueuefd = kqueue(); in eloop_init()
175 if (eloop.kqueuefd < 0) { in eloop_init()
182 eloop.readers.type = EVENT_TYPE_READ; in eloop_init()
183 eloop.writers.type = EVENT_TYPE_WRITE; in eloop_init()
184 eloop.exceptions.type = EVENT_TYPE_EXCEPTION; in eloop_init()
216 if (epoll_ctl(eloop.epollfd, EPOLL_CTL_ADD, sock, &ev) < 0) { in eloop_sock_queue()
246 if (kevent(eloop.kqueuefd, &ke, 1, NULL, 0, NULL) == -1) { in eloop_sock_queue()
274 if (sock > eloop.max_sock) in eloop_sock_table_add_sock()
277 new_max_sock = eloop.max_sock; in eloop_sock_table_add_sock()
283 if (new_max_sock >= eloop.max_pollfd_map) { in eloop_sock_table_add_sock()
285 nmap = os_realloc_array(eloop.pollfds_map, new_max_sock + 50, in eloop_sock_table_add_sock()
290 eloop.max_pollfd_map = new_max_sock + 50; in eloop_sock_table_add_sock()
291 eloop.pollfds_map = nmap; in eloop_sock_table_add_sock()
294 if (eloop.count + 1 > eloop.max_poll_fds) { in eloop_sock_table_add_sock()
296 int nmax = eloop.count + 1 + 50; in eloop_sock_table_add_sock()
297 n = os_realloc_array(eloop.pollfds, nmax, in eloop_sock_table_add_sock()
302 eloop.max_poll_fds = nmax; in eloop_sock_table_add_sock()
303 eloop.pollfds = n; in eloop_sock_table_add_sock()
307 if (new_max_sock >= eloop.max_fd) { in eloop_sock_table_add_sock()
309 temp_table = os_realloc_array(eloop.fd_table, next, in eloop_sock_table_add_sock()
314 eloop.max_fd = next; in eloop_sock_table_add_sock()
315 eloop.fd_table = temp_table; in eloop_sock_table_add_sock()
320 if (eloop.count + 1 > eloop.epoll_max_event_num) { in eloop_sock_table_add_sock()
321 next = eloop.epoll_max_event_num == 0 ? 8 : in eloop_sock_table_add_sock()
322 eloop.epoll_max_event_num * 2; in eloop_sock_table_add_sock()
323 temp_events = os_realloc_array(eloop.epoll_events, next, in eloop_sock_table_add_sock()
331 eloop.epoll_max_event_num = next; in eloop_sock_table_add_sock()
332 eloop.epoll_events = temp_events; in eloop_sock_table_add_sock()
336 if (eloop.count + 1 > eloop.kqueue_nevents) { in eloop_sock_table_add_sock()
337 next = eloop.kqueue_nevents == 0 ? 8 : eloop.kqueue_nevents * 2; in eloop_sock_table_add_sock()
346 os_free(eloop.kqueue_events); in eloop_sock_table_add_sock()
347 eloop.kqueue_events = temp_events; in eloop_sock_table_add_sock()
348 eloop.kqueue_nevents = next; in eloop_sock_table_add_sock()
367 eloop.max_sock = new_max_sock; in eloop_sock_table_add_sock()
368 eloop.count++; in eloop_sock_table_add_sock()
375 os_memcpy(&eloop.fd_table[sock], &table->table[table->count - 1], in eloop_sock_table_add_sock()
406 eloop.count--; in eloop_sock_table_remove_sock()
410 if (epoll_ctl(eloop.epollfd, EPOLL_CTL_DEL, sock, NULL) < 0) { in eloop_sock_table_remove_sock()
415 os_memset(&eloop.fd_table[sock], 0, sizeof(struct eloop_sock)); in eloop_sock_table_remove_sock()
420 if (kevent(eloop.kqueuefd, &ke, 1, NULL, 0, NULL) < 0) { in eloop_sock_table_remove_sock()
425 os_memset(&eloop.fd_table[sock], 0, sizeof(struct eloop_sock)); in eloop_sock_table_remove_sock()
619 table = &eloop.fd_table[events[i].data.fd]; in eloop_sock_table_dispatch()
624 if (eloop.readers.changed || in eloop_sock_table_dispatch()
625 eloop.writers.changed || in eloop_sock_table_dispatch()
626 eloop.exceptions.changed) in eloop_sock_table_dispatch()
641 table = &eloop.fd_table[events[i].ident]; in eloop_sock_table_dispatch()
646 if (eloop.readers.changed || in eloop_sock_table_dispatch()
647 eloop.writers.changed || in eloop_sock_table_dispatch()
648 eloop.exceptions.changed) in eloop_sock_table_dispatch()
674 close(eloop.kqueuefd); in eloop_sock_requeue()
675 eloop.kqueuefd = kqueue(); in eloop_sock_requeue()
676 if (eloop.kqueuefd < 0) { in eloop_sock_requeue()
682 if (eloop_sock_table_requeue(&eloop.readers) < 0) in eloop_sock_requeue()
684 if (eloop_sock_table_requeue(&eloop.writers) < 0) in eloop_sock_requeue()
686 if (eloop_sock_table_requeue(&eloop.exceptions) < 0) in eloop_sock_requeue()
734 return &eloop.readers; in eloop_get_sock_table()
736 return &eloop.writers; in eloop_get_sock_table()
738 return &eloop.exceptions; in eloop_get_sock_table()
801 wpa_trace_add_ref(timeout, eloop, eloop_data); in eloop_register_timeout()
806 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_register_timeout()
812 dl_list_add_tail(&eloop.timeout, &timeout->list); in eloop_register_timeout()
821 wpa_trace_remove_ref(timeout, eloop, timeout->eloop_data); in eloop_remove_timeout()
833 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_cancel_timeout()
860 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_cancel_timeout_one()
881 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_is_timeout_registered()
899 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_deplete_timeout()
931 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_replenish_timeout()
974 if ((sig == SIGINT || sig == SIGTERM) && !eloop.pending_terminate) { in eloop_handle_signal()
977 eloop.pending_terminate = 1; in eloop_handle_signal()
983 eloop.signaled++; in eloop_handle_signal()
984 for (i = 0; i < eloop.signal_count; i++) { in eloop_handle_signal()
985 if (eloop.signals[i].sig == sig) { in eloop_handle_signal()
986 eloop.signals[i].signaled++; in eloop_handle_signal()
997 if (eloop.signaled == 0) in eloop_process_pending_signals()
999 eloop.signaled = 0; in eloop_process_pending_signals()
1001 if (eloop.pending_terminate) { in eloop_process_pending_signals()
1005 eloop.pending_terminate = 0; in eloop_process_pending_signals()
1008 for (i = 0; i < eloop.signal_count; i++) { in eloop_process_pending_signals()
1009 if (eloop.signals[i].signaled) { in eloop_process_pending_signals()
1010 eloop.signals[i].signaled = 0; in eloop_process_pending_signals()
1011 eloop.signals[i].handler(eloop.signals[i].sig, in eloop_process_pending_signals()
1012 eloop.signals[i].user_data); in eloop_process_pending_signals()
1023 tmp = os_realloc_array(eloop.signals, eloop.signal_count + 1, in eloop_register_signal()
1028 tmp[eloop.signal_count].sig = sig; in eloop_register_signal()
1029 tmp[eloop.signal_count].user_data = user_data; in eloop_register_signal()
1030 tmp[eloop.signal_count].handler = handler; in eloop_register_signal()
1031 tmp[eloop.signal_count].signaled = 0; in eloop_register_signal()
1032 eloop.signal_count++; in eloop_register_signal()
1033 eloop.signals = tmp; in eloop_register_signal()
1088 while (!eloop.terminate && in eloop_run()
1089 (!dl_list_empty(&eloop.timeout) || eloop.readers.count > 0 || in eloop_run()
1090 eloop.writers.count > 0 || eloop.exceptions.count > 0)) { in eloop_run()
1093 if (eloop.pending_terminate) { in eloop_run()
1102 if (eloop.terminate) in eloop_run()
1106 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
1129 &eloop.readers, &eloop.writers, &eloop.exceptions, in eloop_run()
1130 eloop.pollfds, eloop.pollfds_map, in eloop_run()
1131 eloop.max_pollfd_map); in eloop_run()
1132 res = poll(eloop.pollfds, num_poll_fds, in eloop_run()
1136 eloop_sock_table_set_fds(&eloop.readers, rfds); in eloop_run()
1137 eloop_sock_table_set_fds(&eloop.writers, wfds); in eloop_run()
1138 eloop_sock_table_set_fds(&eloop.exceptions, efds); in eloop_run()
1139 res = select(eloop.max_sock + 1, rfds, wfds, efds, in eloop_run()
1143 if (eloop.count == 0) { in eloop_run()
1146 res = epoll_wait(eloop.epollfd, eloop.epoll_events, in eloop_run()
1147 eloop.count, timeout_ms); in eloop_run()
1151 if (eloop.count == 0) { in eloop_run()
1154 res = kevent(eloop.kqueuefd, NULL, 0, in eloop_run()
1155 eloop.kqueue_events, eloop.kqueue_nevents, in eloop_run()
1178 eloop.readers.changed = 0; in eloop_run()
1179 eloop.writers.changed = 0; in eloop_run()
1180 eloop.exceptions.changed = 0; in eloop_run()
1186 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
1204 if (eloop.readers.changed || in eloop_run()
1205 eloop.writers.changed || in eloop_run()
1206 eloop.exceptions.changed) { in eloop_run()
1218 eloop_sock_table_dispatch(&eloop.readers, &eloop.writers, in eloop_run()
1219 &eloop.exceptions, eloop.pollfds_map, in eloop_run()
1220 eloop.max_pollfd_map); in eloop_run()
1223 eloop_sock_table_dispatch(&eloop.readers, rfds); in eloop_run()
1224 eloop_sock_table_dispatch(&eloop.writers, wfds); in eloop_run()
1225 eloop_sock_table_dispatch(&eloop.exceptions, efds); in eloop_run()
1228 eloop_sock_table_dispatch(eloop.epoll_events, res); in eloop_run()
1231 eloop_sock_table_dispatch(eloop.kqueue_events, res); in eloop_run()
1235 eloop.terminate = 0; in eloop_run()
1248 eloop.terminate = 1; in eloop_terminate()
1258 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_destroy()
1276 eloop_sock_table_destroy(&eloop.readers); in eloop_destroy()
1277 eloop_sock_table_destroy(&eloop.writers); in eloop_destroy()
1278 eloop_sock_table_destroy(&eloop.exceptions); in eloop_destroy()
1279 os_free(eloop.signals); in eloop_destroy()
1282 os_free(eloop.pollfds); in eloop_destroy()
1283 os_free(eloop.pollfds_map); in eloop_destroy()
1286 os_free(eloop.fd_table); in eloop_destroy()
1289 os_free(eloop.epoll_events); in eloop_destroy()
1290 close(eloop.epollfd); in eloop_destroy()
1293 os_free(eloop.kqueue_events); in eloop_destroy()
1294 close(eloop.kqueuefd); in eloop_destroy()
1301 return eloop.terminate || eloop.pending_terminate; in eloop_terminated()