openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rng-tools/6.7-r0/git/rngd_entsource.c
int xread(void* buf, size_t size, struct rng* ent_src)
{
    size_t off = 0;
    ssize_t r;

    while (size > 0)
    {
        do
        {
            r = read(ent_src->rng_fd, buf + off, size);
        } while ((r == -1) && (errno == EINTR));
        if (r <= 0)
            break;
        off += r;
        size -= r;
    }

    if (size)
    {
        message(LOG_DAEMON | LOG_DEBUG, "read error\n");
        return -1;
    }
    return 0;
}
/* Read data from the entropy source */
Read data from the entropy source
Read data from the entropy source
int xread(void* buf, size_t size, struct rng* ent_src)
{
    size_t off = 0;
    ssize_t r;
    while (size > 0)
    {
        do
        {
            r = read(ent_src->rng_fd, buf + off, size);
        } while ((r == -1) && (errno == EINTR));
        if (r <= 0)
            break;
        off += r;
        size -= r;
    }
    if (size)
    {
        message(LOG_DAEMON | LOG_DEBUG, "read error\n");
        return -1;
    }
    return 0;
}
int xread ( void * buf , size_t size , struct rng * ent_src ) { size_t off = 0 ; ssize_t r ; while ( size > 0 ) { do { r = read ( ent_src -> rng_fd , buf + off , size ) ; } while ( ( r == -1 ) && ( errno == EINTR ) ) ; if ( r <= 0 ) break ; off += r ; size -= r ; } if ( size ) { message ( LOG_DAEMON | LOG_DEBUG , " \n " ) ; return -1 ; } return 0 ; }
Read data from the entropy source
Read data from the entropy source