openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/nbd/3.19-r0/nbd-3.19/cliserv.c
int readit(int f, void* buf, size_t len)
{
    ssize_t res;
    while (len > 0)
    {
        DEBUG("*");
        res = read(f, buf, len);
        if (res > 0)
        {
            len -= res;
            buf += res;
        }
        else if (res < 0)
        {
            if (errno != EAGAIN)
            {
                err_nonfatal("Read failed: %m");
                return -1;
            }
        }
        else
        {
            errno = ECONNRESET;
            return -1;
        }
    }
    return 0;
}
/**
 * Read data from a file descriptor into a buffer
 *
 * @param f a file descriptor
 * @param buf a buffer
 * @param len the number of bytes to be read
 * @return 0 on completion, or -1 on failure
 **/
Read data from a file descriptor into a buffer
@param f a file descriptor
@param buf a buffer
@param len the number of bytes to be read
@return 0 on completion, or -1 on failure
Read data from a file descriptor into a buffer @param f a file descriptor @param buf a buffer @param len the number of bytes to be read @return 0 on completion or - 1 on failure
int readit(int f, void* buf, size_t len)
{
    ssize_t res;
    while (len > 0)
    {
        DEBUG("*");
        res = read(f, buf, len);
        if (res > 0)
        {
            len -= res;
            buf += res;
        }
        else if (res < 0)
        {
            if (errno != EAGAIN)
            {
                err_nonfatal("Read failed: %m");
                return -1;
            }
        }
        else
        {
            errno = ECONNRESET;
            return -1;
        }
    }
    return 0;
}
int readit ( int f , void * buf , size_t len ) { ssize_t res ; while ( len > 0 ) { DEBUG ( " " ) ; res = read ( f , buf , len ) ; if ( res > 0 ) { len -= res ; buf += res ; } else if ( res < 0 ) { if ( errno != EAGAIN ) { err_nonfatal ( " " ) ; return -1 ; } } else { errno = ECONNRESET ; return -1 ; } } return 0 ; }
Read data from a file descriptor into a buffer
 @param f a file descriptor
 @param buf a buffer
 @param len the number of bytes to be read
 @return 0 on completion, or -1 on failure
Read data from a file descriptor into a buffer @param f a file descriptor @param buf a buffer @param len the number of bytes to be read @return 0 on completion or - 1 on failure