openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libpam/1.3.1-r0/Linux-PAM-1.3.1/libpam/pam_delay.c
void _pam_await_timer(pam_handle_t* pamh, int status)
{
    unsigned int delay;
    D(("waiting?..."));

    delay = _pam_compute_delay(pamh->fail_delay.begin, pamh->fail_delay.delay);
    if (pamh->fail_delay.delay_fn_ptr)
    {
        union
        {
            const void* value;
            void (*fn)(int, unsigned, void*);
        } hack_fn_u;
        void* appdata_ptr;

        if (pamh->pam_conversation)
        {
            appdata_ptr = pamh->pam_conversation->appdata_ptr;
        }
        else
        {
            appdata_ptr = NULL;
        }

        /* always call the applications delay function, even if
           the delay is zero - indicate status */
        hack_fn_u.value = pamh->fail_delay.delay_fn_ptr;
        hack_fn_u.fn(status, delay, appdata_ptr);
    }
    else if (status != PAM_SUCCESS && pamh->fail_delay.set)
    {

        D(("will wait %u usec", delay));

        if (delay > 0)
        {
            struct timeval tval;

            tval.tv_sec = delay / 1000000;
            tval.tv_usec = delay % 1000000;
            select(0, NULL, NULL, NULL, &tval);
        }
    }

    _pam_reset_timer(pamh);
    D(("waiting done"));
}
/* **********************************************************************
 * the following function sleeps for a random time. The actual time
 * slept is computed above.. It is based on the requested time but will
 * differ by up to +/- 50%.
 */
the following function sleeps for a random time. The actual time
slept is computed above.. It is based on the requested time but will
differ by up to +/- 50%.
the following function sleeps for a random time . The actual time slept is computed above .. It is based on the requested time but will differ by up to + / - 50% .
void _pam_await_timer(pam_handle_t* pamh, int status)
{
    unsigned int delay;
    D(("waiting?..."));
    delay = _pam_compute_delay(pamh->fail_delay.begin, pamh->fail_delay.delay);
    if (pamh->fail_delay.delay_fn_ptr)
    {
        union
        {
            const void* value;
            void (*fn)(int, unsigned, void*);
        } hack_fn_u;
        void* appdata_ptr;
        if (pamh->pam_conversation)
        {
            appdata_ptr = pamh->pam_conversation->appdata_ptr;
        }
        else
        {
            appdata_ptr = NULL;
        }
        hack_fn_u.value = pamh->fail_delay.delay_fn_ptr;
        hack_fn_u.fn(status, delay, appdata_ptr);
    }
    else if (status != PAM_SUCCESS && pamh->fail_delay.set)
    {
        D(("will wait %u usec", delay));
        if (delay > 0)
        {
            struct timeval tval;
            tval.tv_sec = delay / 1000000;
            tval.tv_usec = delay % 1000000;
            select(0, NULL, NULL, NULL, &tval);
        }
    }
    _pam_reset_timer(pamh);
    D(("waiting done"));
}
void _pam_await_timer ( pam_handle_t * pamh , int status ) { unsigned int delay ; D ( ( " " ) ) ; delay = _pam_compute_delay ( pamh -> fail_delay . begin , pamh -> fail_delay . delay ) ; if ( pamh -> fail_delay . delay_fn_ptr ) { union { const void * value ; void ( * fn ) ( int , unsigned , void * ) ; } hack_fn_u ; void * appdata_ptr ; if ( pamh -> pam_conversation ) { appdata_ptr = pamh -> pam_conversation -> appdata_ptr ; } else { appdata_ptr = NULL ; } hack_fn_u . value = pamh -> fail_delay . delay_fn_ptr ; hack_fn_u . fn ( status , delay , appdata_ptr ) ; } else if ( status != PAM_SUCCESS && pamh -> fail_delay . set ) { D ( ( " " , delay ) ) ; if ( delay > 0 ) { struct timeval tval ; tval . tv_sec = delay / 1000000 ; tval . tv_usec = delay % 1000000 ; select ( 0 , NULL , NULL , NULL , & tval ) ; } } _pam_reset_timer ( pamh ) ; D ( ( " " ) ) ; }
the following function sleeps for a random time.
the following function sleeps for a random time .
/* always call the applications delay function, even if
           the delay is zero - indicate status */