#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(__ANDROID__)
#include <sched.h>
#endif
#include <cpuinfo/log.h>
#include <linux/api.h>
#define STRINGIFY(token) …
#define KERNEL_MAX_FILENAME …
#define KERNEL_MAX_FILESIZE …
#define FREQUENCY_FILENAME_SIZE …
#define CUR_FREQUENCY_FILENAME_FORMAT …
#define MAX_FREQUENCY_FILENAME_FORMAT …
#define MIN_FREQUENCY_FILENAME_FORMAT …
#define FREQUENCY_FILESIZE …
#define PACKAGE_ID_FILENAME_SIZE …
#define PACKAGE_ID_FILENAME_FORMAT …
#define PACKAGE_ID_FILESIZE …
#define CORE_ID_FILENAME_SIZE …
#define CORE_ID_FILENAME_FORMAT …
#define CORE_ID_FILESIZE …
#define CORE_CPUS_FILENAME_SIZE …
#define CORE_CPUS_FILENAME_FORMAT …
#define CORE_SIBLINGS_FILENAME_SIZE …
#define CORE_SIBLINGS_FILENAME_FORMAT …
#define CLUSTER_CPUS_FILENAME_SIZE …
#define CLUSTER_CPUS_FILENAME_FORMAT …
#define PACKAGE_CPUS_FILENAME_SIZE …
#define PACKAGE_CPUS_FILENAME_FORMAT …
#define THREAD_SIBLINGS_FILENAME_SIZE …
#define THREAD_SIBLINGS_FILENAME_FORMAT …
#define POSSIBLE_CPULIST_FILENAME …
#define PRESENT_CPULIST_FILENAME …
inline static const char* parse_number(const char* start, const char* end, uint32_t number_ptr[restrict static 1]) { … }
inline static bool is_whitespace(char c) { … }
#if defined(__ANDROID__) && !defined(CPU_SETSIZE)
#if defined(__LP64__)
static const uint32_t default_max_processors_count = 1024;
#else
static const uint32_t default_max_processors_count = 32;
#endif
#else
static const uint32_t default_max_processors_count = …;
#endif
static bool uint32_parser(const char* filename, const char* text_start, const char* text_end, void* context) { … }
uint32_t cpuinfo_linux_get_max_processors_count(void) { … }
uint32_t cpuinfo_linux_get_processor_cur_frequency(uint32_t processor) { … }
uint32_t cpuinfo_linux_get_processor_max_frequency(uint32_t processor) { … }
uint32_t cpuinfo_linux_get_processor_min_frequency(uint32_t processor) { … }
bool cpuinfo_linux_get_processor_core_id(uint32_t processor, uint32_t core_id_ptr[restrict static 1]) { … }
bool cpuinfo_linux_get_processor_package_id(uint32_t processor, uint32_t package_id_ptr[restrict static 1]) { … }
static bool max_processor_number_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) { … }
uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count) { … }
uint32_t cpuinfo_linux_get_max_present_processor(uint32_t max_processors_count) { … }
struct detect_processors_context { … };
static bool detect_processor_parser(uint32_t processor_list_start, uint32_t processor_list_end, void* context) { … }
bool cpuinfo_linux_detect_possible_processors(
uint32_t max_processors_count,
uint32_t* processor0_flags,
uint32_t processor_struct_size,
uint32_t possible_flag) { … }
bool cpuinfo_linux_detect_present_processors(
uint32_t max_processors_count,
uint32_t* processor0_flags,
uint32_t processor_struct_size,
uint32_t present_flag) { … }
struct siblings_context { … };
static bool siblings_parser(uint32_t sibling_list_start, uint32_t sibling_list_end, struct siblings_context* context) { … }
bool cpuinfo_linux_detect_core_cpus(
uint32_t max_processors_count,
uint32_t processor,
cpuinfo_siblings_callback callback,
void* context) { … }
bool cpuinfo_linux_detect_core_siblings(
uint32_t max_processors_count,
uint32_t processor,
cpuinfo_siblings_callback callback,
void* context) { … }
bool cpuinfo_linux_detect_thread_siblings(
uint32_t max_processors_count,
uint32_t processor,
cpuinfo_siblings_callback callback,
void* context) { … }
bool cpuinfo_linux_detect_cluster_cpus(
uint32_t max_processors_count,
uint32_t processor,
cpuinfo_siblings_callback callback,
void* context) { … }
bool cpuinfo_linux_detect_package_cpus(
uint32_t max_processors_count,
uint32_t processor,
cpuinfo_siblings_callback callback,
void* context) { … }