VirtualBox

Changeset 78832 in vbox for trunk


Ignore:
Timestamp:
May 28, 2019 10:42:24 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/poll.cpp: A shot at the missing POLLHUP for sockets on solaris. bugref:9464

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/poll.cpp

    r76553 r78832  
    4343# include <errno.h>
    4444# include <sys/poll.h>
     45# if defined(RT_OS_SOLARIS)
     46#  include <sys/socket.h>
     47# endif
    4548#endif
    4649
     
    417420                                                   )
    418421                   )
    419                 *pfEvents |= RTPOLL_EVT_ERROR;
     422                    *pfEvents |= RTPOLL_EVT_ERROR;
     423
     424# if defined(RT_OS_SOLARIS)
     425                /* Solaris does not return POLLHUP for sockets, just POLLIN.  Check if a
     426                   POLLIN should also have RTPOLL_EVT_ERROR set or not, so we present a
     427                   behaviour more in line with linux and BSDs.  Note that this will not
     428                   help is only RTPOLL_EVT_ERROR was requested, that will require
     429                   extending this hack quite a bit further (restart poll):  */
     430                if (   *pfEvents == RTPOLL_EVT_READ
     431                    && pThis->paHandles[i].enmType == RTHANDLETYPE_SOCKET)
     432                {
     433                    uint8_t abBuf[64];
     434                    ssize_t rcRecv = recv(pThis->paPollFds[i].fd, abBuf, sizeof(abBuf), MSG_PEEK | MSG_DONTWAIT);
     435                    if (rcRecv == 0)
     436                        *pfEvents |= RTPOLL_EVT_ERROR;
     437                }
     438# endif
    420439            }
    421440            if (pid)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette