From e71c07b9d5cc1236ca08536ae052faa5fc6b9096 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 23 Apr 2023 18:16:38 -0400 Subject: Fix up darwin --- .gitignore | 1 + common.h | 3 +++ darwin.c | 18 +++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index f3aff03..9d4d3c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea cmake-build-* build +*.gch diff --git a/common.h b/common.h index b936a62..832d85c 100644 --- a/common.h +++ b/common.h @@ -41,6 +41,9 @@ unsigned int CPUID(unsigned int leaf, union regs_t *reg); int is_cpu_hyperthreaded(); int is_cpu_virtual(); char *get_sys_product(); +#if defined(__APPLE__) +char *get_sys_product_darwin(); +#endif unsigned int get_cpu_count(); char *get_cpu_manufacturer(); char *get_cpu_vendor(); diff --git a/darwin.c b/darwin.c index 9167dc2..843ee93 100644 --- a/darwin.c +++ b/darwin.c @@ -1,7 +1,7 @@ #if defined(__APPLE__) #include "common.h" -char *get_sys_product() { +char *get_sys_product_darwin() { char model[100] = {0}; size_t len; @@ -10,7 +10,7 @@ char *get_sys_product() { return strdup(model); } -size_t get_sys_memory() { +ssize_t get_sys_memory() { size_t mem_size; size_t len; @@ -21,18 +21,18 @@ size_t get_sys_memory() { return mem_size / 1024; } -int *get_sys_os_dist(char **a, char **b) { - char version[255] = {0}; +int get_sys_os_dist(char **name, char **version) { size_t version_len; + char data[255] = {0}; version_len = sizeof(version); - sysctlbyname("kern.osproductversion", version, &version_len, NULL, 0); - *a = strdup("MacOS"); - *b = strdup(version); + sysctlbyname("kern.osproductversion", data, &version_len, NULL, 0); + *name = strdup("MacOS"); + *version = strdup(data); return 0; } -void *get_block_devices(void *x) { +struct Block_Device **get_block_devices(size_t *total) { return NULL; } -#endif \ No newline at end of file +#endif -- cgit