James Eder jimportal@gmail.com writes:
@@ -2261,7 +2242,19 @@ NTSTATUS WINAPI NtInitiatePowerAction( SystemAction,MinSystemState,Flags,Asynchronous); return STATUS_NOT_IMPLEMENTED; }
+#ifdef linux +static int have_cpufreq(void) +{
- FILE* f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
- if(f)
- {
fclose(f);
return 1;
- }
- return 0;
+} +#endif
You don't want to open a file just to see if you will be able to open it for real later on. You'll need to check the subsequent open anyway, so you can do the fallback at that point.