1#ifndef __PERF_MUSL_COMPAT_H 2#define __PERF_MUSL_COMPAT_H 3 4#ifndef __ASSEMBLER__ 5 6#include <sys/ioctl.h> 7#include <asm/unistd.h> 8#include <unistd.h> 9#include <stdio.h> 10 11#undef _IOWR 12#undef _IOR 13#undef _IOW 14#undef _IOC 15#undef _IO 16 17#define _SC_LEVEL1_DCACHE_LINESIZE -1 18 19static inline long sysconf_wrap(int name) 20{ 21 FILE *f; 22 int val; 23 24 switch (name) { 25 case _SC_LEVEL1_DCACHE_LINESIZE: 26 f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); 27 if (!f) 28 return 0; 29 30 if (fscanf(f, "%d", &val) != 1) 31 return 0; 32 33 fclose(f); 34 return val; 35 default: 36 return sysconf(name); 37 } 38} 39 40#define sysconf(_n) sysconf_wrap(_n) 41 42#endif 43#endif 44