openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/nsdpoll_ptcp.c
static rsRetVal Wait(nsdpoll_t* pNsdpoll, int timeout, int* numEntries,
                     nsd_epworkset_t workset[])
{
    nsdpoll_ptcp_t* pThis = (nsdpoll_ptcp_t*)pNsdpoll;
    nsdpoll_epollevt_lst_t* pOurEvt;
    struct epoll_event event[128];
    int nfds;
    int i;
    DEFiRet;

    assert(workset != NULL);

    if (*numEntries > 128)
        *numEntries = 128;
    DBGPRINTF("doing epoll_wait for max %d events\n", *numEntries);
    nfds = epoll_wait(pThis->efd, event, *numEntries, timeout);
    if (nfds == -1)
    {
        if (errno == EINTR)
        {
            ABORT_FINALIZE(RS_RET_EINTR);
        }
        else
        {
            DBGPRINTF("epoll() returned with error code %d\n", errno);
            ABORT_FINALIZE(RS_RET_ERR_EPOLL);
        }
    }
    else if (nfds == 0)
    {
        ABORT_FINALIZE(RS_RET_TIMEOUT);
    }

    /* we got valid events, so tell the caller... */
    DBGPRINTF("epoll returned %d entries\n", nfds);
    for (i = 0; i < nfds; ++i)
    {
        pOurEvt = (nsdpoll_epollevt_lst_t*)event[i].data.ptr;
        workset[i].id = pOurEvt->id;
        workset[i].pUsr = pOurEvt->pUsr;
    }
    *numEntries = nfds;

finalize_it:
    RETiRet;
}
/* Wait for io to become ready. After the successful call, idRdy contains the
 * id set by the caller for that i/o event, ppUsr is a pointer to a location
 * where the user pointer shall be stored.
 * numEntries contains the maximum number of entries on entry and the actual
 * number of entries actually read on exit.
 * rgerhards, 2009-11-18
 */
Wait for io to become ready. After the successful call, idRdy contains the
id set by the caller for that i/o event, ppUsr is a pointer to a location
where the user pointer shall be stored.
numEntries contains the maximum number of entries on entry and the actual
number of entries actually read on exit.
Wait for io to become ready . After the successful call idRdy contains the id set by the caller for that i / o event ppUsr is a pointer to a location where the user pointer shall be stored . numEntries contains the maximum number of entries on entry and the actual number of entries actually read on exit .
static rsRetVal Wait(nsdpoll_t* pNsdpoll, int timeout, int* numEntries,
                     nsd_epworkset_t workset[])
{
    nsdpoll_ptcp_t* pThis = (nsdpoll_ptcp_t*)pNsdpoll;
    nsdpoll_epollevt_lst_t* pOurEvt;
    struct epoll_event event[128];
    int nfds;
    int i;
    DEFiRet;
    assert(workset != NULL);
    if (*numEntries > 128)
        *numEntries = 128;
    DBGPRINTF("doing epoll_wait for max %d events\n", *numEntries);
    nfds = epoll_wait(pThis->efd, event, *numEntries, timeout);
    if (nfds == -1)
    {
        if (errno == EINTR)
        {
            ABORT_FINALIZE(RS_RET_EINTR);
        }
        else
        {
            DBGPRINTF("epoll() returned with error code %d\n", errno);
            ABORT_FINALIZE(RS_RET_ERR_EPOLL);
        }
    }
    else if (nfds == 0)
    {
        ABORT_FINALIZE(RS_RET_TIMEOUT);
    }
    DBGPRINTF("epoll returned %d entries\n", nfds);
    for (i = 0; i < nfds; ++i)
    {
        pOurEvt = (nsdpoll_epollevt_lst_t*)event[i].data.ptr;
        workset[i].id = pOurEvt->id;
        workset[i].pUsr = pOurEvt->pUsr;
    }
    *numEntries = nfds;
finalize_it:
    RETiRet;
}
static rsRetVal Wait ( nsdpoll_t * pNsdpoll , int timeout , int * numEntries , nsd_epworkset_t workset [ ] ) { nsdpoll_ptcp_t * pThis = ( nsdpoll_ptcp_t * ) pNsdpoll ; nsdpoll_epollevt_lst_t * pOurEvt ; struct epoll_event event [ 128 ] ; int nfds ; int i ; DEFiRet ; assert ( workset != NULL ) ; if ( * numEntries > 128 ) * numEntries = 128 ; DBGPRINTF ( " \n " , * numEntries ) ; nfds = epoll_wait ( pThis -> efd , event , * numEntries , timeout ) ; if ( nfds == -1 ) { if ( errno == EINTR ) { ABORT_FINALIZE ( RS_RET_EINTR ) ; } else { DBGPRINTF ( " \n " , errno ) ; ABORT_FINALIZE ( RS_RET_ERR_EPOLL ) ; } } else if ( nfds == 0 ) { ABORT_FINALIZE ( RS_RET_TIMEOUT ) ; } DBGPRINTF ( " \n " , nfds ) ; for ( i = 0 ; i < nfds ; ++ i ) { pOurEvt = ( nsdpoll_epollevt_lst_t * ) event [ i ] . data . ptr ; workset [ i ] . id = pOurEvt -> id ; workset [ i ] . pUsr = pOurEvt -> pUsr ; } * numEntries = nfds ; finalize_it : RETiRet ; }
Wait for io to become ready.
Wait for io to become ready .
/* we got valid events, so tell the caller... */