403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.238
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/net/haproxy17/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/net/haproxy17/files/patch-fix-cpuaffinity
X-Git-Url: http://git.haproxy.org/?p=haproxy.git;a=blobdiff_plain;f=src%2Fhaproxy.c;h=30e850c4ac4719b71adccb3b6bd41248ef5bb470;hp=7af4ab479c761a43b2fa64d2124388dbf5c21fc3;hb=97148f60b8feec39b76768d1bcfab6d755c12164;hpb=0d00593361b91017b894c4c7d5e24721a7838d6e

diff --git a/src/haproxy.c b/src/haproxy.c
index 7af4ab4..30e850c 100644
--- src/haproxy.c
+++ src/haproxy.c
@@ -2018,7 +2018,18 @@ int main(int argc, char **argv)
 		    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]);
+		{
+			cpuset_t cpuset;
+			int i;
+			unsigned long cpu_map = global.cpu_map[proc];
+
+			CPU_ZERO(&cpuset);
+			while ((i = ffsl(cpu_map)) > 0) {
+				CPU_SET(i - 1, &cpuset);
+				cpu_map &= ~(1 << (i - 1));
+			}
+			ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset), &cpuset);
+		}
 #else
 			sched_setaffinity(0, sizeof(unsigned long), (void *)&global.cpu_map[proc]);
 #endif

Youez - 2016 - github.com/yon3zu
LinuXploit