branch: externals/hotfuzz
commit 17c0413af30ed249650535369d4d4f7abef70a8c
Author: sashimacs <[email protected]>
Commit: Axel Forsman <[email protected]>
Cross-platform support in native module
---
CMakeLists.txt | 2 +-
hotfuzz-module.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 376e5dbf3f..bbd5541dff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ find_package(Threads REQUIRED)
add_library(hotfuzz-module MODULE hotfuzz-module.c)
set_target_properties(hotfuzz-module PROPERTIES
- C_STANDARD 99
+ C_STANDARD 11
POSITION_INDEPENDENT_CODE ON
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
diff --git a/hotfuzz-module.c b/hotfuzz-module.c
index a8c8b1e4c0..99a5efbb6c 100644
--- a/hotfuzz-module.c
+++ b/hotfuzz-module.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <emacs-module.h>
#include <pthread.h>
-#include <sys/sysinfo.h>
+#include <unistd.h>
#define MIN(a, b) ({ __typeof__(a) _a = (a), _b = (b); _a < _b ? _a : _b; })
#define MAX(a, b) ({ __typeof__(a) _a = (a), _b = (b); _a > _b ? _a : _b; })
@@ -369,7 +369,7 @@ int emacs_module_init(struct emacs_runtime *rt) {
return 2;
static struct Data data;
- data.max_workers = get_nprocs();
+ data.max_workers = sysconf(_SC_NPROCESSORS_ONLN);
if (!(data.workers = malloc(data.max_workers * sizeof *data.workers)))
return 1;