Revert "[wpa_supplicant] Cumulative patch from c4e90da6d"
This reverts commit 39bc25d3a79c1375de430a7918d949c1a86f70c6.
Test: Compilation
Change-Id: Iae7670429466958911b5296cb1359bceecc0b03e
Exempt-From-Owner-Approval: Revert since it's breaking the build
diff --git a/src/utils/eloop.c b/src/utils/eloop.c
index bb375be..436bc8c 100644
--- a/src/utils/eloop.c
+++ b/src/utils/eloop.c
@@ -224,25 +224,22 @@
#ifdef CONFIG_ELOOP_KQUEUE
-
-static short event_type_kevent_filter(eloop_event_type type)
-{
- switch (type) {
- case EVENT_TYPE_READ:
- return EVFILT_READ;
- case EVENT_TYPE_WRITE:
- return EVFILT_WRITE;
- default:
- return 0;
- }
-}
-
-
static int eloop_sock_queue(int sock, eloop_event_type type)
{
+ int filter;
struct kevent ke;
- EV_SET(&ke, sock, event_type_kevent_filter(type), EV_ADD, 0, 0, 0);
+ switch (type) {
+ case EVENT_TYPE_READ:
+ filter = EVFILT_READ;
+ break;
+ case EVENT_TYPE_WRITE:
+ filter = EVFILT_WRITE;
+ break;
+ default:
+ filter = 0;
+ }
+ EV_SET(&ke, sock, filter, EV_ADD, 0, 0, 0);
if (kevent(eloop.kqueuefd, &ke, 1, NULL, 0, NULL) == -1) {
wpa_printf(MSG_ERROR, "%s: kevent(ADD) for fd=%d failed: %s",
__func__, sock, strerror(errno));
@@ -250,7 +247,6 @@
}
return 0;
}
-
#endif /* CONFIG_ELOOP_KQUEUE */
@@ -305,7 +301,7 @@
#endif /* CONFIG_ELOOP_POLL */
#if defined(CONFIG_ELOOP_EPOLL) || defined(CONFIG_ELOOP_KQUEUE)
if (new_max_sock >= eloop.max_fd) {
- next = new_max_sock + 16;
+ next = eloop.max_fd == 0 ? 16 : eloop.max_fd * 2;
temp_table = os_realloc_array(eloop.fd_table, next,
sizeof(struct eloop_sock));
if (temp_table == NULL)
@@ -415,8 +411,7 @@
os_memset(&eloop.fd_table[sock], 0, sizeof(struct eloop_sock));
#endif /* CONFIG_ELOOP_EPOLL */
#ifdef CONFIG_ELOOP_KQUEUE
- EV_SET(&ke, sock, event_type_kevent_filter(table->type), EV_DELETE, 0,
- 0, 0);
+ EV_SET(&ke, sock, 0, EV_DELETE, 0, 0, 0);
if (kevent(eloop.kqueuefd, &ke, 1, NULL, 0, NULL) < 0) {
wpa_printf(MSG_ERROR, "%s: kevent(DEL) for fd=%d failed: %s",
__func__, sock, strerror(errno));