this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add hw.cpufrequency sysctl

+16
+16
src/kernel/emulation/linux/misc/sysctl_hw.c
··· 4 4 #include <mach/mach_init.h> 5 5 #include <sys/errno.h> 6 6 #include "sysctl_kern.h" 7 + #include "sysctl_proc.h" 7 8 #include "../ext/sys/utsname.h" 8 9 9 10 extern kern_return_t mach_port_deallocate(ipc_space_t task, mach_port_name_t name); ··· 19 20 _HW_CPUSUBTYPE, 20 21 _HW_CPUTHREADTYPE, 21 22 _HW_64BITCAPABLE, 23 + _HW_CPUFREQUENCY = 15, 22 24 }; 23 25 24 26 static sysctl_handler(handle_availcpu); ··· 33 35 static sysctl_handler(handle_cputhreadtype); 34 36 static sysctl_handler(handle_cpu64bitcapable); 35 37 static sysctl_handler(handle_machine); 38 + static sysctl_handler(handle_cpufrequency); 36 39 37 40 const struct known_sysctl sysctls_hw[] = { 38 41 { .oid = HW_AVAILCPU, .type = CTLTYPE_INT, .exttype = "", .name = "availcpu", .handler = handle_availcpu }, ··· 48 51 { .oid = _HW_CPUTHREADTYPE, .type = CTLTYPE_INT, .exttype = "", .name = "cputhreadtype", .handler = handle_cputhreadtype }, 49 52 { .oid = _HW_64BITCAPABLE, .type = CTLTYPE_INT, .exttype = "", .name = "cpu64bit_capable", .handler = handle_cpu64bitcapable }, 50 53 { .oid = HW_MACHINE, .type = CTLTYPE_STRING, .exttype = "S", .name = "machine", .handler = handle_machine }, 54 + { .oid = _HW_CPUFREQUENCY, .type = CTLTYPE_INT, .exttype = "", .name = "cpufrequency", .handler = handle_cpufrequency }, 51 55 { .oid = -1 } 52 56 }; 53 57 ··· 150 154 { 151 155 sysctl_handle_size(sizeof(int)); 152 156 *((int*) old) = gethostinfo()->cpu_threadtype; 157 + return 0; 158 + } 159 + 160 + sysctl_handler(handle_cpufrequency) 161 + { 162 + int freq = 2400000; 163 + char buf[16]; 164 + 165 + if (read_string("/sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_max_freq", buf, sizeof(buf))) 166 + freq = __simple_atoi(buf, NULL); 167 + *((int*) old) = freq; 168 + 153 169 return 0; 154 170 } 155 171