dlls/ntdll/unix/system.c
static BOOL sysfs_parse_bitmap(const char *filename, ULONG_PTR *mask)
{
    FILE *f;
    DWORD r;

    f = fopen(filename, "r");
    if (!f) return FALSE;

    while (!feof(f))
    {
        char op;
        if (!fscanf(f, "%x%c ", &r, &op)) break;
        *mask = (sizeof(ULONG_PTR)>sizeof(int) ? *mask << (8 * sizeof(DWORD)) : 0) + r;
    }
    fclose( f );
    return TRUE;
}
/* Helper function for counting bitmap values as commonly used by the Linux kernel
 * for storing CPU masks in sysfs. The format is comma separated lists of hex values
 * each max 32-bit e.g. "00ff" or even "00,00000000,0000ffff".
 *
 * Example files include:
 * - /sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map
 * - /sys/devices/system/cpu/cpu0/topology/thread_siblings
 */
Helper function for counting bitmap values as commonly used by the Linux kernel
for storing CPU masks in sysfs. The format is comma separated lists of hex values
each max 32-bit e.g.


Helper function for counting bitmap values as commonly used by the Linux kernel for storing CPU masks in sysfs . The format is comma separated lists of hex values each max 32 - bit e . g .
static BOOL sysfs_parse_bitmap(const char *filename, ULONG_PTR *mask)
{
    FILE *f;
    DWORD r;
    f = fopen(filename, "r");
    if (!f) return FALSE;
    while (!feof(f))
    {
        char op;
        if (!fscanf(f, "%x%c ", &r, &op)) break;
        *mask = (sizeof(ULONG_PTR)>sizeof(int) ? *mask << (8 * sizeof(DWORD)) : 0) + r;
    }
    fclose( f );
    return TRUE;
}
static BOOL sysfs_parse_bitmap ( const char * filename , ULONG_PTR * mask ) { FILE * f ; DWORD r ; f = fopen ( filename , " " ) ; if ( ! f ) return FALSE ; while ( ! feof ( f ) ) { char op ; if ( ! fscanf ( f , " " , & r , & op ) ) break ; * mask = ( sizeof ( ULONG_PTR ) > sizeof ( int ) ? * mask << ( 8 * sizeof ( DWORD ) ) : 0 ) + r ; } fclose ( f ) ; return TRUE ; }
Helper function for counting bitmap values as commonly used by the Linux kernel
 for storing CPU masks in sysfs.
Helper function for counting bitmap values as commonly used by the Linux kernel for storing CPU masks in sysfs .