external/libwally-core/src/cpufeatures/cpu-features.c
static int
read_file(const char*  pathname, char*  buffer, size_t  buffsize)
{
    int  fd, count;

    fd = open(pathname, O_RDONLY);
    if (fd < 0) {
        return -1;
    }
    count = 0;
    while (count < (int)buffsize) {
        int ret = read(fd, buffer + count, buffsize - count);
        if (ret < 0) {
            if (errno == EINTR)
                continue;
            if (count == 0)
                count = -1;
            break;
        }
        if (ret == 0)
            break;
        count += ret;
    }
    close(fd);
    return count;
}
/* Read the content of /proc/cpuinfo into a user-provided buffer.
 * Return the length of the data, or -1 on error. Does *not*
 * zero-terminate the content. Will not read more
 * than 'buffsize' bytes.
 */
Read the content of /proc/cpuinfo into a user-provided buffer.
Return the length of the data, or -1 on error. Does *not
zero-terminate the content. Will not read more
than 'buffsize' bytes.
Read the content of / proc / cpuinfo into a user - provided buffer . Return the length of the data or - 1 on error . Does * not zero - terminate the content . Will not read more than ' buffsize ' bytes .
static int
read_file(const char*  pathname, char*  buffer, size_t  buffsize)
{
    int  fd, count;
    fd = open(pathname, O_RDONLY);
    if (fd < 0) {
        return -1;
    }
    count = 0;
    while (count < (int)buffsize) {
        int ret = read(fd, buffer + count, buffsize - count);
        if (ret < 0) {
            if (errno == EINTR)
                continue;
            if (count == 0)
                count = -1;
            break;
        }
        if (ret == 0)
            break;
        count += ret;
    }
    close(fd);
    return count;
}
static int read_file ( const char * pathname , char * buffer , size_t buffsize ) { int fd , count ; fd = open ( pathname , O_RDONLY ) ; if ( fd < 0 ) { return -1 ; } count = 0 ; while ( count < ( int ) buffsize ) { int ret = read ( fd , buffer + count , buffsize - count ) ; if ( ret < 0 ) { if ( errno == EINTR ) continue ; if ( count == 0 ) count = -1 ; break ; } if ( ret == 0 ) break ; count += ret ; } close ( fd ) ; return count ; }
Read the content of /proc/cpuinfo into a user-provided buffer.
Read the content of / proc / cpuinfo into a user - provided buffer .