diff mbox series

Patch for socket table size

Message ID MWHPR05MB3150C47DE9BDF7F0A02CCBD1B3E10@MWHPR05MB3150.namprd05.prod.outlook.com
State Superseded
Headers show
Series Patch for socket table size | expand

Commit Message

Shriram Jandhyala Jan. 25, 2018, 2 a.m. UTC
Hi,

I notice that the socket table is not increased in size correctly when the first fd given is larger than 16.
Please consider the following patch.



Thanks.
Shriram
diff mbox series

Patch

--- src/utils/eloop.c.orig	2017-10-18 15:22:01.473499000 -0700
+++ src/utils/eloop.c	2018-01-24 17:41:37.494113000 -0800
@@ -301,7 +301,7 @@ 
 #endif /* CONFIG_ELOOP_POLL */
 #if defined(CONFIG_ELOOP_EPOLL) || defined(CONFIG_ELOOP_KQUEUE)
 	if (new_max_sock >= eloop.max_fd) {
-		next = eloop.max_fd == 0 ? 16 : eloop.max_fd * 2;
+		next = 1 << (32 - __builtin_clz(new_max_sock));
 		temp_table = os_realloc_array(eloop.fd_table, next,
 					      sizeof(struct eloop_sock));
 		if (temp_table == NULL)