<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/24435">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/24435">change 24435</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/24435"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1c68185120fa2a6c9b6cb8aa2a25232a44ff5508 </div>
<div style="display:none"> Gerrit-Change-Number: 24435 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 24 Jun 2021 11:06:21 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>