[PATCH] libosmocore[master]: select: Find the highest fd when filling the fd_sets

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Tue Mar 7 13:31:01 UTC 2017


Review at  https://gerrit.osmocom.org/1986

select: Find the highest fd when filling the fd_sets

Instead of returning maxfd, which is the highest fd ever seen, take
the highest we have seen on this iteration.

This makes a tiny difference for the osmo-sip-connector and its
event loop integration. select.c ignores the return value of this
function right now.

Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4
---
M src/select.c
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/1986/1

diff --git a/src/select.c b/src/select.c
index ab0734e..10c0b0c 100644
--- a/src/select.c
+++ b/src/select.c
@@ -121,6 +121,7 @@
 {
 	fd_set *readset = _rset, *writeset = _wset, *exceptset = _eset;
 	struct osmo_fd *ufd;
+	int highfd = 0;
 
 	llist_for_each_entry(ufd, &osmo_fds, list) {
 		if (ufd->when & BSC_FD_READ)
@@ -131,9 +132,12 @@
 
 		if (ufd->when & BSC_FD_EXCEPT)
 			FD_SET(ufd->fd, exceptset);
+
+		if (ufd->fd > highfd)
+			highfd = ufd->fd;
 	}
 
-	return maxfd;
+	return highfd;
 }
 
 inline int osmo_fd_disp_fds(void *_rset, void *_wset, void *_eset)

-- 
To view, visit https://gerrit.osmocom.org/1986
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>



More information about the gerrit-log mailing list