<p style="white-space: pre-wrap; word-wrap: break-word;">Just did a few-lines test program doing nothing but osmo_sock_init2_ofd(.., OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_CONNECT); and osmo_select_main().  After the Timeout I get:</p><p style="white-space: pre-wrap; word-wrap: break-word;"><br>poll([{fd=3, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, -1) = 1 ([{fd=3, revents=POLLOUT|POLLERR|POLLHUP}])</p><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.<br></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:03:02 +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>