mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-21 06:06:59 -04:00
MINOR: support cpu-map feature through the compile option USE_CPU_AFFINITY on FreeBSD
This commit is contained in:
parent
44fc9dfa6d
commit
caa6a1bb46
1 changed files with 8 additions and 0 deletions
|
|
@ -50,6 +50,10 @@
|
|||
#define __USE_GNU
|
||||
#include <sched.h>
|
||||
#undef __USE_GNU
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpuset.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_FULL
|
||||
|
|
@ -1780,7 +1784,11 @@ int main(int argc, char **argv)
|
|||
if (proc < global.nbproc && /* child */
|
||||
proc < LONGBITS && /* only the first 32/64 processes may be pinned */
|
||||
global.cpu_map[proc]) /* only do this if the process has a CPU map */
|
||||
#ifdef __FreeBSD__
|
||||
cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(unsigned long), (void *)&global.cpu_map[proc]);
|
||||
#else
|
||||
sched_setaffinity(0, sizeof(unsigned long), (void *)&global.cpu_map[proc]);
|
||||
#endif
|
||||
#endif
|
||||
/* close the pidfile both in children and father */
|
||||
if (pidfd >= 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue