Bug 1366 - atomicio doesn't poll()
Summary: atomicio doesn't poll()
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Miscellaneous (show other bugs)
Version: 4.7p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_4_8
  Show dependency treegraph
 
Reported: 2007-09-21 04:04 AEST by Benjamin Bennett
Modified: 2008-03-31 15:21 AEDT (History)
1 user (show)

See Also:


Attachments
Patch to fix atomicio and atomiciov non-polling spin (1005 bytes, patch)
2007-09-21 04:04 AEST, Benjamin Bennett
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Bennett 2007-09-21 04:04:32 AEST
Created attachment 1355 [details]
Patch to fix atomicio and atomiciov non-polling spin

atomicio contains the following in the read/write loop:

-----
                case -1:
#ifdef EWOULDBLOCK
                        if (errno == EINTR || errno == EWOULDBLOCK)
#else
                        if (errno == EINTR)
#endif
                                continue;
                        if (errno == EAGAIN) {
                                (void)poll(&pfd, 1, -1);
                                continue;
                        }
                        return 0;
-----

On systems where errno is set to EWOULDBLOCK we spin on the read or write without polling.  On many other systems (Linux, Solaris, IRIX, ...) EWOULDBLOCK is defined as EAGAIN, and when errno is set to EAGAIN we spin on the read or write without polling.

Please see patch.

thanks,

--ben
Comment 1 Damien Miller 2007-09-21 13:14:59 AEST
Patch applied - thanks.
Comment 2 Damien Miller 2008-03-31 15:21:28 AEDT
Fix shipped in 4.9/4.9p1 release.