From f5568ff586599fcffdb8462b11b574beb393e629 Mon Sep 17 00:00:00 2001 From: fryshorts Date: Wed, 6 May 2015 21:15:24 +0200 Subject: [PATCH] libobs: Split up processor logging on nix Split the function logging the processor information on nix into two parts. The part logging the number of logical cores is portable and works on all systems that support POSIX.1 while the other part is specific to linux. --- libobs/obs-nix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libobs/obs-nix.c b/libobs/obs-nix.c index 4a48b0aaf..788618a9f 100644 --- a/libobs/obs-nix.c +++ b/libobs/obs-nix.c @@ -81,6 +81,12 @@ char *find_libobs_data_file(const char *file) return NULL; } +static void log_processor_cores(void) +{ + blog(LOG_INFO, "Processor: %lu logical cores", + sysconf(_SC_NPROCESSORS_ONLN)); +} + static void log_processor_info(void) { FILE *fp; @@ -90,9 +96,6 @@ static void log_processor_info(void) size_t linecap = 0; struct dstr processor; - blog(LOG_INFO, "Processor: %lu logical cores", - sysconf(_SC_NPROCESSORS_ONLN)); - fp = fopen("/proc/cpuinfo", "r"); if (!fp) return; @@ -191,6 +194,7 @@ static void log_distribution_info(void) void log_system_info(void) { + log_processor_cores(); log_processor_info(); log_memory_info(); log_kernel_version();