Change in libosmocore[master]: socket: add function to wait until a socket becomes writeable

laforge gerrit-no-reply at
Thu Jun 24 11:06:21 UTC 2021

laforge has posted comments on this change. ( )

Change subject: socket: add function to wait until a socket becomes writeable

Patch Set 7:

> That gets translated to OSMO_FD_READ|OSMO_FD_WRITE and the call-back is called.  The only suboptimal part is that OSMO_FD_EXCEPT is not set in such situations.   The current code only sets it if POLLPRI is set.  The current mapping of poll flags to select-style flags is baesd in linux/fs/select.c but we could simply make POLLERR or POLLHUP also set OSMO_FD_EXCEPT if we wanted to.  That way the call-back could call the getsockopt(SO_ERROR) only if that flag is set.

looking at the documentation of poll(2), I think we should introduce a new OSMO_FD_ERROR flag which does not have to be enabled in ofd->what but which is set as 'what' argument when ofd->cb(ofd, what) is called whenever poll signals POLLERR, POLLHUP or POLLNVAL.

This way the application code can use the OSMO_FD_ERROR flag as trigger to do the SO_ERROR getsockopt, ... - or just not do the getsockopt at all, as in any case OSMO_FD_ERROR means that the fd is unusable, no matter what the reason was.

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1c68185120fa2a6c9b6cb8aa2a25232a44ff5508
Gerrit-Change-Number: 24435
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-Comment-Date: Thu, 24 Jun 2021 11:06:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list