On 9/21/20 10:27 PM, Feng Tang wrote:
> +static void parse_text(void)
> +{
> +     FILE *file;
> +     char *line = NULL;
> +     size_t len = 0;
> +     int ret;
> +
> +     file = fopen("cpuid.txt", "r");
> +     if (!file) {
> +             printf("Error in opening 'cpuid.txt'\n");
> +             return;
> +     }

This mostly looks fine to me.  A few things about cpuid.txt, though...
It needs to be read out of *some* location which is not the current
directory.  Maybe:

        /usr/share/hwdata/cpu.ids

or something.  It also needs a "-f" argument to override this default
location.  I don't know if there's a better per-kernel place to put this
file, though.

Reply via email to