mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
Supporting kFreebsd previously led to FreeBSD (< 14) build breakage: In file included from src/cpuset.c:5: In file included from include/haproxy/cpuset.h:4: include/haproxy/cpuset-t.h:46:2: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'? CPUSET_REPR cpuset; ^~~~~~~~~~~ cpuset_t include/haproxy/cpuset-t.h:21:22: note: expanded from macro 'CPUSET_REPR' # define CPUSET_REPR cpu_set_t ^
57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
#ifndef _HAPROXY_CPUSET_T_H
|
|
#define _HAPROXY_CPUSET_T_H
|
|
|
|
#define _GNU_SOURCE
|
|
#include <sched.h>
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
|
#include <sys/param.h>
|
|
#ifdef __FreeBSD__
|
|
#include <sys/_cpuset.h>
|
|
#include <sys/cpuset.h>
|
|
#include <sys/sysctl.h>
|
|
#include <strings.h>
|
|
#endif
|
|
#endif
|
|
|
|
#include <haproxy/api-t.h>
|
|
|
|
#if defined(__linux__) || defined(__DragonFly__) || \
|
|
(defined(__FreeBSD_kernel__) && defined(__GLIBC__))
|
|
|
|
# define CPUSET_REPR cpu_set_t
|
|
# define CPUSET_USE_CPUSET
|
|
|
|
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
|
|
|
# define CPUSET_REPR cpuset_t
|
|
|
|
# if defined(__FreeBSD__) && __FreeBSD_version >= 1400046
|
|
# define CPUSET_USE_CPUSET
|
|
# else
|
|
# define CPUSET_USE_FREEBSD_CPUSET
|
|
# endif
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
# define CPUSET_REPR unsigned long
|
|
# define CPUSET_USE_ULONG
|
|
|
|
#else
|
|
|
|
# error "No cpuset support implemented on this platform"
|
|
|
|
#endif
|
|
|
|
struct hap_cpuset {
|
|
CPUSET_REPR cpuset;
|
|
};
|
|
|
|
struct cpu_map {
|
|
struct hap_cpuset proc; /* list of CPU masks for the whole process */
|
|
struct hap_cpuset proc_t1 ; /* list of CPU masks for the 1st thread of the process */
|
|
struct hap_cpuset thread[MAX_THREADS]; /* list of CPU masks for the 32/64 first threads of the 1st process */
|
|
};
|
|
|
|
#endif /* _HAPROXY_CPUSET_T_H */
|