aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-03-07 01:16:01 -0500
committerfrosty <gabriel@bwaaa.monster>2026-03-07 01:16:01 -0500
commit2f305c8f9c5c9ae28e839500ffa1854948c56928 (patch)
tree54a432bebd7efdf8be2bcf4e64993e75ebd5d88c /src
parent0a5a3114eccf9b6c2af805f19fda2835ce247abb (diff)
downloadbeaker-master.tar.gz
fixed compatibility issues, cross platform solution used for core count instead.HEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c
index b623db7..caeb4bf 100644
--- a/src/server.c
+++ b/src/server.c
@@ -9,7 +9,7 @@
#include <sys/socket.h>
#include <unistd.h>
#include <pthread.h>
-#include <sys/sysinfo.h>
+#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
@@ -86,8 +86,9 @@ static int work_queue_pop(WorkQueue *queue) {
}
static int get_optimal_thread_count(void) {
- int cores = get_nprocs();
- return cores * 2;
+ long cores = sysconf(_SC_NPROCESSORS_ONLN);
+ if (cores < 1) cores = 1;
+ return (int)(cores * 2);
}
void handle_client_connection(int new_socket);