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

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 24 11:06:21 UTC 2021


laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24435 )

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 https://gerrit.osmocom.org/c/libosmocore/+/24435
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1c68185120fa2a6c9b6cb8aa2a25232a44ff5508
Gerrit-Change-Number: 24435
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
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: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210624/39e3747a/attachment.htm>


More information about the gerrit-log mailing list