[LTP] [PATCH v7 2/4] Hugetlb: Migrating libhugetlbfs brk_near_huge
Cyril Hrubis
chrubis@suse.cz
Fri Nov 4 10:21:25 CET 2022
Hi!
> +#ifdef __powerpc64__
> +static int arch_has_slice_support(void)
> +{
> + char mmu_type[16];
> + FILE *fp;
> + int ret;
> +
> + fp = SAFE_POPEN("cat /proc/cpuinfo | grep MMU | awk '{ print $3}'", "r");
> + ret = fscanf(fp, "%s", mmu_type);
> + pclose(fp);
> +
> + if (ret < 0)
> + tst_brk(TBROK, "Failed to determine MMU type");
We do have SAFE_FILE_LINES_SCANF() that simplifies all this to a single line;
SAFE_FILE_LINES_SCANF("/proc/cpuinfo", "MMU : %16s", mmu_type);
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list